-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
feat(mention): add mention for commands #2290
feat(mention): add mention for commands #2290
Conversation
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.
thank you for this catch
I'm personally not quite sure whether to go with three structs and put them into the enum or just remove the implementations on the tuples. I think three more structs would be a too much bloat, so I'm considering simply removing the tuple impls. What do you think @laralove143? |
i agree, the enum and the impl on command are probably enough |
Ok, I removed the tuple implementations and ordered the fields of the enum variants. |
While fixing the tests I realized that you have to wrap |
yes please, since thats how it works for other types also we should have |
I guess you mean we should have a implementation for |
@laralove143 The impl for impl Mention<CommandMention> for CommandMention {
fn mention(&self) -> MentionFormat<CommandMention> {
MentionFormat(self.clone())
}
} Should we keep that? |
yes, as the alternative is to add a method to |
I ended up doing a bit of both. This way, users can avoid the cloning if they prefer. The inner field of
I took care of this in commit 808b1c0. I also added a new variant to By the way, I saw that we have a |
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.
thank you for the changes, theres only a few nits remaining
about |
You cannot derive |
i think marking it |
That sounds like the best approach to me. So is this done? |
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.
thank you for the addition!
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.
looks good, just a small issue left in the docs build with a redundant import
@AEnterprise I checked the logs of that failing build, it fails on:
I never touched that file in my PR. |
So what do we do now? |
im sure |
I realized that the
mention
crate is missingDisplay
implementations for commands. Commands are formatted like this:</NAME:COMMAND_ID>
for commands</NAME SUBCOMMAND:ID>
for subcommands</NAME SUBCOMMAND_GROUP SUBCOMMAND:ID>
for subcommand groupsThis is documented here and in the changelog.
For the
Mention
implementation I checked what could be useful implementations. The tuples here are for convenience but maybe obsolete.I considered implementing
Mention
formodel::application::command::Command
andmodel::application::application_command::CommandData
but both them may contain mutiple subcommands or subcommand groups, therefore they are not feasible to implement.Also the implementation needs not only the command id but also name (and maybe also subcommand and subcommand group). That's why I added the new enum. Three structs could also solve this but this was my personal preference.