-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor interactions #47
base: main
Are you sure you want to change the base?
Conversation
2a59f72
to
f4f46e6
Compare
Adds a new interface InteractionMessager, and sets it as the first parameter in the helper methods for responding to interactions. This change is backwards compatible with the previous struct that was required, and is as such not a breaking change to those functions.
if err != nil { | ||
return discord.NewMessageCreateBuilder(). | ||
SetEphemeral(true). | ||
SetContent("Failed to retrieve infractions."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use MessageEphWithContent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is in a function that returns the MessageCreate
struct. It may contain embeds, in which returning a string with which to call MessageEphWithContent
is not sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're just creating an ephemeral message and tacking on embeds, for consistency's sake you should either:
- Refactor MessageEphWithContent to send the builder.
- Create MessageBuilderEphWithContent and have MessageEphWithContent call it with .Build().
No preference as to which one.
Major refactoring regarding interactions / application commands
This PR puts previous commands and components in their own packages, under the infractions package. This results in interactions being more organised by their commands and related features, as well as moving registering to the interaction router within the package of each interaction package.
There has also been some light refactoring for code reuse, but also splitting up into multiple files, so that large commands such as the admin one has separate files for each sub-command, as it relates to configuration for various features.