grafitely / DiscordBot-Scaffold

Simple boilerplate to make a discord bot with
0 stars 1 forks source link

Command Handler #4

Open 0x796935 opened 1 year ago

0x796935 commented 1 year ago

Hello,

I have a suggestion for improving the code you have uploaded.

Instead of using multiple if-else statements to handle commands, when adding more later. I recommend using command handlers. Command handlers allow you to more easily manage and organize your code, and they can make it easier for other contributors to understand how the commands are being handled.

To use command handlers, you can create a separate function for each command, and then use a dictionary to map the command names to the corresponding functions. This way, you can simply call the function associated with the command, rather than having to use a large if-else block to determine how to handle the command.

I hope this suggestion is helpful. Let me know if you have any questions or need further assistance.

Best regards, yi5

0x796935 commented 1 year ago

bump

grafitely commented 1 year ago

That seems really useful thank you! I'll do some research into it and look into adding them :)

0x796935 commented 6 months ago

Another bump