-
-
Notifications
You must be signed in to change notification settings - Fork 114
/
messageComponents.ts
60 lines (51 loc) · 1.9 KB
/
messageComponents.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
import type { ComponentType } from '../channel.ts';
import type { APIBaseInteraction, InteractionType } from '../interactions.ts';
export type APIMessageComponentInteraction = APIBaseInteraction<
InteractionType.MessageComponent,
APIMessageComponentInteractionData
> &
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageComponentInteractionData>,
'channel_id' | 'data' | 'message'
>
>;
export type APIMessageComponentButtonInteraction = APIBaseInteraction<
InteractionType.MessageComponent,
APIMessageButtonInteractionData
> &
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageButtonInteractionData>,
'channel_id' | 'data' | 'message'
>
>;
export type APIMessageComponentSelectMenuInteraction = APIBaseInteraction<
InteractionType.MessageComponent,
APIMessageSelectMenuInteractionData
> &
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageSelectMenuInteractionData>,
'channel_id' | 'data' | 'message'
>
>;
export type APIMessageComponentInteractionData = APIMessageButtonInteractionData | APIMessageSelectMenuInteractionData;
export interface APIMessageComponentBaseInteractionData<CType extends ComponentType> {
/**
* The `custom_id` of the component
*/
custom_id: string;
/**
* The type of the component
*/
component_type: CType;
}
export type APIMessageButtonInteractionData = APIMessageComponentBaseInteractionData<ComponentType.Button>;
export interface APIMessageSelectMenuInteractionData
extends APIMessageComponentBaseInteractionData<ComponentType.SelectMenu> {
values: string[];
}
export type APIMessageComponentDMInteraction = APIDMInteractionWrapper<APIMessageComponentInteraction>;
export type APIMessageComponentGuildInteraction = APIGuildInteractionWrapper<APIMessageComponentInteraction>;