2
Aldar
7y

I'm currently writing a discord bot using the discord.py library and I cannot decide how to structure my code.
I was thinking of writing it in modules, with a core script that would load any valid module class that would include an array of all the event hooks it wanted, whether it wanted to send messages and so on.

It's a nice way to practice python after my last working bot that I wrote in (Sit down for this) PHP using an outdated and abandoned wrapper (Yeah, event-based programming in PHP, I know)

Are there any better ways to do this? I really don't want to hardcode all the functions in, only to have it fall apart later after adding another feature...

Comments
  • 0
    have a look at the discord.ext.commands module. comes with module support and commanfs. also please use the rewrite branch as it has a lot more features for example in regards to reactions.
Add Comment