I wanted to build my first discord bot yesterday and came across this library.
My first steps went pretty well, when I had all the code in one file.
But then I decided to structure it better and use classes for abstraction and organizing my code.
When using a class the library doesn't feel as easy to use anymore and one can't use those very useful decorators anymore.
I also struggled to find any information about using the lib with a class.
Just to put a short example here:
class Bot:
def __init__(self, token: str):
self.client = Client(token=token, intents=Intents.GUILDS)
self.servers = ServerConfigs()
self._setup_listeners()
self._setup_commands()
def _setup_listeners(self):
self.client.add_listener(Listener(self._on_startup, "startup"))
self.client.add_listener(Listener(self._on_ready, "ready"))
self.client.add_listener(Listener(self._on_shutdown, "shutdown"))
For listeners it is not that bad, it gets worse for adding slash commands. Well not "worse", just more boilerplate-ish.
Is my issue understandable?