From 5d32e5f0b95d56a41c72b93943255c2d1e558d45 Mon Sep 17 00:00:00 2001 From: ddorn Date: Wed, 29 Apr 2020 16:55:12 +0200 Subject: [PATCH] :fire: cleanup --- src/cogs/help.py | 86 ----------------------------------------- src/tfjm_discord_bot.py | 13 +------ 2 files changed, 2 insertions(+), 97 deletions(-) delete mode 100644 src/cogs/help.py diff --git a/src/cogs/help.py b/src/cogs/help.py deleted file mode 100644 index 27b1bd5..0000000 --- a/src/cogs/help.py +++ /dev/null @@ -1,86 +0,0 @@ -from discord.ext.commands import MinimalHelpCommand - - -# This is mostly a copy paste of MinimalHelpCommand -# With updated defaults and styles to match what I like -class TfjmHelpCommand(MinimalHelpCommand): - def __init__(self, **options): - options.setdefault("no_category", "Autres") - super().__init__(**options) - - def get_opening_note(self): - """Text at the beginning of the help command.""" - - command_name = self.invoked_with - return ( - "`{0}{1} [commande]` permet d'avoir plus d'info sur une commande.\n" - "Vous pouvez aussi utiliser `{0}{1} [catégorie]` " - "pour plus d'infos sur une catégorie.".format( - self.clean_prefix, command_name - ) - ) - - def get_command_signature(self, command): - return "`%s`" % super().get_command_signature(command) - - def add_bot_commands_formatting(self, commands, heading): - """Adds the minified bot heading with commands to the output. - - The formatting should be added to the :attr:`paginator`. - - The default implementation is a bold underline heading followed - by commands separated by an EN SPACE (U+2002) in the next line. - - Parameters - ----------- - commands: Sequence[:class:`Command`] - A list of commands that belong to the heading. - heading: :class:`str` - The heading to add to the line. - """ - - if commands: - # U+2002 Middle Dot - self.paginator.add_line("__**%s**__" % heading) - for c in commands: - self.add_subcommand_formatting(c) - self.paginator.add_line() - - def add_subcommand_formatting(self, command): - """Adds formatting information on a subcommand. - - The formatting should be added to the :attr:`paginator`. - - The default implementation is the prefix and the :attr:`Command.qualified_name` - optionally followed by an En dash and the command's :attr:`Command.short_doc`. - - Parameters - ----------- - command: :class:`Command` - The command to show information of. - """ - fmt = "`{0}{1}` \N{EN DASH} {2}" if command.short_doc else "`{0}{1}`" - self.paginator.add_line( - fmt.format(self.clean_prefix, command.qualified_name, command.short_doc) - ) - - def add_aliases_formatting(self, aliases): - """Adds the formatting information on a command's aliases. - - The formatting should be added to the :attr:`paginator`. - - The default implementation is the :attr:`aliases_heading` bolded - followed by a comma separated list of aliases. - - This is not called if there are no aliases to format. - - Parameters - ----------- - aliases: Sequence[:class:`str`] - A list of aliases to format. - """ - - aliases_str = ", ".join("`%s`" % a for a in aliases) - self.paginator.add_line( - "**%s** %s" % (self.aliases_heading, aliases_str), empty=True - ) diff --git a/src/tfjm_discord_bot.py b/src/tfjm_discord_bot.py index ba4cdc3..85a79a5 100644 --- a/src/tfjm_discord_bot.py +++ b/src/tfjm_discord_bot.py @@ -1,23 +1,14 @@ #!/bin/python -import code -import random -import sys -import traceback -from pprint import pprint -import discord from discord.ext import commands -from discord.ext.commands import Context -from src.cogs import TfjmHelpCommand from src.constants import * -from src.errors import TfjmError, UnwantedCommand # We allow "! " to catch people that put a space in their commands. # It must be in first otherwise "!" always match first and the space is not recognised -bot = commands.Bot(("! ", "!"), help_command=TfjmHelpCommand()) +bot = commands.Bot(("! ", "!")) -# Variable globale qui contient les tirages. +# Global variable to hold the tirages. # We *want* it to be global so we can reload the tirages cog without # removing all the running tirages tirages = {}