Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate commands into their own cogs #253

Open
Iapetus-11 opened this issue Feb 24, 2023 · 9 comments
Open

Separate commands into their own cogs #253

Iapetus-11 opened this issue Feb 24, 2023 · 9 comments
Assignees
Labels
enhancement New feature or request

Comments

@Iapetus-11
Copy link
Owner

  • 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 Iapetus-11 added the enhancement New feature or request label Feb 24, 2023
@Iapetus-11 Iapetus-11 self-assigned this Feb 24, 2023
@maxheyn
Copy link

maxheyn commented Feb 25, 2023

idk chief

@Iapetus-11
Copy link
Owner Author

idk chief

wat

@jkriste
Copy link
Contributor

jkriste commented Feb 26, 2023

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

@maxheyn
Copy link

maxheyn commented Feb 26, 2023

unsubscribe

@Infernum1
Copy link
Contributor

doesn't seem like a great idea to me

@Iapetus-11
Copy link
Owner Author

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.

@Infernum1
Copy link
Contributor

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

@jkriste
Copy link
Contributor

jkriste commented Feb 26, 2023

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.

@Infernum1
Copy link
Contributor

Infernum1 commented Feb 27, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants