@satorijs/adapter-discord 4.1.3 → 4.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/lib/index.js +15 -21
  2. package/lib/index.js.map +2 -3
  3. package/lib/types/internal.d.ts +3 -2
  4. package/lib/utils.d.ts +1 -1
  5. package/package.json +5 -4
  6. package/src/bot.ts +218 -0
  7. package/src/index.ts +27 -0
  8. package/src/message.ts +444 -0
  9. package/src/types/.eslintrc.yml +2 -0
  10. package/src/types/application-role-connection.ts +61 -0
  11. package/src/types/application.ts +120 -0
  12. package/src/types/audit-log.ts +219 -0
  13. package/src/types/auto-moderation.ts +189 -0
  14. package/src/types/ban.ts +92 -0
  15. package/src/types/channel.ts +501 -0
  16. package/src/types/command.ts +320 -0
  17. package/src/types/component.ts +125 -0
  18. package/src/types/device.ts +44 -0
  19. package/src/types/emoji.ts +96 -0
  20. package/src/types/gateway.ts +334 -0
  21. package/src/types/guild-member.ts +260 -0
  22. package/src/types/guild-template.ts +109 -0
  23. package/src/types/guild.ts +476 -0
  24. package/src/types/index.ts +49 -0
  25. package/src/types/integration.ts +130 -0
  26. package/src/types/interaction.ts +283 -0
  27. package/src/types/internal.ts +43 -0
  28. package/src/types/invite.ts +192 -0
  29. package/src/types/message.ts +470 -0
  30. package/src/types/presence.ts +163 -0
  31. package/src/types/reaction.ts +139 -0
  32. package/src/types/role.ts +252 -0
  33. package/src/types/scheduled-event.ts +200 -0
  34. package/src/types/stage-instance.ts +98 -0
  35. package/src/types/sticker.ts +179 -0
  36. package/src/types/team.ts +33 -0
  37. package/src/types/thread.ts +298 -0
  38. package/src/types/user.ts +154 -0
  39. package/src/types/voice.ts +124 -0
  40. package/src/types/webhook.ts +246 -0
  41. package/src/utils.ts +391 -0
  42. package/src/ws.ts +122 -0
