Discord Command Category
A project that includes modular categories for Discord commands and a simple Command class
What does this do?
When creating a Discord bot, there are multiple ways to go about adding commands to it:
- Create a method with decorators.
@bot.command
async def helloWorld(ctx, text):
await ctx.send("Hello World! I am alive {}".format(
text
))
- Load extensions into the bot using
add_cog
Incog.cog
class Cog:
def __init__(self, bot):
self.bot = bot
...
# Other command stuff
async def on_message(self, message):
# Do stuff
In main.py
bot.load_extension("cog.cog")
# Do stuff
With this project, there is a simple way to control multiple aspects of commands.
- Command parameters
- Accepted parameters
- Error messages
- Restrictions
- Can it be run in a private message?
While, yes, there is a way to include all that using other decorators, this project is highly modular and allows for changing very few things when adding or changing a command. This also supports automatic HTML rendering and creating a Markdown of the commands.