aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2023-07-11 19:14:34 +0100
committerGravatar Chris Lovering <[email protected]>2023-07-11 19:14:34 +0100
commit7ad9b98ff672c2b69b65330ccf3dfe9b937f13b1 (patch)
tree4c68b83846cb373ea9948de046c999c2f313f5b1
parentMerge pull request #2648 from python-discord/use-bot-core-paste-service (diff)
Allow the url used for the paste service to be overwritten
-rw-r--r--bot/constants.py3
-rw-r--r--bot/exts/filtering/_filter_lists/extension.py8
-rw-r--r--bot/exts/filtering/filtering.py3
-rw-r--r--bot/exts/moderation/dm_relay.py3
-rw-r--r--bot/exts/moderation/metabase.py3
-rw-r--r--bot/exts/utils/internal.py3
-rw-r--r--bot/exts/utils/snekbox/_cog.py3
7 files changed, 16 insertions, 10 deletions
diff --git a/bot/constants.py b/bot/constants.py
index 5b7268310..fa72de19f 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -489,7 +489,8 @@ class _BaseURLs(EnvConfig):
# Site
site_api = "http://site.default.svc.cluster.local/api"
- site_paste = "https://paste.pythondiscord.com"
+
+ paste_url = "https://paste.pythondiscord.com"
BaseURLs = _BaseURLs()
diff --git a/bot/exts/filtering/_filter_lists/extension.py b/bot/exts/filtering/_filter_lists/extension.py
index 84bd68aaa..d656bc6d2 100644
--- a/bot/exts/filtering/_filter_lists/extension.py
+++ b/bot/exts/filtering/_filter_lists/extension.py
@@ -4,7 +4,7 @@ import typing
from os.path import splitext
import bot
-from bot.constants import BaseURLs, Channels
+from bot.constants import Channels
from bot.exts.filtering._filter_context import Event, FilterContext
from bot.exts.filtering._filter_lists.filter_list import FilterList, ListType
from bot.exts.filtering._filters.extension import ExtensionFilter
@@ -14,16 +14,16 @@ from bot.exts.filtering._settings import ActionSettings
if typing.TYPE_CHECKING:
from bot.exts.filtering.filtering import Filtering
-
+PASTE_URL = "https://paste.pythondiscord.com"
PY_EMBED_DESCRIPTION = (
"It looks like you tried to attach a Python file - "
- f"please use a code-pasting service such as {BaseURLs.site_paste}"
+ f"please use a code-pasting service such as {PASTE_URL}"
)
TXT_LIKE_FILES = {".txt", ".csv", ".json"}
TXT_EMBED_DESCRIPTION = (
"You either uploaded a `{blocked_extension}` file or entered a message that was too long. "
- f"Please use our [paste bin]({BaseURLs.site_paste}) instead."
+ f"Please use our [paste bin]({PASTE_URL}) instead."
)
DISALLOWED_EMBED_DESCRIPTION = (
diff --git a/bot/exts/filtering/filtering.py b/bot/exts/filtering/filtering.py
index 629f9471e..2b7ad2ff3 100644
--- a/bot/exts/filtering/filtering.py
+++ b/bot/exts/filtering/filtering.py
@@ -24,7 +24,7 @@ import bot
import bot.exts.filtering._ui.filter as filters_ui
from bot import constants
from bot.bot import Bot
-from bot.constants import Channels, Guild, MODERATION_ROLES, Roles
+from bot.constants import BaseURLs, Channels, Guild, MODERATION_ROLES, Roles
from bot.exts.backend.branding._repository import HEADERS, PARAMS
from bot.exts.filtering._filter_context import Event, FilterContext
from bot.exts.filtering._filter_lists import FilterList, ListType, ListTypeConverter, filter_list_types
@@ -1456,6 +1456,7 @@ class Filtering(Cog):
contents=report,
http_session=self.bot.http_session,
lexer="text",
+ paste_url=BaseURLs.paste_url,
)
paste_resp = resp["link"]
except (ValueError, PasteTooLongError, PasteUploadError):
diff --git a/bot/exts/moderation/dm_relay.py b/bot/exts/moderation/dm_relay.py
index 5bec3b10f..e8c5a5428 100644
--- a/bot/exts/moderation/dm_relay.py
+++ b/bot/exts/moderation/dm_relay.py
@@ -3,7 +3,7 @@ from discord.ext.commands import Cog, Context, command, has_any_role
from pydis_core.utils.paste_service import PasteTooLongError, PasteUploadError, send_to_paste_service
from bot.bot import Bot
-from bot.constants import Emojis, MODERATION_ROLES
+from bot.constants import BaseURLs, Emojis, MODERATION_ROLES
from bot.log import get_logger
from bot.utils.channel import is_mod_channel
@@ -58,6 +58,7 @@ class DMRelay(Cog):
contents=metadata + output,
lexer="text",
http_session=self.bot.http_session,
+ paste_url=BaseURLs.paste_url,
)
message = resp["link"]
except PasteTooLongError:
diff --git a/bot/exts/moderation/metabase.py b/bot/exts/moderation/metabase.py
index 1c0a2c191..42e2342b5 100644
--- a/bot/exts/moderation/metabase.py
+++ b/bot/exts/moderation/metabase.py
@@ -13,7 +13,7 @@ from pydis_core.utils.paste_service import PasteTooLongError, PasteUploadError,
from pydis_core.utils.scheduling import Scheduler
from bot.bot import Bot
-from bot.constants import Metabase as MetabaseConfig, Roles
+from bot.constants import BaseURLs, Metabase as MetabaseConfig, Roles
from bot.log import get_logger
from bot.utils.channel import is_mod_channel
@@ -146,6 +146,7 @@ class Metabase(Cog):
contents=out,
lexer=extension,
http_session=self.bot.http_session,
+ paste_url=BaseURLs.paste_url,
)
except PasteTooLongError:
message = f":x: {ctx.author.mention} Too long to upload to paste service."
diff --git a/bot/exts/utils/internal.py b/bot/exts/utils/internal.py
index 58140b3c0..f2354983f 100644
--- a/bot/exts/utils/internal.py
+++ b/bot/exts/utils/internal.py
@@ -14,7 +14,7 @@ from discord.ext.commands import Cog, Context, group, has_any_role, is_owner
from pydis_core.utils.paste_service import PasteTooLongError, PasteUploadError, send_to_paste_service
from bot.bot import Bot
-from bot.constants import DEBUG_MODE, Roles
+from bot.constants import BaseURLs, DEBUG_MODE, Roles
from bot.log import get_logger
from bot.utils import find_nth_occurrence
@@ -200,6 +200,7 @@ async def func(): # (None,) -> Any
contents=out,
lexer="python",
http_session=self.bot.http_session,
+ paste_url=BaseURLs.paste_url,
)
except PasteTooLongError:
paste_text = "too long to upload to paste service."
diff --git a/bot/exts/utils/snekbox/_cog.py b/bot/exts/utils/snekbox/_cog.py
index 875357fb3..0a3fbc62b 100644
--- a/bot/exts/utils/snekbox/_cog.py
+++ b/bot/exts/utils/snekbox/_cog.py
@@ -14,7 +14,7 @@ from pydis_core.utils import interactions, paste_service
from pydis_core.utils.regex import FORMATTED_CODE_REGEX, RAW_CODE_REGEX
from bot.bot import Bot
-from bot.constants import Channels, Emojis, MODERATION_ROLES, Roles, URLs
+from bot.constants import BaseURLs, Channels, Emojis, MODERATION_ROLES, Roles, URLs
from bot.decorators import redirect_output
from bot.exts.filtering._filter_lists.extension import TXT_LIKE_FILES
from bot.exts.help_channels._channel import is_help_forum_post
@@ -211,6 +211,7 @@ class Snekbox(Cog):
contents=output,
lexer="text",
http_session=self.bot.http_session,
+ paste_url=BaseURLs.paste_url,
)
return paste_link["link"]
except paste_service.PasteTooLongError: