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

Refactor interactions #47

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Refactor interactions #47

wants to merge 13 commits into from

Conversation

myrkvi
Copy link
Member

@myrkvi myrkvi commented Feb 19, 2025

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.

@myrkvi myrkvi force-pushed the chore/refactor-interactions branch from 2a59f72 to f4f46e6 Compare February 19, 2025 21:17
@myrkvi myrkvi marked this pull request as ready for review February 21, 2025 21:41
if err != nil {
return discord.NewMessageCreateBuilder().
SetEphemeral(true).
SetContent("Failed to retrieve infractions."),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use MessageEphWithContent

Copy link
Member Author

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.

Copy link
Member

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:

  1. Refactor MessageEphWithContent to send the builder.
  2. Create MessageBuilderEphWithContent and have MessageEphWithContent call it with .Build().

No preference as to which one.

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

Successfully merging this pull request may close these issues.

2 participants