Recently I’ve known that developers are able to code Discord.py bot in 2 ways (or even more):
- To code every command as
if message.content.startswith("hello"):
- Or to code every command as
async def hello(ctx):
So, which type is more productive and better? Thank you
Advertisement
Answer
If you need commands, use the commands extension. Docs: https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html
Why should I use the commands extension?
- Prevents spaghetti code
- Better performance
- Easy handling and processing of command arguments
- Argument type converters
- Easy subcommands
- Command cooldowns
- Built-in help function
- Easy prefix management
- Command checks, for controlling when they’re to be invoked
- Ability to add command modules via extensions/cogs
- Still able to do everything you can do with the first way