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

Make values of MentionableSelect distinguishable #2938

Open
NVedsted opened this issue Aug 12, 2024 · 0 comments
Open

Make values of MentionableSelect distinguishable #2938

NVedsted opened this issue Aug 12, 2024 · 0 comments

Comments

@NVedsted
Copy link

NVedsted commented Aug 12, 2024

I am using mentionable select menus in a project where I ran into GenericIds being returned when receiving data. It would be nice to receive a union type of roles and users such that they can be distinguished. My current solution to distinguishing is simply to first see if the ID is cached as a user then as a role on the guild if it occurred in a guild.

Discord already sends resolved values during this interaction so there is a better approach than looking into the caches. By simply adding something like this, it becomes much easier to work with:

pub struct ComponentInteractionData {
    // ...
    pub resolved: Option<CommandDataResolved>,
}

Ideally, having the values of the kind contain some union type that can be distinguished would be nice. I.e., the variant was something like this:

pub enum ComponentInteractionDataKind {
  // ...
  MentionableSelect { values: Vec<UserOrRoleId> },
  // ...
}

Or at the very least have a method that can spit something like that out.

I am willing to help with implementing this as well, but I will certainly need input on how you want it to be approached. :)

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

1 participant