diff options
Diffstat (limited to 'bot/exts')
-rw-r--r-- | bot/exts/core/error_handler.py | 5 | ||||
-rw-r--r-- | bot/exts/core/source.py | 13 | ||||
-rw-r--r-- | bot/exts/fun/catify.py | 16 |
3 files changed, 20 insertions, 14 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}") diff --git a/bot/exts/fun/catify.py b/bot/exts/fun/catify.py index 67d17292..c1677cd8 100644 --- a/bot/exts/fun/catify.py +++ b/bot/exts/fun/catify.py @@ -5,9 +5,11 @@ from discord import AllowedMentions, Embed, Forbidden from discord.ext import commands from bot.bot import Bot -from bot.constants import Cats, Colours, NEGATIVE_REPLIES +from bot.constants import Colours, NEGATIVE_REPLIES from bot.utils import helpers +CATS = ["ᓚᘏᗢ", "ᘡᘏᗢ", "🐈", "ᓕᘏᗢ", "ᓇᘏᗢ", "ᓂᘏᗢ", "ᘣᘏᗢ", "ᕦᘏᗢ", "ᕂᘏᗢ"] + class Catify(commands.Cog): """Cog for the catify command.""" @@ -35,7 +37,7 @@ class Catify(commands.Cog): await ctx.send(embed=embed) return - display_name += f" | {random.choice(Cats.cats)}" + display_name += f" | {random.choice(CATS)}" await ctx.send(f"Your catified nickname is: `{display_name}`", allowed_mentions=AllowedMentions.none()) @@ -56,10 +58,10 @@ class Catify(commands.Cog): name = name.lower() if "cat" in name: if random.randint(0, 5) == 5: - string_list[index] = name.replace("cat", f"**{random.choice(Cats.cats)}**") + string_list[index] = name.replace("cat", f"**{random.choice(CATS)}**") else: - string_list[index] = name.replace("cat", random.choice(Cats.cats)) - for cat in Cats.cats: + string_list[index] = name.replace("cat", random.choice(CATS)) + for cat in CATS: if cat in name: string_list[index] = name.replace(cat, "cat") @@ -68,9 +70,9 @@ class Catify(commands.Cog): for _ in range(random.randint(1, string_len)): # insert cat at random index if random.randint(0, 5) == 5: - string_list.insert(random.randint(0, len(string_list)), f"**{random.choice(Cats.cats)}**") + string_list.insert(random.randint(0, len(string_list)), f"**{random.choice(CATS)}**") else: - string_list.insert(random.randint(0, len(string_list)), random.choice(Cats.cats)) + string_list.insert(random.randint(0, len(string_list)), random.choice(CATS)) text = helpers.suppress_links(" ".join(string_list)) await ctx.send( |