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

Suggestion: Add other interaction types as seperate folders #47

Open
cesarheuvelmans opened this issue Dec 20, 2023 · 4 comments
Open

Comments

@cesarheuvelmans
Copy link

Would love to see seperate handler paths for buttons, selectmenus, modalsubmits, contextmenus and autocompletes. With the filenames corresponding to the custom ids off those components. e.g.

@NotM1Dev
Copy link
Contributor

Could you clarify more? Do you mean something like this?:

src/
    buttons/
    autocomplete/
    modals/
    menus/
        select/
        context/

@cesarheuvelmans
Copy link
Author

cesarheuvelmans commented Dec 26, 2023

Yes, exactly. And then in those folders you would be able to place the handlers for those types of interactions. Basically the exact same way the commands and events folders work in commandKit now. Maybe autocomplete doesn't need a seperate folder since it's already handled within command files themselves. But being able to split up buttons, menus and modals into seperate folders would be a game changer. Otherwise they would all fall under events/interactionCreate/.
So preferably you would be able to do something like this:

src/
    buttons/
        customIdExample1.js
        customIdExample2.js
    autocomplete/
    modals/
    menus/
        select/
            customIdExample1.js
        context/

Where src/buttons/customIdExample1.js would only execute when an interactionCreate event is received with type = 3(message component) & component_type = 2(button) & custom_id = 'customIdExample1'

@NotM1Dev
Copy link
Contributor

Personally I think this would turn CommandKit into some Next.js framework for discord.js, which doesn't make it beginner-friendly as it's currently advertised.

@twlite
Copy link
Collaborator

twlite commented Jan 22, 2024

On Project Structure

We plan to introduce a well-organized project setup that is easy to use over a long period. This is currently under internal discussion to find the best solution.

I feel this might make CommandKit similar to the Next.js framework for discord.js, which may not be as beginner-friendly as it is now.

This idea isn't complex, considering CommandKit's design to automatically handle commands. However, having many customIdExampleX.js files can be confusing. We won't enforce this method, but we'll definitely provide an alternative.

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

No branches or pull requests

3 participants