Skip to main content

twilight_model/application/interaction/modal/
select_menu.rs

1use crate::id::Id;
2use crate::id::marker::{ChannelMarker, GenericMarker, RoleMarker, UserMarker};
3
4/// User filled in Channel Select.
5///
6/// See [Discord Docs/Channel Select Interaction Response Structure].
7///
8/// [Discord Docs/Channel Select Interaction Response Structure]: https://discord.com/developers/docs/components/reference#channel-select-channel-select-interaction-response-structure
9pub type ModalInteractionChannelSelect = ModalInteractionSelectMenu<Id<ChannelMarker>>;
10
11/// User filled in Mentionable Select.
12///
13/// See [Discord Docs/Mentionable Select Interaction Response Structure].
14///
15/// [Discord Docs/Mentionable Select Interaction Response Structure]: https://discord.com/developers/docs/components/reference#mentionable-select-mentionable-select-interaction-response-structure
16pub type ModalInteractionMentionableSelect = ModalInteractionSelectMenu<Id<GenericMarker>>;
17
18/// User filled in Role Select.
19///
20/// See [Discord Docs/Role Select Interaction Response Structure].
21///
22/// [Discord Docs/Role Select Interaction Response Structure]: https://discord.com/developers/docs/components/reference#role-select-role-select-interaction-response-structure
23pub type ModalInteractionRoleSelect = ModalInteractionSelectMenu<Id<RoleMarker>>;
24
25/// User filled in String Select.
26///
27/// See [Discord Docs/String Select Interaction Response Structure].
28///
29/// [Discord Docs/String Select Interaction Response Structure]: https://discord.com/developers/docs/components/reference#string-select-string-select-interaction-response-structure
30pub type ModalInteractionStringSelect = ModalInteractionSelectMenu<String>;
31
32/// User filled in User Select.
33///
34/// See [Discord Docs/User Select Interaction Response Structure].
35///
36/// [Discord Docs/User Select Interaction Response Structure]: https://discord.com/developers/docs/components/reference#user-select-user-select-interaction-response-structure
37pub type ModalInteractionUserSelect = ModalInteractionSelectMenu<Id<UserMarker>>;
38
39/// User filled in [`SelectMenu`].
40///
41/// The `ValueType` generic parameter defines the type of the selected value
42/// (e.g. text, user id, etc.).
43/// See also [`ModalInteractionStringSelect`], [`ModalInteractionUserSelect`],
44/// [`ModalInteractionRoleSelect`], [`ModalInteractionMentionableSelect`],
45/// and [`ModalInteractionChannelSelect`].
46///
47/// [`SelectMenu`]: crate::channel::message::component::SelectMenu
48#[derive(Clone, Debug, Eq, PartialEq)]
49pub struct ModalInteractionSelectMenu<ValueType> {
50    /// Unique identifier for the component.
51    pub id: i32,
52    /// User defined identifier for the component.
53    ///
54    /// See [Discord Docs/Custom ID].
55    ///
56    /// [Discord Docs/Custom ID]: https://discord.com/developers/docs/components/reference#anatomy-of-a-component-custom-id
57    pub custom_id: String,
58    /// The selected values.
59    pub values: Vec<ValueType>,
60}