@@ -0,0 +1,320 @@
1
+ import { Channel, integer, Internal, Locale, snowflake } from '.'
2
+
3
+ /** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-structure */
4
+ export interface ApplicationCommand {
5
+ /** unique id of the command */
6
+ id: snowflake
7
+ /** the type of command, defaults 1 if not set */
8
+ type?: ApplicationCommand.Type
9
+ /** unique id of the parent application */
10
+ application_id: snowflake
11
+ /** guild id of the command, if not global */
12
+ guild_id?: snowflake
13
+ /** Name of command, 1-32 characters */
14
+ name: string
15
+ /** Localization dictionary for name field. Values follow the same restrictions as name */
16
+ name_localizations?: Record<Locale, string>
17
+ /** Description for `CHAT_INPUT` commands, 1-100 characters. Empty string for `USER` and `MESSAGE` commands */
18
+ description: string
19
+ /** Localization dictionary for description field. Values follow the same restrictions as description */
20
+ description_localizations?: Record<Locale, string>
21
+ /** the parameters for the command, max 25 */
22
+ options?: ApplicationCommand.Option[]
23
+ /** Set of permissions represented as a bit set */
24
+ default_member_permissions?: string
25
+ /** Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible. */
26
+ dm_permission?: boolean
27
+ /** whether the command is enabled by default when the app is added to a guild */
28
+ default_permission?: boolean
29
+ /** Indicates whether the command is age-restricted, defaults to false */
30
+ nsfw?: boolean
31
+ /** autoincrementing version identifier updated during substantial record changes */
32
+ version: snowflake
33
+ }
34
+
35
+ export namespace ApplicationCommand {
36
+ /** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types */
37
+ export enum Type {
38
+ /** Slash commands; a text-based command that shows up when a user types / */
39
+ CHAT_INPUT = 1,
40
+ /** A UI-based command that shows up when you right click or tap on a user */
41
+ USER = 2,
42
+ /** A UI-based command that shows up when you right click or tap on a message */
43
+ MESSAGE = 3,
44
+ }
45
+
46
+ /** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure */
47
+ export interface Option {
48
+ /** the type of option */
49
+ type: OptionType
50
+ /** 1-32 character name */
51
+ name: string
52
+ /** Localization dictionary for the `name` field. Values follow the same restrictions as `name` */
53
+ name_localizations?: Record<Locale, string>
54
+ /** 1-100 character description */
55
+ description: string
56
+ /** Localization dictionary for the `description` field. Values follow the same restrictions as `description` */
57
+ description_localizations?: Record<Locale, string>
58
+ /** if the parameter is required or optional--default false */
59
+ required?: boolean
60
+ /** choices for STRING, INTEGER, and NUMBER types for the user to pick from, max 25 */
61
+ choices?: OptionChoice[]
62
+ /** if the option is a subcommand or subcommand group type, this nested options will be the parameters */
63
+ options?: Option[]
64
+ /** if the option is a channel type, the channels shown will be restricted to these types */
65
+ channel_types?: Channel.Type[]
66
+ /** if the option is an `INTEGER` or `NUMBER` type, the minimum value permitted. integer for `INTEGER` options, double for `NUMBER` options */
67
+ min_value?: number
68
+ /** if the option is an `INTEGER` or `NUMBER` type, the maximum value permitted. integer for `INTEGER` options, double for `NUMBER` options */
69
+ max_value?: number
70
+ /** For option type `STRING`, the minimum allowed length (minimum of 0, maximum of 6000) */
71
+ min_length?: integer
72
+ /** For option type `STRING`, the minimum allowed length (maximum of 1, maximum of 6000) */
73
+ max_length?: integer
74
+ /** If autocomplete interactions are enabled for this `STRING`, `INTEGER`, or `NUMBER` type option */
75
+ autocomplete?: boolean
76
+ }
77
+
78
+ /** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type */
79
+ export enum OptionType {
80
+ SUB_COMMAND = 1,
81
+ SUB_COMMAND_GROUP = 2,
82
+ STRING = 3,
83
+ /** Any integer between -2^53 and 2^53 */
84
+ INTEGER = 4,
85
+ BOOLEAN = 5,
86
+ USER = 6,
87
+ /** Includes all channel types + categories */
88
+ CHANNEL = 7,
89
+ ROLE = 8,
90
+ /** Includes users and roles */
91
+ MENTIONABLE = 9,
92
+ /** Any double between -2^53 and 2^53 */
93
+ NUMBER = 10,
94
+ /** attachment object */
95
+ ATTACHMENT = 11,
96
+ }
97
+
98
+ /** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure */
99
+ export interface OptionChoice {
100
+ /** 1-100 character choice name */
101
+ name: string
102
+ /** value of the choice, up to 100 characters if string */
103
+ value: string | number
104
+ /** localization dictionary for the name field. Values follow the same restrictions as name */
105
+ name_localizations?: Record<Locale, string>
106
+ }
107
+
108
+ /** https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure */
109
+ export interface GuildPermissions {
110
+ /** the id of the command */
111
+ id: snowflake
112
+ /** the id of the application the command belongs to */
113
+ application_id: snowflake
114
+ /** the id of the guild */
115
+ guild_id: snowflake
116
+ /** the permissions for the command in the guild */
117
+ permissions: Permissions[]
118
+ }
119
+
120
+ /** https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure */
121
+ export interface Permissions {
122
+ /**
123
+ * ID of the role, user, or channel.
124
+ * It can also be a [permission constant](https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-constants):
125
+ * - `guild_id`: All members in a guild
126
+ * - `guild_id - 1`: All channels in a guild
127
+ */
128
+ id: snowflake
129
+ /** role or user */
130
+ type: PermissionType
131
+ /** true to allow, false, to disallow */
132
+ permission: boolean
133
+ }
134
+
135
+ /** https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type */
136
+ export enum PermissionType {
137
+ ROLE = 1,
138
+ USER = 2,
139
+ CHANNEL = 3,
140
+ }
141
+
142
+ export namespace Params {
143
+ /** https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands-query-string-params */
144
+ export interface Get {
145
+ /** Whether to include full localization dictionaries (name_localizations and description_localizations) in the returned objects, instead of the name_localized and description_localized fields. Default false. */
146
+ with_localizations: boolean
147
+ }
148
+ /** https://discord.com/developers/docs/interactions/application-commands#create-global-application-command-json-params */
149
+ export interface Create {
150
+ /** 1-32 character name */
151
+ name: string
152
+ /** localization dictionary for the name field. Values follow the same restrictions as name */
153
+ name_localizations?: Record<Locale, string>
154
+ /** 1-100 character description */
155
+ description?: string
156
+ /** localization dictionary for the description field. Values follow the same restrictions as description */
157
+ description_localizations?: Record<Locale, string>
158
+ /** the parameters for the command */
159
+ options?: Option[]
160
+ /** set of permissions represented as a bit set */
161
+ default_member_permissions?: string
162
+ /** Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible. */
163
+ dm_permission?: boolean
164
+ /** whether the command is enabled by default when the app is added to a guild */
165
+ default_permission?: boolean
166
+ /** the type of command, defaults 1 if not set */
167
+ type?: Type
168
+ /** indicates whether the command is age-restricted */
169
+ nsfw?: boolean
170
+ }
171
+
172
+ /** https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command-json-params */
173
+ export interface Edit {
174
+ /** 1-32 character name */
175
+ name: string
176
+ /** localization dictionary for the name field. Values follow the same restrictions as name */
177
+ name_localizations?: Record<Locale, string>
178
+ /** 1-100 character description */
179
+ description?: string
180
+ /** localization dictionary for the description field. Values follow the same restrictions as description */
181
+ description_localizations?: Record<Locale, string>
182
+ /** the parameters for the command */
183
+ options?: Option[]
184
+ /** set of permissions represented as a bit set */
185
+ default_member_permissions?: string
186
+ /** Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible. */
187
+ dm_permission?: boolean
188
+ /** whether the command is enabled by default when the app is added to a guild */
189
+ default_permission?: boolean
190
+ /** indicates whether the command is age-restricted */
191
+ nsfw?: boolean
192
+ }
193
+
194
+ /** https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions-json-params */
195
+ export interface EditPermissions {
196
+ /** the permissions for the command in the guild */
197
+ permissions: Permissions[]
198
+ }
199
+ }
200
+ }
201
+
202
+ declare module './gateway' {
203
+ interface GatewayEvents {
204
+ /**
205
+ * sent when an application command's permissions are updated
206
+ * @see https://discord.com/developers/docs/topics/gateway-events#application-command-permissions-update
207
+ */
208
+ APPLICATION_COMMAND_PERMISSIONS_UPDATE: ApplicationCommand.GuildPermissions
209
+ }
210
+ }
211
+
212
+ declare module './internal' {
213
+ interface Internal {
214
+ /**
215
+ * Fetch all of the global commands for your application. Returns an array of application command objects.
216
+ * @see https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands
217
+ */
218
+ getGlobalApplicationCommands(application_id: snowflake, param?: ApplicationCommand.Params.Get): Promise<ApplicationCommand[]>
219
+ /**
220
+ * Creating a command with the same name as an existing command for your application will overwrite the old command.
221
+ * @see https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
222
+ */
223
+ createGlobalApplicationCommand(application_id: snowflake, param: ApplicationCommand.Params.Create): Promise<ApplicationCommand>
224
+ /**
225
+ * Takes a list of application commands, overwriting the existing global command list for this application. Updates will be available in all guilds after 1 hour. Returns 200 and a list of application command objects. Commands that do not already exist will count toward daily application command create limits.
226
+ * @see https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
227
+ */
228
+ bulkOverwriteGlobalApplicationCommands(application_id: snowflake, data: ApplicationCommand.Params.Create[]): Promise<ApplicationCommand[]>
229
+ /**
230
+ * Fetch a global command for your application. Returns an application command object.
231
+ * @see https://discord.com/developers/docs/interactions/application-commands#get-global-application-command
232
+ */
233
+ getGlobalApplicationCommand(application_id: snowflake, command_id: snowflake): Promise<ApplicationCommand>
234
+ /**
235
+ * All parameters for this endpoint are optional.
236
+ * @see https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
237
+ */
238
+ editGlobalApplicationCommand(application_id: snowflake, command_id: snowflake, param: ApplicationCommand.Params.Edit): Promise<ApplicationCommand>
239
+ /**
240
+ * Deletes a global command. Returns 204 No Content on success.
241
+ * @see https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command
242
+ */
243
+ deleteGlobalApplicationCommand(application_id: snowflake, command_id: snowflake): Promise<void>
244
+ /**
245
+ * Fetch all of the guild commands for your application for a specific guild. Returns an array of application command objects.
246
+ * @see https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands
247
+ */
248
+ getGuildApplicationCommands(application_id: snowflake, guild_id: snowflake): Promise<ApplicationCommand[]>
249
+ /**
250
+ * Creating a command with the same name as an existing command for your application will overwrite the old command.
251
+ * @see https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command
252
+ */
253
+ createGuildApplicationCommand(application_id: snowflake, guild_id: snowflake, param: ApplicationCommand.Params.Create): Promise<ApplicationCommand>
254
+ /**
255
+ * Takes a list of application commands, overwriting the existing command list for this application for the targeted guild. Returns 200 and a list of application command objects.
256
+ * @see https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
257
+ */
258
+ bulkOverwriteGuildApplicationCommands(application_id: snowflake, guild_id: snowflake): Promise<void>
259
+ /**
260
+ * Fetches command permissions for all commands for your application in a guild. Returns an array of guild application command permissions objects.
261
+ * @see https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions
262
+ */
263
+ getGuildApplicationCommandPermissions(application_id: snowflake, guild_id: snowflake): Promise<ApplicationCommand.GuildPermissions[]>
264
+ /**
265
+ * Fetch a guild command for your application. Returns an application command object.
266
+ * @see https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command
267
+ */
268
+ getGuildApplicationCommand(application_id: snowflake, guild_id: snowflake, command_id: snowflake): Promise<ApplicationCommand>
269
+ /**
270
+ * All parameters for this endpoint are optional.
271
+ * @see https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
272
+ */
273
+ editGuildApplicationCommand(application_id: snowflake, guild_id: snowflake, command_id: snowflake, param: ApplicationCommand.Params.Edit): Promise<ApplicationCommand>
274
+ /**
275
+ * Delete a guild command. Returns 204 No Content on success.
276
+ * @see https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command
277
+ */
278
+ deleteGuildApplicationCommand(application_id: snowflake, guild_id: snowflake, command_id: snowflake): Promise<void>
279
+ /**
280
+ * Fetches command permissions for a specific command for your application in a guild. Returns a guild application command permissions object.
281
+ * @see https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions
282
+ */
283
+ getApplicationCommandPermissions(application_id: snowflake, guild_id: snowflake, command_id: snowflake): Promise<ApplicationCommand.GuildPermissions>
284
+ /**
285
+ * This endpoint will overwrite existing permissions for the command in that guild
286
+ * @see https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions
287
+ */
288
+ editApplicationCommandPermissions(application_id: snowflake, guild_id: snowflake, command_id: snowflake, param: ApplicationCommand.Params.EditPermissions): Promise<ApplicationCommand.GuildPermissions>
289
+ }
290
+ }
291
+
292
+ Internal.define({
293
+ '/applications/{application.id}/commands': {
294
+ GET: 'getGlobalApplicationCommands',
295
+ POST: 'createGlobalApplicationCommand',
296
+ PUT: 'bulkOverwriteGlobalApplicationCommands',
297
+ },
298
+ '/applications/{application.id}/commands/{command.id}': {
299
+ GET: 'getGlobalApplicationCommand',
300
+ PATCH: 'editGlobalApplicationCommand',
301
+ DELETE: 'deleteGlobalApplicationCommand',
302
+ },
303
+ '/applications/{application.id}/guilds/{guild.id}/commands': {
304
+ GET: 'getGuildApplicationCommands',
305
+ POST: 'createGuildApplicationCommand',
306
+ PUT: 'bulkOverwriteGuildApplicationCommands',
307
+ },
308
+ '/applications/{application.id}/guilds/{guild.id}/commands/{command.id}': {
309
+ GET: 'getGuildApplicationCommand',
310
+ PATCH: 'editGuildApplicationCommand',
311
+ DELETE: 'deleteGuildApplicationCommand',
312
+ },
313
+ '/applications/{application.id}/guilds/{guild.id}/commands/permissions': {
314
+ GET: 'getGuildApplicationCommandPermissions',
315
+ },
316
+ '/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions': {
317
+ GET: 'getApplicationCommandPermissions',
318
+ PUT: 'editApplicationCommandPermissions',
319
+ },
320
+ })
@@ -0,0 +1,125 @@
1
+ import { Channel, Emoji, integer } from '.'
2
+
3
+ export type Component = Button | SelectMenu | TextInput | ActionRow
4
+
5
+ /** https://discord.com/developers/docs/interactions/message-components#component-object-component-types */
6
+ export enum ComponentType {
7
+ /** A container for other components */
8
+ ACTION_ROW = 1,
9
+ /** A button object */
10
+ BUTTON = 2,
11
+ /** A select menu for picking from choices */
12
+ SELECT_MENU = 3,
13
+ /** A text input object */
14
+ TEXT_INPUT = 4,
15
+ /** Select menu for users */
16
+ USER_SELECT = 5,
17
+ /** Select menu for roles */
18
+ ROLE_SELECT = 6,
19
+ /** Select menu for mentionables (users and roles) */
20
+ MENTIONABLE_SELECT = 7,
21
+ /** Select menu for channels */
22
+ CHANNEL_SELECT = 8,
23
+ }
24
+
25
+ /** https://discord.com/developers/docs/interactions/message-components#action-rows */
26
+ export interface ActionRow {
27
+ type: ComponentType.ACTION_ROW
28
+ components: Component[]
29
+ }
30
+
31
+ /** https://discord.com/developers/docs/interactions/message-components#button-object-button-structure */
32
+ export interface Button {
33
+ /** 2 for a button */
34
+ type: ComponentType.BUTTON
35
+ /** one of button styles */
36
+ style: ButtonStyles
37
+ /** text that appears on the button, max 80 characters */
38
+ label?: string
39
+ /** name, id, and animated */
40
+ emoji?: Partial<Emoji>
41
+ /** a developer-defined identifier for the button, max 100 characters */
42
+ custom_id?: string
43
+ /** a url for link-style buttons */
44
+ url?: string
45
+ /** whether the button is disabled (default false) */
46
+ disabled?: boolean
47
+ }
48
+
49
+ /** https://discord.com/developers/docs/interactions/message-components#button-object-button-styles */
50
+ export const enum ButtonStyles {
51
+ /** blurple */
52
+ PRIMARY = 1,
53
+ /** grey */
54
+ SECONDARY = 2,
55
+ /** green */
56
+ SUCCESS = 3,
57
+ /** red */
58
+ DANGER = 4,
59
+ /** grey, navigates to a URL */
60
+ LINK = 5,
61
+ }
62
+
63
+ /** https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-menu-structure */
64
+ export interface SelectMenu {
65
+ /** 3 for a select menu */
66
+ type: ComponentType.SELECT_MENU | ComponentType.USER_SELECT | ComponentType.ROLE_SELECT | ComponentType.MENTIONABLE_SELECT | ComponentType.CHANNEL_SELECT
67
+ /** a developer-defined identifier for the button, max 100 characters */
68
+ custom_id: string
69
+ /** the choices in the select, max 25 */
70
+ options: SelectOption[]
71
+ /** list of channel types to include in the channel select component (type 8) */
72
+ channel_types?: Channel.Type[]
73
+ /** custom placeholder text if nothing is selected, max 100 characters */
74
+ placeholder?: string
75
+ /** the minimum number of items that must be chosen; default 1, min 0, max 25 */
76
+ min_values?: integer
77
+ /** the maximum number of items that can be chosen; default 1, max 25 */
78
+ max_values?: integer
79
+ /** disable the select, default false */
80
+ disabled?: boolean
81
+ }
82
+
83
+ /** https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-option-structure */
84
+ export interface SelectOption {
85
+ /** the user-facing name of the option, max 100 characters */
86
+ label: string
87
+ /** the dev-define value of the option, max 100 characters */
88
+ value: string
89
+ /** an additional description of the option, max 100 characters */
90
+ description?: string
91
+ /** id, name, and animated */
92
+ emoji?: Partial<Emoji>
93
+ /** will render this option as selected by default */
94
+ default?: boolean
95
+ }
96
+
97
+ /** @see https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-structure */
98
+ export interface TextInput {
99
+ /** 4 for a text input */
100
+ type: ComponentType.TEXT_INPUT
101
+ /** a developer-defined identifier for the input, max 100 characters */
102
+ custom_id: string
103
+ /** the Text Input Style */
104
+ style: TextInputStyles
105
+ /** the label for this component, max 45 characters */
106
+ label: string
107
+ /** the minimum input length for a text input, min 0, max 4000 */
108
+ min_length?: integer
109
+ /** the maximum input length for a text input, min 1, max 4000 */
110
+ max_length?: integer
111
+ /** whether this component is required to be filled, default true */
112
+ required?: boolean
113
+ /** a pre-filled value for this component, max 4000 characters */
114
+ value?: string
115
+ /** custom placeholder text if the input is empty, max 100 characters */
116
+ placeholder?: string
117
+ }
118
+
119
+ /** @see https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-styles */
120
+ export const enum TextInputStyles {
121
+ /** A single-line input */
122
+ SHORT = 1,
123
+ /** A multi-line input */
124
+ PARAGRAPH = 2,
125
+ }
@@ -0,0 +1,44 @@
1
+ /** https://discord.com/developers/docs/topics/certified-devices#models-device-object */
2
+ export interface Device {
3
+ /** the type of device */
4
+ type: DeviceType
5
+ /** the device's Windows UUID */
6
+ id: string
7
+ /** the hardware vendor */
8
+ vendor: Vendor
9
+ /** the model of the product */
10
+ model: Model
11
+ /** UUIDs of related devices */
12
+ related: string[]
13
+ /** if the device's native echo cancellation is enabled */
14
+ echo_cancellation?: boolean
15
+ /** if the device's native noise suppression is enabled */
16
+ noise_suppression?: boolean
17
+ /** if the device's native automatic gain control is enabled */
18
+ automatic_gain_control?: boolean
19
+ /** if the device is hardware muted */
20
+ hardware_mute?: boolean
21
+ }
22
+
23
+ /** https://discord.com/developers/docs/topics/certified-devices#models-vendor-object */
24
+ export interface Vendor {
25
+ /** name of the vendor */
26
+ name: string
27
+ /** url for the vendor */
28
+ url: string
29
+ }
30
+
31
+ /** https://discord.com/developers/docs/topics/certified-devices#models-model-object */
32
+ export interface Model {
33
+ /** name of the model */
34
+ name: string
35
+ /** url for the model */
36
+ url: string
37
+ }
38
+
39
+ /** https://discord.com/developers/docs/topics/certified-devices#models-device-type */
40
+ export enum DeviceType {
41
+ AUDIO_INPUT = 'audioinput',
42
+ AUDIO_OUTPUT = 'audiooutput',
43
+ VIDEO_INPUT = 'videoinput',
44
+ }
@@ -0,0 +1,96 @@
1
+ import { Internal, snowflake, User } from '.'
2
+
3
+ /** https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure */
4
+ export interface Emoji {
5
+ /** emoji id */
6
+ id?: snowflake
7
+ /** emoji name */
8
+ name?: string
9
+ /** roles allowed to use this emoji */
10
+ roles?: snowflake[]
11
+ /** user that created this emoji */
12
+ user?: User
13
+ /** whether this emoji must be wrapped in colons */
14
+ require_colons?: boolean
15
+ /** whether this emoji is managed */
16
+ managed?: boolean
17
+ /** whether this emoji is animated */
18
+ animated?: boolean
19
+ /** whether this emoji can be used, may be false due to loss of Server Boosts */
20
+ available?: boolean
21
+ }
22
+
23
+ export namespace Emoji {
24
+ export namespace Event {
25
+ /** https://discord.com/developers/docs/topics/gateway-events#guild-emojis-update-guild-emojis-update-event-fields */
26
+ export interface Update {
27
+ /** id of the guild */
28
+ guild_id: snowflake
29
+ /** array of emojis */
30
+ emojis: Emoji[]
31
+ }
32
+ }
33
+
34
+ /** https://discord.com/developers/docs/resources/emoji#create-guild-emoji-json-params */
35
+ export interface CreateParams extends ModifyParams {
36
+ /** the 128x128 emoji image */
37
+ image: string
38
+ }
39
+
40
+ /** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji-json-params */
41
+ export interface ModifyParams {
42
+ /** name of the emoji */
43
+ name?: string
44
+ /** array of snowflakes roles allowed to use this emoji */
45
+ roles?: snowflake[]
46
+ }
47
+ }
48
+
49
+ declare module './gateway' {
50
+ interface GatewayEvents {
51
+ /** guild emojis were updated */
52
+ GUILD_EMOJIS_UPDATE: Emoji.Event.Update
53
+ }
54
+ }
55
+
56
+ declare module './internal' {
57
+ interface Internal {
58
+ /**
59
+ * Returns a list of emoji objects for the given guild.
60
+ * @see https://discord.com/developers/docs/resources/emoji#list-guild-emojis
61
+ */
62
+ listGuildEmojis(guild_id: snowflake): Promise<Emoji[]>
63
+ /**
64
+ * Returns an emoji object for the given guild and emoji IDs.
65
+ * @see https://discord.com/developers/docs/resources/emoji#get-guild-emoji
66
+ */
67
+ getGuildEmoji(guild_id: snowflake, emoji_id: snowflake): Promise<Emoji>
68
+ /**
69
+ * Create a new emoji for the guild. Requires the `MANAGE_GUILD_EXPRESSIONS` permission. Returns the new emoji object on success. Fires a Guild Emojis Update Gateway event.
70
+ * @see https://discord.com/developers/docs/resources/emoji#create-guild-emoji
71
+ */
72
+ createGuildEmoji(guild_id: snowflake, options: Emoji.CreateParams): Promise<Emoji>
73
+ /**
74
+ * Modify the given emoji. Requires the `MANAGE_GUILD_EXPRESSIONS` permission. Returns the updated emoji object on success. Fires a Guild Emojis Update Gateway event.
75
+ * @see https://discord.com/developers/docs/resources/emoji#modify-guild-emoji
76
+ */
77
+ modifyGuildEmoji(guild_id: snowflake, emoji_id: snowflake, options: Emoji.ModifyParams): Promise<Emoji>
78
+ /**
79
+ * Delete the given emoji. Requires the `MANAGE_GUILD_EXPRESSIONS` permission. Returns 204 No Content on success. Fires a Guild Emojis Update Gateway event.
80
+ * @see https://discord.com/developers/docs/resources/emoji#delete-guild-emoji
81
+ */
82
+ deleteGuildEmoji(guild_id: snowflake, emoji_id: snowflake): Promise<void>
83
+ }
84
+ }
85
+
86
+ Internal.define({
87
+ '/guilds/{guild.id}/emojis': {
88
+ GET: 'listGuildEmojis',
89
+ POST: 'createGuildEmoji',
90
+ },
91
+ '/guilds/{guild.id}/emojis/{emoji.id}': {
92
+ GET: 'getGuildEmoji',
93
+ PATCH: 'modifyGuildEmoji',
94
+ DELETE: 'deleteGuildEmoji',
95
+ },
96
+ })