mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-23 19:25:25 +03:00
37 lines
1.1 KiB
Diff
37 lines
1.1 KiB
Diff
Upstream: Unknown
|
|
Reason: Adds support for pasting to tpaste.us
|
|
|
|
diff --git a/sopel/modules/help.py b/sopel/modules/help.py
|
|
index 7d8e227..c4f4f31 100644
|
|
--- a/sopel/modules/help.py
|
|
+++ b/sopel/modules/help.py
|
|
@@ -158,6 +158,21 @@ def post_to_ubuntu(msg):
|
|
|
|
return result.url
|
|
|
|
+def post_to_tpaste(msg):
|
|
+ try:
|
|
+ result = _requests_post_catch_errors('https://tpaste.us/', data={'tpaste': msg})
|
|
+ except PostingException:
|
|
+ raise
|
|
+
|
|
+ result = result.text
|
|
+ if re.match(r'https?://tpaste\.us/', result):
|
|
+ # find/replace just in case the site tries to be sneaky and save on SSL overhead,
|
|
+ # though it will probably send us an HTTPS link without any tricks.
|
|
+ return result.replace('http://', 'https://', 1)
|
|
+ else:
|
|
+ LOGGER.error("Invalid result %s", result)
|
|
+ raise PostingException('tpaste result did not contain expected URL base.')
|
|
+
|
|
|
|
PASTEBIN_PROVIDERS = {
|
|
'clbin': post_to_clbin,
|
|
@@ -165,6 +180,7 @@ PASTEBIN_PROVIDERS = {
|
|
'hastebin': post_to_hastebin,
|
|
'termbin': post_to_termbin,
|
|
'ubuntu': post_to_ubuntu,
|
|
+ 'tpaste': post_to_tpaste,
|
|
}
|
|
REPLY_METHODS = [
|
|
'channel',
|