R
R
Raidene2021-12-02 18:25:59
Python
Raidene, 2021-12-02 18:25:59

Splitting into discord.py files how to do?

I don't know how to split the bot into files, i.e. for example there are functions in the main file
And I want to split them for example mute.py etc.
Please help! (do not throw links to import, etc. I tried everything but it gives an error, just explain)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LXSTVAYNE, 2021-12-02
@lxstvayne

Discord cogs help to break down the logic into classes, which in turn can be divided into files.
https://discordpy.readthedocs.io/en/stable/ext/com... Write
yourself a loader function that will load cogs from your files.
A simple example of such a function:

def setup(bot):
    bot.add_cog(Cog(bot))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question