-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcog.py
31 lines (23 loc) · 976 Bytes
/
cog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from nextcord.ext import commands
from modules.help import help_command
"""
Help module.
Manages a `~help` command which auto-populates a list of all commands from the codebase in other cogs.
Also manages a customised `~help commandname` command which gets autopopulated from individual function comments.
(This is why you write good documentation yall!)
Code copied/adapted from DenverCoder1's Weasley-Chess-Bot repo - https://github.com/DenverCoder1/weasley-chess-bot
"""
class HelpCog(commands.Cog, name="Help"):
"""
Personalised and overall help commands
"""
def __init__(self, bot: commands.Bot):
self._original_help_command = bot.help_command
self.bot = bot
self.bot.help_command = help_command.HelpCommand()
self.bot.help_command.cog = self
def cog_unload(self):
self.bot.help_command = self._original_help_command
# setup functions for bot
def setup(bot: commands.Bot):
bot.add_cog(HelpCog(bot))