From 294915013680c9ad205d6c9fa0c7fa2b79cc1919 Mon Sep 17 00:00:00 2001 From: kwzrd Date: Sat, 28 Mar 2020 15:13:26 +0100 Subject: Deseasonify: rename `seasons` pkg to `exts` It is believed that this is now a more logical name for the package, as extensions no longer bind to seasons. Internally, packages are still grouped into seasonal sub-packages. There are quite a few, and it makes sense to group them by a common theme that inspired their functionality. --- bot/exts/evergreen/help.py | 554 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 554 insertions(+) create mode 100644 bot/exts/evergreen/help.py (limited to 'bot/exts/evergreen/help.py') diff --git a/bot/exts/evergreen/help.py b/bot/exts/evergreen/help.py new file mode 100644 index 00000000..f4d76402 --- /dev/null +++ b/bot/exts/evergreen/help.py @@ -0,0 +1,554 @@ +# Help command from Python bot. All commands that will be added to there in futures should be added to here too. +import asyncio +import itertools +import logging +from collections import namedtuple +from contextlib import suppress +from typing import Union + +from discord import Colour, Embed, HTTPException, Message, Reaction, User +from discord.ext import commands +from discord.ext.commands import CheckFailure, Cog as DiscordCog, Command, Context +from fuzzywuzzy import fuzz, process + +from bot import constants +from bot.bot import SeasonalBot +from bot.constants import Emojis +from bot.utils.pagination import ( + FIRST_EMOJI, LAST_EMOJI, + LEFT_EMOJI, LinePaginator, RIGHT_EMOJI, +) + +DELETE_EMOJI = Emojis.trashcan + +REACTIONS = { + FIRST_EMOJI: 'first', + LEFT_EMOJI: 'back', + RIGHT_EMOJI: 'next', + LAST_EMOJI: 'end', + DELETE_EMOJI: 'stop', +} + +Cog = namedtuple('Cog', ['name', 'description', 'commands']) + +log = logging.getLogger(__name__) + + +class HelpQueryNotFound(ValueError): + """ + Raised when a HelpSession Query doesn't match a command or cog. + + Contains the custom attribute of ``possible_matches``. + Instances of this object contain a dictionary of any command(s) that were close to matching the + query, where keys are the possible matched command names and values are the likeness match scores. + """ + + def __init__(self, arg: str, possible_matches: dict = None): + super().__init__(arg) + self.possible_matches = possible_matches + + +class HelpSession: + """ + An interactive session for bot and command help output. + + Expected attributes include: + * title: str + The title of the help message. + * query: Union[discord.ext.commands.Bot, discord.ext.commands.Command] + * description: str + The description of the query. + * pages: list[str] + A list of the help content split into manageable pages. + * message: `discord.Message` + The message object that's showing the help contents. + * destination: `discord.abc.Messageable` + Where the help message is to be sent to. + Cogs can be grouped into custom categories. All cogs with the same category will be displayed + under a single category name in the help output. Custom categories are defined inside the cogs + as a class attribute named `category`. A description can also be specified with the attribute + `category_description`. If a description is not found in at least one cog, the default will be + the regular description (class docstring) of the first cog found in the category. + """ + + def __init__( + self, + ctx: Context, + *command, + cleanup: bool = False, + only_can_run: bool = True, + show_hidden: bool = False, + max_lines: int = 15 + ): + """Creates an instance of the HelpSession class.""" + self._ctx = ctx + self._bot = ctx.bot + self.title = "Command Help" + + # set the query details for the session + if command: + query_str = ' '.join(command) + self.query = self._get_query(query_str) + self.description = self.query.description or self.query.help + else: + self.query = ctx.bot + self.description = self.query.description + self.author = ctx.author + self.destination = ctx.channel + + # set the config for the session + self._cleanup = cleanup + self._only_can_run = only_can_run + self._show_hidden = show_hidden + self._max_lines = max_lines + + # init session states + self._pages = None + self._current_page = 0 + self.message = None + self._timeout_task = None + self.reset_timeout() + + def _get_query(self, query: str) -> Union[Command, Cog]: + """Attempts to match the provided query with a valid command or cog.""" + command = self._bot.get_command(query) + if command: + return command + + # Find all cog categories that match. + cog_matches = [] + description = None + for cog in self._bot.cogs.values(): + if hasattr(cog, "category") and cog.category == query: + cog_matches.append(cog) + if hasattr(cog, "category_description"): + description = cog.category_description + + # Try to search by cog name if no categories match. + if not cog_matches: + cog = self._bot.cogs.get(query) + + # Don't consider it a match if the cog has a category. + if cog and not hasattr(cog, "category"): + cog_matches = [cog] + + if cog_matches: + cog = cog_matches[0] + cmds = (cog.get_commands() for cog in cog_matches) # Commands of all cogs + + return Cog( + name=cog.category if hasattr(cog, "category") else cog.qualified_name, + description=description or cog.description, + commands=tuple(itertools.chain.from_iterable(cmds)) # Flatten the list + ) + + self._handle_not_found(query) + + def _handle_not_found(self, query: str) -> None: + """ + Handles when a query does not match a valid command or cog. + + Will pass on possible close matches along with the `HelpQueryNotFound` exception. + """ + # Combine command and cog names + choices = list(self._bot.all_commands) + list(self._bot.cogs) + + result = process.extractBests(query, choices, scorer=fuzz.ratio, score_cutoff=90) + + raise HelpQueryNotFound(f'Query "{query}" not found.', dict(result)) + + async def timeout(self, seconds: int = 30) -> None: + """Waits for a set number of seconds, then stops the help session.""" + await asyncio.sleep(seconds) + await self.stop() + + def reset_timeout(self) -> None: + """Cancels the original timeout task and sets it again from the start.""" + # cancel original if it exists + if self._timeout_task: + if not self._timeout_task.cancelled(): + self._timeout_task.cancel() + + # recreate the timeout task + self._timeout_task = self._bot.loop.create_task(self.timeout()) + + async def on_reaction_add(self, reaction: Reaction, user: User) -> None: + """Event handler for when reactions are added on the help message.""" + # ensure it was the relevant session message + if reaction.message.id != self.message.id: + return + + # ensure it was the session author who reacted + if user.id != self.author.id: + return + + emoji = str(reaction.emoji) + + # check if valid action + if emoji not in REACTIONS: + return + + self.reset_timeout() + + # Run relevant action method + action = getattr(self, f'do_{REACTIONS[emoji]}', None) + if action: + await action() + + # remove the added reaction to prep for re-use + with suppress(HTTPException): + await self.message.remove_reaction(reaction, user) + + async def on_message_delete(self, message: Message) -> None: + """Closes the help session when the help message is deleted.""" + if message.id == self.message.id: + await self.stop() + + async def prepare(self) -> None: + """Sets up the help session pages, events, message and reactions.""" + await self.build_pages() + + self._bot.add_listener(self.on_reaction_add) + self._bot.add_listener(self.on_message_delete) + + await self.update_page() + self.add_reactions() + + def add_reactions(self) -> None: + """Adds the relevant reactions to the help message based on if pagination is required.""" + # if paginating + if len(self._pages) > 1: + for reaction in REACTIONS: + self._bot.loop.create_task(self.message.add_reaction(reaction)) + + # if single-page + else: + self._bot.loop.create_task(self.message.add_reaction(DELETE_EMOJI)) + + def _category_key(self, cmd: Command) -> str: + """ + Returns a cog name of a given command for use as a key for `sorted` and `groupby`. + + A zero width space is used as a prefix for results with no cogs to force them last in ordering. + """ + if cmd.cog: + try: + if cmd.cog.category: + return f'**{cmd.cog.category}**' + except AttributeError: + pass + + return f'**{cmd.cog_name}**' + else: + return "**\u200bNo Category:**" + + def _get_command_params(self, cmd: Command) -> str: + """ + Returns the command usage signature. + + This is a custom implementation of `command.signature` in order to format the command + signature without aliases. + """ + results = [] + for name, param in cmd.clean_params.items(): + + # if argument has a default value + if param.default is not param.empty: + + if isinstance(param.default, str): + show_default = param.default + else: + show_default = param.default is not None + + # if default is not an empty string or None + if show_default: + results.append(f'[{name}={param.default}]') + else: + results.append(f'[{name}]') + + # if variable length argument + elif param.kind == param.VAR_POSITIONAL: + results.append(f'[{name}...]') + + # if required + else: + results.append(f'<{name}>') + + return f"{cmd.name} {' '.join(results)}" + + async def build_pages(self) -> None: + """Builds the list of content pages to be paginated through in the help message, as a list of str.""" + # Use LinePaginator to restrict embed line height + paginator = LinePaginator(prefix='', suffix='', max_lines=self._max_lines) + + prefix = constants.Client.prefix + + # show signature if query is a command + if isinstance(self.query, commands.Command): + signature = self._get_command_params(self.query) + parent = self.query.full_parent_name + ' ' if self.query.parent else '' + paginator.add_line(f'**```{prefix}{parent}{signature}```**') + + aliases = ', '.join(f'`{a}`' for a in self.query.aliases) + if aliases: + paginator.add_line(f'**Can also use:** {aliases}\n') + + if not await self.query.can_run(self._ctx): + paginator.add_line('***You cannot run this command.***\n') + + if isinstance(self.query, Cog): + paginator.add_line(f'**{self.query.name}**') + + if self.description: + paginator.add_line(f'*{self.description}*') + + # list all children commands of the queried object + if isinstance(self.query, (commands.GroupMixin, Cog)): + + # remove hidden commands if session is not wanting hiddens + if not self._show_hidden: + filtered = [c for c in self.query.commands if not c.hidden] + else: + filtered = self.query.commands + + # if after filter there are no commands, finish up + if not filtered: + self._pages = paginator.pages + return + + if isinstance(self.query, Cog): + grouped = (('**Commands:**', self.query.commands),) + + elif isinstance(self.query, commands.Command): + grouped = (('**Subcommands:**', self.query.commands),) + + # don't show prefix for subcommands + prefix = '' + + # otherwise sort and organise all commands into categories + else: + cat_sort = sorted(filtered, key=self._category_key) + grouped = itertools.groupby(cat_sort, key=self._category_key) + + for category, cmds in grouped: + cmds = sorted(cmds, key=lambda c: c.name) + + if len(cmds) == 0: + continue + + cat_cmds = [] + + for command in cmds: + + # skip if hidden and hide if session is set to + if command.hidden and not self._show_hidden: + continue + + # see if the user can run the command + strikeout = '' + + # Patch to make the !help command work outside of #bot-commands again + # This probably needs a proper rewrite, but this will make it work in + # the mean time. + try: + can_run = await command.can_run(self._ctx) + except CheckFailure: + can_run = False + + if not can_run: + # skip if we don't show commands they can't run + if self._only_can_run: + continue + strikeout = '~~' + + signature = self._get_command_params(command) + info = f"{strikeout}**`{prefix}{signature}`**{strikeout}" + + # handle if the command has no docstring + if command.short_doc: + cat_cmds.append(f'{info}\n*{command.short_doc}*') + else: + cat_cmds.append(f'{info}\n*No details provided.*') + + # state var for if the category should be added next + print_cat = 1 + new_page = True + + for details in cat_cmds: + + # keep details together, paginating early if it won't fit + lines_adding = len(details.split('\n')) + print_cat + if paginator._linecount + lines_adding > self._max_lines: + paginator._linecount = 0 + new_page = True + paginator.close_page() + + # new page so print category title again + print_cat = 1 + + if print_cat: + if new_page: + paginator.add_line('') + paginator.add_line(category) + print_cat = 0 + + paginator.add_line(details) + + self._pages = paginator.pages + + def embed_page(self, page_number: int = 0) -> Embed: + """Returns an Embed with the requested page formatted within.""" + embed = Embed() + + if isinstance(self.query, (commands.Command, Cog)) and page_number > 0: + title = f'Command Help | "{self.query.name}"' + else: + title = self.title + + embed.set_author(name=title, icon_url=constants.Icons.questionmark) + embed.description = self._pages[page_number] + + page_count = len(self._pages) + if page_count > 1: + embed.set_footer(text=f'Page {self._current_page+1} / {page_count}') + + return embed + + async def update_page(self, page_number: int = 0) -> None: + """Sends the intial message, or changes the existing one to the given page number.""" + self._current_page = page_number + embed_page = self.embed_page(page_number) + + if not self.message: + self.message = await self.destination.send(embed=embed_page) + else: + await self.message.edit(embed=embed_page) + + @classmethod + async def start(cls, ctx: Context, *command, **options) -> "HelpSession": + """ + Create and begin a help session based on the given command context. + + Available options kwargs: + * cleanup: Optional[bool] + Set to `True` to have the message deleted on session end. Defaults to `False`. + * only_can_run: Optional[bool] + Set to `True` to hide commands the user can't run. Defaults to `False`. + * show_hidden: Optional[bool] + Set to `True` to include hidden commands. Defaults to `False`. + * max_lines: Optional[int] + Sets the max number of lines the paginator will add to a single page. Defaults to 20. + """ + session = cls(ctx, *command, **options) + await session.prepare() + + return session + + async def stop(self) -> None: + """Stops the help session, removes event listeners and attempts to delete the help message.""" + self._bot.remove_listener(self.on_reaction_add) + self._bot.remove_listener(self.on_message_delete) + + # ignore if permission issue, or the message doesn't exist + with suppress(HTTPException, AttributeError): + if self._cleanup: + await self.message.delete() + else: + await self.message.clear_reactions() + + @property + def is_first_page(self) -> bool: + """Check if session is currently showing the first page.""" + return self._current_page == 0 + + @property + def is_last_page(self) -> bool: + """Check if the session is currently showing the last page.""" + return self._current_page == (len(self._pages)-1) + + async def do_first(self) -> None: + """Event that is called when the user requests the first page.""" + if not self.is_first_page: + await self.update_page(0) + + async def do_back(self) -> None: + """Event that is called when the user requests the previous page.""" + if not self.is_first_page: + await self.update_page(self._current_page-1) + + async def do_next(self) -> None: + """Event that is called when the user requests the next page.""" + if not self.is_last_page: + await self.update_page(self._current_page+1) + + async def do_end(self) -> None: + """Event that is called when the user requests the last page.""" + if not self.is_last_page: + await self.update_page(len(self._pages)-1) + + async def do_stop(self) -> None: + """Event that is called when the user requests to stop the help session.""" + await self.message.delete() + + +class Help(DiscordCog): + """Custom Embed Pagination Help feature.""" + + @commands.command('help') + async def new_help(self, ctx: Context, *commands) -> None: + """Shows Command Help.""" + try: + await HelpSession.start(ctx, *commands) + except HelpQueryNotFound as error: + embed = Embed() + embed.colour = Colour.red() + embed.title = str(error) + + if error.possible_matches: + matches = '\n'.join(error.possible_matches.keys()) + embed.description = f'**Did you mean:**\n`{matches}`' + + await ctx.send(embed=embed) + + +def unload(bot: SeasonalBot) -> None: + """ + Reinstates the original help command. + + This is run if the cog raises an exception on load, or if the extension is unloaded. + """ + bot.remove_command('help') + bot.add_command(bot._old_help) + + +def setup(bot: SeasonalBot) -> None: + """ + The setup for the help extension. + + This is called automatically on `bot.load_extension` being run. + Stores the original help command instance on the `bot._old_help` attribute for later + reinstatement, before removing it from the command registry so the new help command can be + loaded successfully. + If an exception is raised during the loading of the cog, `unload` will be called in order to + reinstate the original help command. + """ + bot._old_help = bot.get_command('help') + bot.remove_command('help') + + try: + bot.add_cog(Help()) + except Exception: + unload(bot) + raise + else: + log.info("Help cog loaded") + + +def teardown(bot: SeasonalBot) -> None: + """ + The teardown for the help extension. + + This is called automatically on `bot.unload_extension` being run. + Calls `unload` in order to reinstate the original help command. + """ + unload(bot) -- cgit v1.2.3 From 5feabe642ed5b685c7aa9515bc70ff4ff8b278bc Mon Sep 17 00:00:00 2001 From: kwzrd Date: Sat, 28 Mar 2020 16:33:20 +0100 Subject: Deseasonify: log in `add_cog` rather than in each `setup` The previous system required each extension's `setup` func to log that the cog was loaded. This leads to inconsistent messages all trying to convey the same thing, variable logger names in the output file are difficult to read, and several extensions were not logging at all. By logging directly in the `add_cog` method, we reduce code repetition, ensure consistent format, and remove the responsibility to remember that a log should be made. --- bot/bot.py | 9 +++++++++ bot/exts/christmas/adventofcode.py | 1 - bot/exts/christmas/hanukkah_embed.py | 1 - bot/exts/easter/april_fools_vids.py | 1 - bot/exts/easter/avatar_easterifier.py | 1 - bot/exts/easter/bunny_name_generator.py | 1 - bot/exts/easter/conversationstarters.py | 1 - bot/exts/easter/easter_riddle.py | 1 - bot/exts/easter/egg_decorating.py | 1 - bot/exts/easter/egg_facts.py | 1 - bot/exts/easter/egghead_quiz.py | 1 - bot/exts/easter/traditions.py | 1 - bot/exts/evergreen/battleship.py | 1 - bot/exts/evergreen/bookmark.py | 1 - bot/exts/evergreen/branding.py | 1 - bot/exts/evergreen/error_handler.py | 1 - bot/exts/evergreen/fun.py | 1 - bot/exts/evergreen/help.py | 2 -- bot/exts/evergreen/issues.py | 1 - bot/exts/evergreen/magic_8ball.py | 1 - bot/exts/evergreen/minesweeper.py | 1 - bot/exts/evergreen/recommend_game.py | 1 - bot/exts/evergreen/reddit.py | 1 - bot/exts/evergreen/showprojects.py | 1 - bot/exts/evergreen/snakes/__init__.py | 1 - bot/exts/evergreen/speedrun.py | 1 - bot/exts/evergreen/trivia_quiz.py | 1 - bot/exts/evergreen/uptime.py | 1 - bot/exts/halloween/8ball.py | 1 - bot/exts/halloween/candy_collection.py | 1 - bot/exts/halloween/hacktober-issue-finder.py | 1 - bot/exts/halloween/hacktoberstats.py | 1 - bot/exts/halloween/halloween_facts.py | 1 - bot/exts/halloween/halloweenify.py | 1 - bot/exts/halloween/monsterbio.py | 1 - bot/exts/halloween/monstersurvey.py | 1 - bot/exts/halloween/scarymovie.py | 1 - bot/exts/halloween/spookyavatar.py | 1 - bot/exts/halloween/spookygif.py | 1 - bot/exts/halloween/spookyrating.py | 1 - bot/exts/halloween/spookyreact.py | 1 - bot/exts/halloween/spookysound.py | 1 - bot/exts/halloween/timeleft.py | 1 - bot/exts/pride/drag_queen_name.py | 1 - bot/exts/pride/pride_anthem.py | 1 - bot/exts/pride/pride_avatar.py | 1 - bot/exts/pride/pride_facts.py | 1 - bot/exts/valentines/be_my_valentine.py | 1 - bot/exts/valentines/lovecalculator.py | 1 - bot/exts/valentines/movie_generator.py | 1 - bot/exts/valentines/myvalenstate.py | 1 - bot/exts/valentines/pickuplines.py | 1 - bot/exts/valentines/savethedate.py | 1 - bot/exts/valentines/valentine_zodiac.py | 1 - bot/exts/valentines/whoisvalentine.py | 1 - 55 files changed, 9 insertions(+), 55 deletions(-) (limited to 'bot/exts/evergreen/help.py') diff --git a/bot/bot.py b/bot/bot.py index 47d63de9..3e20e3ab 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -33,6 +33,15 @@ class SeasonalBot(commands.Bot): connector=TCPConnector(resolver=AsyncResolver(), family=socket.AF_INET) ) + def add_cog(self, cog: commands.Cog) -> None: + """ + Delegate to super to register `cog`. + + This only serves to make the info log, so that extensions don't have to. + """ + super().add_cog(cog) + log.info(f"Cog loaded: {cog.qualified_name}") + async def send_log(self, title: str, details: str = None, *, icon: str = None) -> None: """Send an embed message to the devlog channel.""" devlog = self.get_channel(Channels.devlog) diff --git a/bot/exts/christmas/adventofcode.py b/bot/exts/christmas/adventofcode.py index f7590e04..8f7aa13b 100644 --- a/bot/exts/christmas/adventofcode.py +++ b/bot/exts/christmas/adventofcode.py @@ -741,4 +741,3 @@ def _error_embed_helper(title: str, description: str) -> discord.Embed: def setup(bot: commands.Bot) -> None: """Advent of Code Cog load.""" bot.add_cog(AdventOfCode(bot)) - log.info("AdventOfCode cog loaded") diff --git a/bot/exts/christmas/hanukkah_embed.py b/bot/exts/christmas/hanukkah_embed.py index 62efd04e..718ca32a 100644 --- a/bot/exts/christmas/hanukkah_embed.py +++ b/bot/exts/christmas/hanukkah_embed.py @@ -111,4 +111,3 @@ class HanukkahEmbed(commands.Cog): def setup(bot: commands.Bot) -> None: """Cog load.""" bot.add_cog(HanukkahEmbed(bot)) - log.info("Hanukkah embed cog loaded") diff --git a/bot/exts/easter/april_fools_vids.py b/bot/exts/easter/april_fools_vids.py index 4869f510..06108f02 100644 --- a/bot/exts/easter/april_fools_vids.py +++ b/bot/exts/easter/april_fools_vids.py @@ -36,4 +36,3 @@ class AprilFoolVideos(commands.Cog): def setup(bot: commands.Bot) -> None: """April Fools' Cog load.""" bot.add_cog(AprilFoolVideos(bot)) - log.info('April Fools videos cog loaded!') diff --git a/bot/exts/easter/avatar_easterifier.py b/bot/exts/easter/avatar_easterifier.py index e21e35fc..8e8a3500 100644 --- a/bot/exts/easter/avatar_easterifier.py +++ b/bot/exts/easter/avatar_easterifier.py @@ -126,4 +126,3 @@ class AvatarEasterifier(commands.Cog): def setup(bot: commands.Bot) -> None: """Avatar Easterifier Cog load.""" bot.add_cog(AvatarEasterifier(bot)) - log.info("AvatarEasterifier cog loaded") diff --git a/bot/exts/easter/bunny_name_generator.py b/bot/exts/easter/bunny_name_generator.py index 97c467e1..3ecf9be9 100644 --- a/bot/exts/easter/bunny_name_generator.py +++ b/bot/exts/easter/bunny_name_generator.py @@ -90,4 +90,3 @@ class BunnyNameGenerator(commands.Cog): def setup(bot: commands.Bot) -> None: """Bunny Name Generator Cog load.""" bot.add_cog(BunnyNameGenerator(bot)) - log.info("BunnyNameGenerator cog loaded.") diff --git a/bot/exts/easter/conversationstarters.py b/bot/exts/easter/conversationstarters.py index 3f38ae82..a5f40445 100644 --- a/bot/exts/easter/conversationstarters.py +++ b/bot/exts/easter/conversationstarters.py @@ -26,4 +26,3 @@ class ConvoStarters(commands.Cog): def setup(bot: commands.Bot) -> None: """Conversation starters Cog load.""" bot.add_cog(ConvoStarters(bot)) - log.info("ConvoStarters cog loaded") diff --git a/bot/exts/easter/easter_riddle.py b/bot/exts/easter/easter_riddle.py index f5b1aac7..8977534f 100644 --- a/bot/exts/easter/easter_riddle.py +++ b/bot/exts/easter/easter_riddle.py @@ -98,4 +98,3 @@ class EasterRiddle(commands.Cog): def setup(bot: commands.Bot) -> None: """Easter Riddle Cog load.""" bot.add_cog(EasterRiddle(bot)) - log.info("Easter Riddle bot loaded") diff --git a/bot/exts/easter/egg_decorating.py b/bot/exts/easter/egg_decorating.py index 23df95f1..be228b2c 100644 --- a/bot/exts/easter/egg_decorating.py +++ b/bot/exts/easter/egg_decorating.py @@ -116,4 +116,3 @@ class EggDecorating(commands.Cog): def setup(bot: commands.bot) -> None: """Egg decorating Cog load.""" bot.add_cog(EggDecorating(bot)) - log.info("EggDecorating cog loaded.") diff --git a/bot/exts/easter/egg_facts.py b/bot/exts/easter/egg_facts.py index 99a80b28..bc64d26e 100644 --- a/bot/exts/easter/egg_facts.py +++ b/bot/exts/easter/egg_facts.py @@ -58,4 +58,3 @@ class EasterFacts(commands.Cog): def setup(bot: commands.Bot) -> None: """Easter Egg facts cog load.""" bot.add_cog(EasterFacts(bot)) - log.info("EasterFacts cog loaded") diff --git a/bot/exts/easter/egghead_quiz.py b/bot/exts/easter/egghead_quiz.py index bd179fe2..0498d9db 100644 --- a/bot/exts/easter/egghead_quiz.py +++ b/bot/exts/easter/egghead_quiz.py @@ -117,4 +117,3 @@ class EggheadQuiz(commands.Cog): def setup(bot: commands.Bot) -> None: """Egghead Quiz Cog load.""" bot.add_cog(EggheadQuiz(bot)) - log.info("EggheadQuiz bot loaded") diff --git a/bot/exts/easter/traditions.py b/bot/exts/easter/traditions.py index 9529823f..85b4adfb 100644 --- a/bot/exts/easter/traditions.py +++ b/bot/exts/easter/traditions.py @@ -28,4 +28,3 @@ class Traditions(commands.Cog): def setup(bot: commands.Bot) -> None: """Traditions Cog load.""" bot.add_cog(Traditions(bot)) - log.info("Traditions cog loaded") diff --git a/bot/exts/evergreen/battleship.py b/bot/exts/evergreen/battleship.py index 9b8aaa48..9bc374e6 100644 --- a/bot/exts/evergreen/battleship.py +++ b/bot/exts/evergreen/battleship.py @@ -441,4 +441,3 @@ class Battleship(commands.Cog): def setup(bot: commands.Bot) -> None: """Cog load.""" bot.add_cog(Battleship(bot)) - log.info("Battleship cog loaded") diff --git a/bot/exts/evergreen/bookmark.py b/bot/exts/evergreen/bookmark.py index e703e07b..73908702 100644 --- a/bot/exts/evergreen/bookmark.py +++ b/bot/exts/evergreen/bookmark.py @@ -62,4 +62,3 @@ class Bookmark(commands.Cog): def setup(bot: commands.Bot) -> None: """Load the Bookmark cog.""" bot.add_cog(Bookmark(bot)) - log.info("Bookmark cog loaded") diff --git a/bot/exts/evergreen/branding.py b/bot/exts/evergreen/branding.py index 2eb563ea..0a14cd84 100644 --- a/bot/exts/evergreen/branding.py +++ b/bot/exts/evergreen/branding.py @@ -501,4 +501,3 @@ class BrandingManager(commands.Cog): def setup(bot: SeasonalBot) -> None: """Load BrandingManager cog.""" bot.add_cog(BrandingManager(bot)) - log.info("BrandingManager cog loaded") diff --git a/bot/exts/evergreen/error_handler.py b/bot/exts/evergreen/error_handler.py index f756c321..33b1a3f2 100644 --- a/bot/exts/evergreen/error_handler.py +++ b/bot/exts/evergreen/error_handler.py @@ -127,4 +127,3 @@ class CommandErrorHandler(commands.Cog): def setup(bot: commands.Bot) -> None: """Error handler Cog load.""" bot.add_cog(CommandErrorHandler(bot)) - log.info("CommandErrorHandler cog loaded") diff --git a/bot/exts/evergreen/fun.py b/bot/exts/evergreen/fun.py index 889ae079..67a4bae5 100644 --- a/bot/exts/evergreen/fun.py +++ b/bot/exts/evergreen/fun.py @@ -145,4 +145,3 @@ class Fun(Cog): def setup(bot: commands.Bot) -> None: """Fun Cog load.""" bot.add_cog(Fun(bot)) - log.info("Fun cog loaded") diff --git a/bot/exts/evergreen/help.py b/bot/exts/evergreen/help.py index f4d76402..ccd76d76 100644 --- a/bot/exts/evergreen/help.py +++ b/bot/exts/evergreen/help.py @@ -540,8 +540,6 @@ def setup(bot: SeasonalBot) -> None: except Exception: unload(bot) raise - else: - log.info("Help cog loaded") def teardown(bot: SeasonalBot) -> None: diff --git a/bot/exts/evergreen/issues.py b/bot/exts/evergreen/issues.py index fb18b62a..4129156a 100644 --- a/bot/exts/evergreen/issues.py +++ b/bot/exts/evergreen/issues.py @@ -74,4 +74,3 @@ class Issues(commands.Cog): def setup(bot: commands.Bot) -> None: """Cog Retrieves Issues From Github.""" bot.add_cog(Issues(bot)) - log.info("Issues cog loaded") diff --git a/bot/exts/evergreen/magic_8ball.py b/bot/exts/evergreen/magic_8ball.py index e47ef454..c10f1f51 100644 --- a/bot/exts/evergreen/magic_8ball.py +++ b/bot/exts/evergreen/magic_8ball.py @@ -29,4 +29,3 @@ class Magic8ball(commands.Cog): def setup(bot: commands.Bot) -> None: """Magic 8ball Cog load.""" bot.add_cog(Magic8ball(bot)) - log.info("Magic8ball cog loaded") diff --git a/bot/exts/evergreen/minesweeper.py b/bot/exts/evergreen/minesweeper.py index b0ba8145..b59cdb14 100644 --- a/bot/exts/evergreen/minesweeper.py +++ b/bot/exts/evergreen/minesweeper.py @@ -282,4 +282,3 @@ class Minesweeper(commands.Cog): def setup(bot: commands.Bot) -> None: """Load the Minesweeper cog.""" bot.add_cog(Minesweeper(bot)) - log.info("Minesweeper cog loaded") diff --git a/bot/exts/evergreen/recommend_game.py b/bot/exts/evergreen/recommend_game.py index 835a4e53..7cd52c2c 100644 --- a/bot/exts/evergreen/recommend_game.py +++ b/bot/exts/evergreen/recommend_game.py @@ -48,4 +48,3 @@ class RecommendGame(commands.Cog): def setup(bot: commands.Bot) -> None: """Loads the RecommendGame cog.""" bot.add_cog(RecommendGame(bot)) - log.info("RecommendGame cog loaded") diff --git a/bot/exts/evergreen/reddit.py b/bot/exts/evergreen/reddit.py index a07e591f..fe204419 100644 --- a/bot/exts/evergreen/reddit.py +++ b/bot/exts/evergreen/reddit.py @@ -126,4 +126,3 @@ class Reddit(commands.Cog): def setup(bot: commands.Bot) -> None: """Load the Cog.""" bot.add_cog(Reddit(bot)) - log.debug('Loaded') diff --git a/bot/exts/evergreen/showprojects.py b/bot/exts/evergreen/showprojects.py index a943e548..328a7aa5 100644 --- a/bot/exts/evergreen/showprojects.py +++ b/bot/exts/evergreen/showprojects.py @@ -31,4 +31,3 @@ class ShowProjects(commands.Cog): def setup(bot: commands.Bot) -> None: """Show Projects Reaction Cog.""" bot.add_cog(ShowProjects(bot)) - log.info("ShowProjects cog loaded") diff --git a/bot/exts/evergreen/snakes/__init__.py b/bot/exts/evergreen/snakes/__init__.py index 06ebfb47..2eae2751 100644 --- a/bot/exts/evergreen/snakes/__init__.py +++ b/bot/exts/evergreen/snakes/__init__.py @@ -10,4 +10,3 @@ log = logging.getLogger(__name__) def setup(bot: commands.Bot) -> None: """Snakes Cog load.""" bot.add_cog(Snakes(bot)) - log.info("Snakes cog loaded") diff --git a/bot/exts/evergreen/speedrun.py b/bot/exts/evergreen/speedrun.py index 76c5e8d3..4e8d7aee 100644 --- a/bot/exts/evergreen/speedrun.py +++ b/bot/exts/evergreen/speedrun.py @@ -25,4 +25,3 @@ class Speedrun(commands.Cog): def setup(bot: commands.Bot) -> None: """Load the Speedrun cog.""" bot.add_cog(Speedrun(bot)) - log.info("Speedrun cog loaded") diff --git a/bot/exts/evergreen/trivia_quiz.py b/bot/exts/evergreen/trivia_quiz.py index 99b64497..c1a271e8 100644 --- a/bot/exts/evergreen/trivia_quiz.py +++ b/bot/exts/evergreen/trivia_quiz.py @@ -300,4 +300,3 @@ class TriviaQuiz(commands.Cog): def setup(bot: commands.Bot) -> None: """Load the cog.""" bot.add_cog(TriviaQuiz(bot)) - logger.debug("TriviaQuiz cog loaded") diff --git a/bot/exts/evergreen/uptime.py b/bot/exts/evergreen/uptime.py index 6f24f545..a9ad9dfb 100644 --- a/bot/exts/evergreen/uptime.py +++ b/bot/exts/evergreen/uptime.py @@ -31,4 +31,3 @@ class Uptime(commands.Cog): def setup(bot: commands.Bot) -> None: """Uptime Cog load.""" bot.add_cog(Uptime(bot)) - log.info("Uptime cog loaded") diff --git a/bot/exts/halloween/8ball.py b/bot/exts/halloween/8ball.py index 2e1c2804..1df48fbf 100644 --- a/bot/exts/halloween/8ball.py +++ b/bot/exts/halloween/8ball.py @@ -31,4 +31,3 @@ class SpookyEightBall(commands.Cog): def setup(bot: commands.Bot) -> None: """Spooky Eight Ball Cog Load.""" bot.add_cog(SpookyEightBall(bot)) - log.info("SpookyEightBall cog loaded") diff --git a/bot/exts/halloween/candy_collection.py b/bot/exts/halloween/candy_collection.py index 3f2b895e..00061fc2 100644 --- a/bot/exts/halloween/candy_collection.py +++ b/bot/exts/halloween/candy_collection.py @@ -222,4 +222,3 @@ class CandyCollection(commands.Cog): def setup(bot: commands.Bot) -> None: """Candy Collection game Cog load.""" bot.add_cog(CandyCollection(bot)) - log.info("CandyCollection cog loaded") diff --git a/bot/exts/halloween/hacktober-issue-finder.py b/bot/exts/halloween/hacktober-issue-finder.py index f15a665a..3a9d38d2 100644 --- a/bot/exts/halloween/hacktober-issue-finder.py +++ b/bot/exts/halloween/hacktober-issue-finder.py @@ -108,4 +108,3 @@ class HacktoberIssues(commands.Cog): def setup(bot: commands.Bot) -> None: """Hacktober issue finder Cog Load.""" bot.add_cog(HacktoberIssues(bot)) - log.info("hacktober-issue-finder cog loaded") diff --git a/bot/exts/halloween/hacktoberstats.py b/bot/exts/halloween/hacktoberstats.py index 5dfa2f51..0c1c837c 100644 --- a/bot/exts/halloween/hacktoberstats.py +++ b/bot/exts/halloween/hacktoberstats.py @@ -339,4 +339,3 @@ class HacktoberStats(commands.Cog): def setup(bot: commands.Bot) -> None: """Hacktoberstats Cog load.""" bot.add_cog(HacktoberStats(bot)) - log.info("HacktoberStats cog loaded") diff --git a/bot/exts/halloween/halloween_facts.py b/bot/exts/halloween/halloween_facts.py index 222768f4..44a66ab2 100644 --- a/bot/exts/halloween/halloween_facts.py +++ b/bot/exts/halloween/halloween_facts.py @@ -56,4 +56,3 @@ class HalloweenFacts(commands.Cog): def setup(bot: commands.Bot) -> None: """Halloween facts Cog load.""" bot.add_cog(HalloweenFacts(bot)) - log.info("HalloweenFacts cog loaded") diff --git a/bot/exts/halloween/halloweenify.py b/bot/exts/halloween/halloweenify.py index dfcc2b1e..5c433a81 100644 --- a/bot/exts/halloween/halloweenify.py +++ b/bot/exts/halloween/halloweenify.py @@ -49,4 +49,3 @@ class Halloweenify(commands.Cog): def setup(bot: commands.Bot) -> None: """Halloweenify Cog load.""" bot.add_cog(Halloweenify(bot)) - log.info("Halloweenify cog loaded") diff --git a/bot/exts/halloween/monsterbio.py b/bot/exts/halloween/monsterbio.py index bfa8a026..016a66d1 100644 --- a/bot/exts/halloween/monsterbio.py +++ b/bot/exts/halloween/monsterbio.py @@ -53,4 +53,3 @@ class MonsterBio(commands.Cog): def setup(bot: commands.Bot) -> None: """Monster bio Cog load.""" bot.add_cog(MonsterBio(bot)) - log.info("MonsterBio cog loaded.") diff --git a/bot/exts/halloween/monstersurvey.py b/bot/exts/halloween/monstersurvey.py index 12e1d022..27da79b6 100644 --- a/bot/exts/halloween/monstersurvey.py +++ b/bot/exts/halloween/monstersurvey.py @@ -203,4 +203,3 @@ class MonsterSurvey(Cog): def setup(bot: Bot) -> None: """Monster survey Cog load.""" bot.add_cog(MonsterSurvey(bot)) - log.info("MonsterSurvey cog loaded") diff --git a/bot/exts/halloween/scarymovie.py b/bot/exts/halloween/scarymovie.py index 3823a3e4..c80e0298 100644 --- a/bot/exts/halloween/scarymovie.py +++ b/bot/exts/halloween/scarymovie.py @@ -129,4 +129,3 @@ class ScaryMovie(commands.Cog): def setup(bot: commands.Bot) -> None: """Scary movie Cog load.""" bot.add_cog(ScaryMovie(bot)) - log.info("ScaryMovie cog loaded") diff --git a/bot/exts/halloween/spookyavatar.py b/bot/exts/halloween/spookyavatar.py index 268de3fb..2d7df678 100644 --- a/bot/exts/halloween/spookyavatar.py +++ b/bot/exts/halloween/spookyavatar.py @@ -50,4 +50,3 @@ class SpookyAvatar(commands.Cog): def setup(bot: commands.Bot) -> None: """Spooky avatar Cog load.""" bot.add_cog(SpookyAvatar(bot)) - log.info("SpookyAvatar cog loaded") diff --git a/bot/exts/halloween/spookygif.py b/bot/exts/halloween/spookygif.py index 818de8cd..f402437f 100644 --- a/bot/exts/halloween/spookygif.py +++ b/bot/exts/halloween/spookygif.py @@ -36,4 +36,3 @@ class SpookyGif(commands.Cog): def setup(bot: commands.Bot) -> None: """Spooky GIF Cog load.""" bot.add_cog(SpookyGif(bot)) - log.info("SpookyGif cog loaded") diff --git a/bot/exts/halloween/spookyrating.py b/bot/exts/halloween/spookyrating.py index 7f78f536..1a48194e 100644 --- a/bot/exts/halloween/spookyrating.py +++ b/bot/exts/halloween/spookyrating.py @@ -64,4 +64,3 @@ class SpookyRating(commands.Cog): def setup(bot: commands.Bot) -> None: """Spooky Rating Cog load.""" bot.add_cog(SpookyRating(bot)) - log.info("SpookyRating cog loaded") diff --git a/bot/exts/halloween/spookyreact.py b/bot/exts/halloween/spookyreact.py index 16f18019..a3896cfb 100644 --- a/bot/exts/halloween/spookyreact.py +++ b/bot/exts/halloween/spookyreact.py @@ -73,4 +73,3 @@ class SpookyReact(Cog): def setup(bot: Bot) -> None: """Spooky reaction Cog load.""" bot.add_cog(SpookyReact(bot)) - log.info("SpookyReact cog loaded") diff --git a/bot/exts/halloween/spookysound.py b/bot/exts/halloween/spookysound.py index e0676d0a..325447e5 100644 --- a/bot/exts/halloween/spookysound.py +++ b/bot/exts/halloween/spookysound.py @@ -45,4 +45,3 @@ class SpookySound(commands.Cog): def setup(bot: commands.Bot) -> None: """Spooky sound Cog load.""" bot.add_cog(SpookySound(bot)) - log.info("SpookySound cog loaded") diff --git a/bot/exts/halloween/timeleft.py b/bot/exts/halloween/timeleft.py index 8cb3f4f6..295acc89 100644 --- a/bot/exts/halloween/timeleft.py +++ b/bot/exts/halloween/timeleft.py @@ -57,4 +57,3 @@ class TimeLeft(commands.Cog): def setup(bot: commands.Bot) -> None: """Cog load.""" bot.add_cog(TimeLeft(bot)) - log.info("TimeLeft cog loaded") diff --git a/bot/exts/pride/drag_queen_name.py b/bot/exts/pride/drag_queen_name.py index 43813fbd..95297745 100644 --- a/bot/exts/pride/drag_queen_name.py +++ b/bot/exts/pride/drag_queen_name.py @@ -30,4 +30,3 @@ class DragNames(commands.Cog): def setup(bot: commands.Bot) -> None: """Cog loader for drag queen name generator.""" bot.add_cog(DragNames(bot)) - log.info("Drag queen name generator cog loaded!") diff --git a/bot/exts/pride/pride_anthem.py b/bot/exts/pride/pride_anthem.py index b0c6d34e..186c5fff 100644 --- a/bot/exts/pride/pride_anthem.py +++ b/bot/exts/pride/pride_anthem.py @@ -55,4 +55,3 @@ class PrideAnthem(commands.Cog): def setup(bot: commands.Bot) -> None: """Cog loader for pride anthem.""" bot.add_cog(PrideAnthem(bot)) - log.info("Pride anthems cog loaded!") diff --git a/bot/exts/pride/pride_avatar.py b/bot/exts/pride/pride_avatar.py index 85e49d5c..3f9878e3 100644 --- a/bot/exts/pride/pride_avatar.py +++ b/bot/exts/pride/pride_avatar.py @@ -142,4 +142,3 @@ class PrideAvatar(commands.Cog): def setup(bot: commands.Bot) -> None: """Cog load.""" bot.add_cog(PrideAvatar(bot)) - log.info("PrideAvatar cog loaded") diff --git a/bot/exts/pride/pride_facts.py b/bot/exts/pride/pride_facts.py index 2db8f5c2..bd9c087b 100644 --- a/bot/exts/pride/pride_facts.py +++ b/bot/exts/pride/pride_facts.py @@ -104,4 +104,3 @@ class PrideFacts(commands.Cog): def setup(bot: commands.Bot) -> None: """Cog loader for pride facts.""" bot.add_cog(PrideFacts(bot)) - log.info("Pride facts cog loaded!") diff --git a/bot/exts/valentines/be_my_valentine.py b/bot/exts/valentines/be_my_valentine.py index 1e883d21..4b0818da 100644 --- a/bot/exts/valentines/be_my_valentine.py +++ b/bot/exts/valentines/be_my_valentine.py @@ -234,4 +234,3 @@ class BeMyValentine(commands.Cog): def setup(bot: commands.Bot) -> None: """Be my Valentine Cog load.""" bot.add_cog(BeMyValentine(bot)) - log.info("BeMyValentine cog loaded") diff --git a/bot/exts/valentines/lovecalculator.py b/bot/exts/valentines/lovecalculator.py index 03d3d7d5..e11e062b 100644 --- a/bot/exts/valentines/lovecalculator.py +++ b/bot/exts/valentines/lovecalculator.py @@ -101,4 +101,3 @@ class LoveCalculator(Cog): def setup(bot: commands.Bot) -> None: """Love calculator Cog load.""" bot.add_cog(LoveCalculator(bot)) - log.info("LoveCalculator cog loaded") diff --git a/bot/exts/valentines/movie_generator.py b/bot/exts/valentines/movie_generator.py index ce1d7d5b..0843175a 100644 --- a/bot/exts/valentines/movie_generator.py +++ b/bot/exts/valentines/movie_generator.py @@ -60,4 +60,3 @@ class RomanceMovieFinder(commands.Cog): def setup(bot: commands.Bot) -> None: """Romance movie Cog load.""" bot.add_cog(RomanceMovieFinder(bot)) - log.info("RomanceMovieFinder cog loaded") diff --git a/bot/exts/valentines/myvalenstate.py b/bot/exts/valentines/myvalenstate.py index 0256c39a..7d8737c4 100644 --- a/bot/exts/valentines/myvalenstate.py +++ b/bot/exts/valentines/myvalenstate.py @@ -84,4 +84,3 @@ class MyValenstate(commands.Cog): def setup(bot: commands.Bot) -> None: """Valenstate Cog load.""" bot.add_cog(MyValenstate(bot)) - log.info("MyValenstate cog loaded") diff --git a/bot/exts/valentines/pickuplines.py b/bot/exts/valentines/pickuplines.py index 8b2c9822..74c7e68b 100644 --- a/bot/exts/valentines/pickuplines.py +++ b/bot/exts/valentines/pickuplines.py @@ -42,4 +42,3 @@ class PickupLine(commands.Cog): def setup(bot: commands.Bot) -> None: """Pickup lines Cog load.""" bot.add_cog(PickupLine(bot)) - log.info('PickupLine cog loaded') diff --git a/bot/exts/valentines/savethedate.py b/bot/exts/valentines/savethedate.py index e0bc3904..ac38d279 100644 --- a/bot/exts/valentines/savethedate.py +++ b/bot/exts/valentines/savethedate.py @@ -39,4 +39,3 @@ class SaveTheDate(commands.Cog): def setup(bot: commands.Bot) -> None: """Save the date Cog Load.""" bot.add_cog(SaveTheDate(bot)) - log.info("SaveTheDate cog loaded") diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index c8d77e75..1a1273aa 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -55,4 +55,3 @@ class ValentineZodiac(commands.Cog): def setup(bot: commands.Bot) -> None: """Valentine zodiac Cog load.""" bot.add_cog(ValentineZodiac(bot)) - log.info("ValentineZodiac cog loaded") diff --git a/bot/exts/valentines/whoisvalentine.py b/bot/exts/valentines/whoisvalentine.py index b8586dca..4ca0289c 100644 --- a/bot/exts/valentines/whoisvalentine.py +++ b/bot/exts/valentines/whoisvalentine.py @@ -50,4 +50,3 @@ class ValentineFacts(commands.Cog): def setup(bot: commands.Bot) -> None: """Who is Valentine Cog load.""" bot.add_cog(ValentineFacts(bot)) - log.info("ValentineFacts cog loaded") -- cgit v1.2.3