-
-
Notifications
You must be signed in to change notification settings - Fork 99
/
discordeno.ts
108 lines (99 loc) · 4.1 KB
/
discordeno.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import { SelectOption } from "../transformers/component.ts";
import { AllowedMentionsTypes, ButtonStyles, MessageComponentTypes, TextStyles } from "./shared.ts";
export type MessageComponents = ActionRow[];
/** https://discord.com/developers/docs/interactions/message-components#actionrow */
export interface ActionRow {
/** Action rows are a group of buttons. */
type: MessageComponentTypes.ActionRow;
/** The components in this row */
components:
| [SelectMenuComponent | ButtonComponent | InputTextComponent]
| [ButtonComponent, ButtonComponent]
| [ButtonComponent, ButtonComponent, ButtonComponent]
| [ButtonComponent, ButtonComponent, ButtonComponent, ButtonComponent]
| [ButtonComponent, ButtonComponent, ButtonComponent, ButtonComponent, ButtonComponent];
}
/** https://discord.com/developers/docs/interactions/message-components#button-object-button-structure */
export interface ButtonComponent {
/** All button components have type 2 */
type: MessageComponentTypes.Button;
/** for what the button says (max 80 characters) */
label: string;
/** a dev-defined unique string sent on click (max 100 characters). type 5 Link buttons can not have a custom_id */
customId?: string;
/** For different styles/colors of the buttons */
style: ButtonStyles;
/** Emoji object that includes fields of name, id, and animated supporting unicode and custom emojis. */
emoji?: {
/** Emoji id */
id?: bigint;
/** Emoji name */
name?: string;
/** Whether this emoji is animated */
animated?: boolean;
};
/** optional url for link-style buttons that can navigate a user to the web. Only type 5 Link buttons can have a url */
url?: string;
/** Whether or not this button is disabled */
disabled?: boolean;
}
/** https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-menu-structure */
export interface SelectMenuComponent {
/** SelectMenu Component is of type 3 */
type: MessageComponentTypes.SelectMenu;
/** A custom identifier for this component. Maximum 100 characters. */
customId: string;
/** A custom placeholder text if nothing is selected. Maximum 150 characters. */
placeholder?: string;
/** The minimum number of items that must be selected. Default 1. Between 1-25. */
minValues?: number;
/** The maximum number of items that can be selected. Default 1. Between 1-25. */
maxValues?: number;
/** The choices! Maximum of 25 items. */
options: SelectOption[];
}
/** https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-structure */
export interface InputTextComponent {
/** InputText Component is of type 4 */
type: MessageComponentTypes.InputText;
/** The style of the InputText */
style: TextStyles;
/** The customId of the InputText */
customId: string;
/** The label of the InputText */
label: string;
/** The placeholder of the InputText */
placeholder?: string;
/** The minimum length of the text the user has to provide */
minLength?: number;
/** The maximum length of the text the user has to provide */
maxLength?: number;
/** Whether or not this input is required. */
required?: boolean;
/** Pre-filled value for input text. */
value?: string;
}
/** https://discord.com/developers/docs/resources/channel#allowed-mentions-object */
export interface AllowedMentions {
/** An array of allowed mention types to parse from the content. */
parse?: AllowedMentionsTypes[];
/** For replies, whether to mention the author of the message being replied to (default false) */
repliedUser?: boolean;
/** Array of role_ids to mention (Max size of 100) */
roles?: bigint[];
/** Array of user_ids to mention (Max size of 100) */
users?: bigint[];
}
export interface FileContent {
/** The file blob */
blob: Blob;
/** The name of the file */
name: string;
}
/** https://discord.com/developers/docs/resources/guild#search-guild-members-query-string-params */
export interface SearchMembers {
/** Query string to match username(s) and nickname(s) against */
query: string;
/** Max number of members to return (1-1000). Default: 1 */
limit?: number;
}