Villager-Bot icon indicating copy to clipboard operation
Villager-Bot copied to clipboard

Separate commands into their own cogs

Open Iapetus-11 opened this issue 1 year ago • 9 comments

  • Each command should get their own cog, but the file structure should stay relatively the same:
bot/cogs/commands/
    config/
        config.py
        prefix.py
        ...
    econ/
        profile.py
        balance.py
        mine.py
        ...
    fun/
    ...
  • This should also be accompanied by command cogs being automatically detected and loaded

Iapetus-11 avatar Feb 24 '23 18:02 Iapetus-11

idk chief

maxheyn avatar Feb 25 '23 04:02 maxheyn

idk chief

wat

Iapetus-11 avatar Feb 25 '23 22:02 Iapetus-11

you mean to tell me i don't have to go searching far and wide in a single file anymore? 👀

jkriste avatar Feb 26 '23 00:02 jkriste

unsubscribe

maxheyn avatar Feb 26 '23 00:02 maxheyn

doesn't seem like a great idea to me

Infernum1 avatar Feb 26 '23 02:02 Infernum1

doesn't seem like a great idea to me

With the introduction of slash commands, there will be "view" classes and extra boilerplate littered everywhere. When commands are not self-contained within one method, I think they should get their own files.

Iapetus-11 avatar Feb 26 '23 14:02 Iapetus-11

I feel the fact that each command having its own file will

  1. Unnecessarily increase the codebase of the bot
  2. Make it harder for some people to contribute and maintain as it can get harder to read
  3. Will worsen if you ever plan on adding more commands. 40 files for 40 commands seems extremely prolix to me

So perhaps all of these (and maybe even other things) outweigh the pros

Infernum1 avatar Feb 26 '23 15:02 Infernum1

I feel the fact that each command having its own file will

  1. Unnecessarily increase the codebase of the bot

  2. Make it harder for some people to contribute and maintain as it can get harder to read

  3. Will worsen if you ever plan on adding more commands. 40 files for 40 commands seems extremely prolix to me

So perhaps all of these (and maybe even other things) outweigh the pros

Disagreed. Point 1 says increasing the code base but the only difference will be less lines per file. There may potentially be very little of an increase in lines, but this heavily depends on what the cog is importing and from where.

Point 2 and 3 are self-contradictory, since if each cog has its own file and code in that file, it'd make it much easier to find rather than having to scroll through hundreds (if not thousands) of lines in a single file. More files does not mean more clutter.

jkriste avatar Feb 26 '23 17:02 jkriste

You might have misunderstood my points. Firstly there will for sure be an increase in the number of lines because each command will require it's own setup function and a subclass of commands.Cog, but anyways I was pointing towards the increase in the number of FILES not LINES, files too are included in the codebase of a program.

Again, was referring to the number of FILES, forty different files spread across 5 folders with a single command in each is extremely verbose. I'm not talking about the number of lines. And yeah sure I won't disagree that more files is not equal to more clutter, that was purely my opinion as switching between files and looking for a specific file might get annoying/difficult with so many files

Also you can just use the search option to not have to scroll through anything

Infernum1 avatar Feb 27 '23 09:02 Infernum1