Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bot/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions bot/exts/filtering/_filter_lists/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
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
Expand All @@ -14,16 +14,16 @@
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 = (
Expand Down
3 changes: 2 additions & 1 deletion bot/exts/filtering/filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
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
Expand Down Expand Up @@ -1456,6 +1456,7 @@ async def send_weekly_auto_infraction_report(
contents=report,
http_session=self.bot.http_session,
lexer="text",
paste_url=BaseURLs.paste_url,
)
paste_resp = resp["link"]
except (ValueError, PasteTooLongError, PasteUploadError):
Expand Down
3 changes: 2 additions & 1 deletion bot/exts/moderation/dm_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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

Expand Down Expand Up @@ -58,6 +58,7 @@ async def dmrelay(self, ctx: Context, user: discord.User, limit: int = 100) -> N
contents=metadata + output,
lexer="text",
http_session=self.bot.http_session,
paste_url=BaseURLs.paste_url,
)
message = resp["link"]
except PasteTooLongError:
Expand Down
3 changes: 2 additions & 1 deletion bot/exts/moderation/metabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
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

Expand Down Expand Up @@ -146,6 +146,7 @@ async def metabase_extract(
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."
Expand Down
3 changes: 2 additions & 1 deletion bot/exts/utils/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
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

Expand Down Expand Up @@ -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."
Expand Down
3 changes: 2 additions & 1 deletion bot/exts/utils/snekbox/_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
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
Expand Down Expand Up @@ -211,6 +211,7 @@ async def upload_output(self, output: str) -> str | None:
contents=output,
lexer="text",
http_session=self.bot.http_session,
paste_url=BaseURLs.paste_url,
)
return paste_link["link"]
except paste_service.PasteTooLongError:
Expand Down