diff options
author | 2023-05-06 16:13:14 +0100 | |
---|---|---|
committer | 2023-05-09 15:42:23 +0100 | |
commit | 9266ce3a1b3e9f20ca01e8bfc75530f1ac21f7cf (patch) | |
tree | e159a0fae7850d706d713cf2b49dfed2140ce655 /bot/exts/core | |
parent | Apply fixes for ruff linting (diff) |
Move unshared contants inside modules
Diffstat (limited to 'bot/exts/core')
-rw-r--r-- | bot/exts/core/error_handler.py | 5 | ||||
-rw-r--r-- | bot/exts/core/source.py | 13 |
2 files changed, 11 insertions, 7 deletions
diff --git a/bot/exts/core/error_handler.py b/bot/exts/core/error_handler.py index fa478d43..62dee53c 100644 --- a/bot/exts/core/error_handler.py +++ b/bot/exts/core/error_handler.py @@ -8,7 +8,7 @@ from discord.ext import commands from sentry_sdk import push_scope from bot.bot import Bot -from bot.constants import Channels, Colours, ERROR_REPLIES, NEGATIVE_REPLIES, RedirectOutput +from bot.constants import Channels, Colours, ERROR_REPLIES, NEGATIVE_REPLIES from bot.utils.commands import get_command_suggestions from bot.utils.decorators import InChannelCheckFailure, InMonthCheckFailure from bot.utils.exceptions import APIError, MovedCommandError, UserNotPlayingError @@ -16,6 +16,7 @@ from bot.utils.exceptions import APIError, MovedCommandError, UserNotPlayingErro log = logging.getLogger(__name__) +DELETE_DELAY = 10 QUESTION_MARK_ICON = "https://cdn.discordapp.com/emojis/512367613339369475.png" @@ -184,7 +185,7 @@ class CommandErrorHandler(commands.Cog): e.description = "\n".join( misspelled_content.replace(command_name, cmd, 1) for cmd in command_suggestions ) - await ctx.send(embed=e, delete_after=RedirectOutput.delete_delay) + await ctx.send(embed=e, delete_after=DELETE_DELAY) async def setup(bot: Bot) -> None: diff --git a/bot/exts/core/source.py b/bot/exts/core/source.py index 592156fc..7c67bcb5 100644 --- a/bot/exts/core/source.py +++ b/bot/exts/core/source.py @@ -5,10 +5,13 @@ from discord import Embed from discord.ext import commands from bot.bot import Bot -from bot.constants import Channels, Source, WHITELISTED_CHANNELS +from bot.constants import Channels, WHITELISTED_CHANNELS from bot.utils.converters import SourceConverter, SourceType from bot.utils.decorators import whitelist_override +GITHUB_BOT_URL = "https://github.com/python-discord/sir-lancebot" +BOT_AVATAR_URL = "https://avatars1.githubusercontent.com/u/9919" + class BotSource(commands.Cog): """Displays information about the bot's source code.""" @@ -19,8 +22,8 @@ class BotSource(commands.Cog): """Display information and a GitHub link to the source code of a command, tag, or cog.""" if not source_item: embed = Embed(title="Sir Lancebot's GitHub Repository") - embed.add_field(name="Repository", value=f"[Go to GitHub]({Source.github})") - embed.set_thumbnail(url=Source.github_avatar_url) + embed.add_field(name="Repository", value=f"[Go to GitHub]({GITHUB_BOT_URL})") + embed.set_thumbnail(url=BOT_AVATAR_URL) await ctx.send(embed=embed) return @@ -57,7 +60,7 @@ class BotSource(commands.Cog): file_location = Path(filename).relative_to(Path.cwd()).as_posix() - url = f"{Source.github}/blob/main/{file_location}{lines_extension}" + url = f"{GITHUB_BOT_URL}/blob/main/{file_location}{lines_extension}" return url, file_location, first_line_no or None @@ -73,7 +76,7 @@ class BotSource(commands.Cog): description = source_object.description.splitlines()[0] embed = Embed(title=title, description=description) - embed.set_thumbnail(url=Source.github_avatar_url) + embed.set_thumbnail(url=BOT_AVATAR_URL) embed.add_field(name="Source Code", value=f"[Go to GitHub]({url})") line_text = f":{first_line}" if first_line else "" embed.set_footer(text=f"{location}{line_text}") |