@satorijs/adapter-discord 4.1.2 → 4.1.4

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 (44) hide show
  1. package/lib/bot.d.ts +2 -2
  2. package/lib/index.js +1 -2
  3. package/lib/index.js.map +1 -2
  4. package/lib/message.d.ts +2 -2
  5. package/lib/utils.d.ts +3 -3
  6. package/lib/ws.d.ts +2 -2
  7. package/package.json +7 -4
  8. package/src/bot.ts +221 -0
  9. package/src/index.ts +27 -0
  10. package/src/message.ts +446 -0
  11. package/src/types/.eslintrc.yml +2 -0
  12. package/src/types/application-role-connection.ts +61 -0
  13. package/src/types/application.ts +120 -0
  14. package/src/types/audit-log.ts +219 -0
  15. package/src/types/auto-moderation.ts +189 -0
  16. package/src/types/ban.ts +92 -0
  17. package/src/types/channel.ts +501 -0
  18. package/src/types/command.ts +320 -0
  19. package/src/types/component.ts +125 -0
  20. package/src/types/device.ts +44 -0
  21. package/src/types/emoji.ts +96 -0
  22. package/src/types/gateway.ts +334 -0
  23. package/src/types/guild-member.ts +260 -0
  24. package/src/types/guild-template.ts +109 -0
  25. package/src/types/guild.ts +476 -0
  26. package/src/types/index.ts +49 -0
  27. package/src/types/integration.ts +130 -0
  28. package/src/types/interaction.ts +283 -0
  29. package/src/types/internal.ts +44 -0
  30. package/src/types/invite.ts +192 -0
  31. package/src/types/message.ts +470 -0
  32. package/src/types/presence.ts +163 -0
  33. package/src/types/reaction.ts +139 -0
  34. package/src/types/role.ts +252 -0
  35. package/src/types/scheduled-event.ts +200 -0
  36. package/src/types/stage-instance.ts +98 -0
  37. package/src/types/sticker.ts +179 -0
  38. package/src/types/team.ts +33 -0
  39. package/src/types/thread.ts +298 -0
  40. package/src/types/user.ts +154 -0
  41. package/src/types/voice.ts +124 -0
  42. package/src/types/webhook.ts +246 -0
  43. package/src/utils.ts +391 -0
  44. package/src/ws.ts +124 -0
@@ -0,0 +1,470 @@
1
+ import { AllowedMentions, Application, Channel, Component, GuildMember, integer, Internal, MessageInteraction, Reaction, RoleSubscriptionData, snowflake, Sticker, timestamp, User } from '.'
2
+
3
+ /** https://discord.com/developers/docs/resources/channel#message-object-message-structure */
4
+ export interface Message {
5
+ /** id of the message */
6
+ id: snowflake
7
+ /** id of the channel the message was sent in */
8
+ channel_id: snowflake
9
+ /** the author of this message (not guaranteed to be a valid user, see below) */
10
+ author: User
11
+ /** member properties for this message's author */
12
+ member?: Partial<GuildMember>
13
+ /** contents of the message */
14
+ content: string
15
+ /** when this message was sent */
16
+ timestamp: timestamp
17
+ /** when this message was edited (or null if never) */
18
+ edited_timestamp?: timestamp
19
+ /** whether this was a TTS message */
20
+ tts: boolean
21
+ /** whether this message mentions everyone */
22
+ mention_everyone: boolean
23
+ /** users specifically mentioned in the message */
24
+ mentions: User[]
25
+ /** roles specifically mentioned in this message */
26
+ mention_roles: snowflake[]
27
+ /** channels specifically mentioned in this message */
28
+ mention_channels?: ChannelMention[]
29
+ /** any attached files */
30
+ attachments: Attachment[]
31
+ /** any embedded content */
32
+ embeds: Embed[]
33
+ /** reactions to the message */
34
+ reactions?: Reaction[]
35
+ /** used for validating a message was sent */
36
+ nonce?: integer | string
37
+ /** whether this message is pinned */
38
+ pinned: boolean
39
+ /** if the message is generated by a webhook, this is the webhook's id */
40
+ webhook_id?: snowflake
41
+ /** type of message */
42
+ type: Message.Type
43
+ /** sent with Rich Presence-related chat embeds */
44
+ activity?: Message.Activity
45
+ /** sent with Rich Presence-related chat embeds */
46
+ application?: Partial<Application>
47
+ /** if the message is a response to an Interaction, this is the id of the interaction's application */
48
+ application_id?: snowflake
49
+ /** data showing the source of a crosspost, channel follow add, pin, or reply message */
50
+ message_reference?: Message.Reference
51
+ /** message flags combined as a bitfield */
52
+ flags?: integer
53
+ /** the message associated with the message_reference */
54
+ referenced_message?: Message
55
+ /** sent if the message is a response to an Interaction */
56
+ interaction?: MessageInteraction
57
+ /** the thread that was started from this message, includes thread member object */
58
+ thread?: Channel
59
+ /** sent if the message contains components like buttons, action rows, or other interactive components */
60
+ components?: Component[]
61
+ /** sent if the message contains stickers */
62
+ sticker_items?: Sticker.Item[]
63
+ /** a generally increasing integer (there may be gaps or duplicates) that represents the approximate position of the message in a thread, it can be used to estimate the relative position of the message in a thread in company with total_message_sent on parent thread */
64
+ position?: integer
65
+ /** data of the role subscription purchase or renewal that prompted this ROLE_SUBSCRIPTION_PURCHASE message */
66
+ role_subscription_data?: RoleSubscriptionData
67
+ }
68
+
69
+ export namespace Message {
70
+ /** https://discord.com/developers/docs/resources/channel#message-object-message-types */
71
+ export enum Type {
72
+ DEFAULT = 0,
73
+ RECIPIENT_ADD = 1,
74
+ RECIPIENT_REMOVE = 2,
75
+ CALL = 3,
76
+ CHANNEL_NAME_CHANGE = 4,
77
+ CHANNEL_ICON_CHANGE = 5,
78
+ CHANNEL_PINNED_MESSAGE = 6,
79
+ GUILD_MEMBER_JOIN = 7,
80
+ USER_PREMIUM_GUILD_SUBSCRIPTION = 8,
81
+ USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1 = 9,
82
+ USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2 = 10,
83
+ USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3 = 11,
84
+ CHANNEL_FOLLOW_ADD = 12,
85
+ GUILD_DISCOVERY_DISQUALIFIED = 14,
86
+ GUILD_DISCOVERY_REQUALIFIED = 15,
87
+ GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING = 16,
88
+ GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING = 17,
89
+ THREAD_CREATED = 18,
90
+ REPLY = 19,
91
+ CHAT_INPUT_COMMAND = 20,
92
+ THREAD_STARTER_MESSAGE = 21,
93
+ GUILD_INVITE_REMINDER = 22,
94
+ CONTEXT_MENU_COMMAND = 23,
95
+ AUTO_MODERATION_ACTION = 24,
96
+ ROLE_SUBSCRIPTION_PURCHASE = 25,
97
+ INTERACTION_PREMIUM_UPSELL = 26,
98
+ GUILD_APPLICATION_PREMIUM_SUBSCRIPTION = 32,
99
+ }
100
+
101
+ /** https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure */
102
+ export interface Activity {
103
+ /** type of message activity */
104
+ type: ActivityType
105
+ /** party_id from a Rich Presence event */
106
+ party_id?: string
107
+ }
108
+
109
+ /** https://discord.com/developers/docs/resources/channel#message-object-message-activity-types */
110
+ export enum ActivityType {
111
+ JOIN = 1,
112
+ SPECTATE = 2,
113
+ LISTEN = 3,
114
+ JOIN_REQUEST = 5,
115
+ }
116
+
117
+ /** https://discord.com/developers/docs/resources/channel#message-object-message-flags */
118
+ export enum Flag {
119
+ /** this message has been published to subscribed channels (via Channel Following) */
120
+ CROSSPOSTED = 1 << 0,
121
+ /** this message originated from a message in another channel (via Channel Following) */
122
+ IS_CROSSPOST = 1 << 1,
123
+ /** do not include any embeds when serializing this message */
124
+ SUPPRESS_EMBEDS = 1 << 2,
125
+ /** the source message for this crosspost has been deleted (via Channel Following) */
126
+ SOURCE_MESSAGE_DELETED = 1 << 3,
127
+ /** this message came from the urgent message system */
128
+ URGENT = 1 << 4,
129
+ /** this message has an associated thread, with the same id as the message */
130
+ HAS_THREAD = 1 << 5,
131
+ /** this message is only visible to the user who invoked the Interaction */
132
+ EPHEMERAL = 1 << 6,
133
+ /** this message is an Interaction Response and the bot is "thinking" */
134
+ LOADING = 1 << 7,
135
+ /** this message failed to mention some roles and add their members to the thread */
136
+ FAILED_TO_MENTION_SOME_ROLES_IN_THREAD = 1 << 8,
137
+ }
138
+
139
+ /** https://discord.com/developers/docs/resources/channel#message-reference-object-message-reference-structure */
140
+ export interface Reference {
141
+ /** id of the originating message */
142
+ message_id?: snowflake
143
+ /** id of the originating message's channel */
144
+ channel_id?: snowflake
145
+ /** id of the originating message's guild */
146
+ guild_id?: snowflake
147
+ /** when sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message, default true */
148
+ fail_if_not_exists?: boolean
149
+ }
150
+
151
+ /** https://discord.com/developers/docs/resources/channel#get-channel-messages-query-string-params */
152
+ export interface GetParams {
153
+ /** get messages around this message ID */
154
+ around?: snowflake
155
+ /** get messages before this message ID */
156
+ before?: snowflake
157
+ /** get messages after this message ID */
158
+ after?: snowflake
159
+ /** max number of messages to return (1-100) */
160
+ limit?: integer
161
+ }
162
+
163
+ /** https://discord.com/developers/docs/resources/channel#create-message-jsonform-params */
164
+ export interface CreateParams extends EditParams {
165
+ /** true if this is a TTS message */
166
+ tts: boolean
167
+ /** include to make your message a reply */
168
+ message_reference: Reference
169
+ /** IDs of up to 3 stickers in the server to send in the message */
170
+ sticker_ids: snowflake[]
171
+ }
172
+
173
+ /** https://discord.com/developers/docs/resources/channel#edit-message-jsonform-params */
174
+ export interface EditParams {
175
+ /** the message contents (up to 2000 characters) */
176
+ content?: string
177
+ /** embedded rich content (up to 6000 characters) */
178
+ embeds?: Embed[]
179
+ /** edit the flags of a message (only SUPPRESS_EMBEDS can currently be set/unset) */
180
+ flags?: integer
181
+ /** allowed mentions for the message */
182
+ allowed_mentions?: AllowedMentions
183
+ /** the components to include with the message */
184
+ components?: Component[]
185
+ /** the contents of the file being sent/edited */
186
+ files?: any
187
+ /** JSON encoded body of non-file params (multipart/form-data only) */
188
+ payload_json?: string
189
+ /** attached files to keep and possible descriptions for new files */
190
+ attachments?: Attachment[]
191
+ }
192
+
193
+ /** https://discord.com/developers/docs/resources/channel#bulk-delete-messages-json-params */
194
+ export interface BulkDeleteParams {
195
+ /** an array of message ids to delete (2-100) */
196
+ messages: snowflake[]
197
+ }
198
+ }
199
+
200
+ /** https://discord.com/developers/docs/resources/channel#embed-object-embed-structure */
201
+ export interface Embed {
202
+ /** title of embed */
203
+ title?: string
204
+ /** type of embed (always "rich" for webhook embeds) */
205
+ type?: string
206
+ /** description of embed */
207
+ description?: string
208
+ /** url of embed */
209
+ url?: string
210
+ /** timestamp of embed content */
211
+ timestamp?: timestamp
212
+ /** color code of the embed */
213
+ color?: integer
214
+ /** footer information */
215
+ footer?: Embed.Footer
216
+ /** image information */
217
+ image?: Embed.Image
218
+ /** thumbnail information */
219
+ thumbnail?: Embed.Thumbnail
220
+ /** video information */
221
+ video?: Embed.Video
222
+ /** provider information */
223
+ provider?: Embed.Provider
224
+ /** author information */
225
+ author?: Embed.Author
226
+ /** fields information */
227
+ fields?: Embed.Field[]
228
+ }
229
+
230
+ export namespace Embed {
231
+ /** https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure */
232
+ export interface Thumbnail {
233
+ /** source url of thumbnail (only supports http(s) and attachments) */
234
+ url: string
235
+ /** a proxied url of the thumbnail */
236
+ proxy_url?: string
237
+ /** height of thumbnail */
238
+ height?: integer
239
+ /** width of thumbnail */
240
+ width?: integer
241
+ }
242
+
243
+ /** https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure */
244
+ export interface Video {
245
+ /** source url of video */
246
+ url?: string
247
+ /** a proxied url of the video */
248
+ proxy_url?: string
249
+ /** height of video */
250
+ height?: integer
251
+ /** width of video */
252
+ width?: integer
253
+ }
254
+
255
+ /** https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure */
256
+ export interface Image {
257
+ /** source url of image (only supports http(s) and attachments) */
258
+ url: string
259
+ /** a proxied url of the image */
260
+ proxy_url?: string
261
+ /** height of image */
262
+ height?: integer
263
+ /** width of image */
264
+ width?: integer
265
+ }
266
+
267
+ /** https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure */
268
+ export interface Provider {
269
+ /** name of provider */
270
+ name?: string
271
+ /** url of provider */
272
+ url?: string
273
+ }
274
+
275
+ /** https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure */
276
+ export interface Author {
277
+ /** name of author */
278
+ name: string
279
+ /** url of author */
280
+ url?: string
281
+ /** url of author icon (only supports http(s) and attachments) */
282
+ icon_url?: string
283
+ /** a proxied url of author icon */
284
+ proxy_icon_url?: string
285
+ }
286
+
287
+ /** https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure */
288
+ export interface Footer {
289
+ /** footer text */
290
+ text: string
291
+ /** url of footer icon (only supports http(s) and attachments) */
292
+ icon_url?: string
293
+ /** a proxied url of footer icon */
294
+ proxy_icon_url?: string
295
+ }
296
+
297
+ /** https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure */
298
+ export interface Field {
299
+ /** name of the field */
300
+ name: string
301
+ /** value of the field */
302
+ value: string
303
+ /** whether or not this field should display inline */
304
+ inline?: boolean
305
+ }
306
+ }
307
+
308
+ /** https://discord.com/developers/docs/resources/channel#attachment-object-attachment-structure */
309
+ export interface Attachment {
310
+ /** attachment id */
311
+ id: snowflake
312
+ /** name of file attached */
313
+ filename: string
314
+ /** the attachment's media type */
315
+ content_type?: string
316
+ /** size of file in bytes */
317
+ size: integer
318
+ /** source url of file */
319
+ url: string
320
+ /** a proxied url of file */
321
+ proxy_url: string
322
+ /** height of file (if image) */
323
+ height?: integer
324
+ /** width of file (if image) */
325
+ width?: integer
326
+ /** whether this attachment is ephemeral */
327
+ ephemeral?: boolean
328
+ }
329
+
330
+ /** https://discord.com/developers/docs/resources/channel#channel-mention-object-channel-mention-structure */
331
+ export interface ChannelMention {
332
+ /** id of the channel */
333
+ id: snowflake
334
+ /** id of the guild containing the channel */
335
+ guild_id: snowflake
336
+ /** the type of channel */
337
+ type: Channel.Type
338
+ /** the name of the channel */
339
+ name: string
340
+ }
341
+
342
+ export namespace Message {
343
+ export namespace Event {
344
+ /** https://discord.com/developers/docs/topics/gateway-events#message-create */
345
+ export interface Create extends Message {
346
+ /** ID of the guild the message was sent in - unless it is an ephemeral message */
347
+ guild_id?: snowflake
348
+ /** Member properties for this message's author. Missing for ephemeral messages and messages from webhooks */
349
+ member?: Partial<GuildMember>
350
+ /** Users specifically mentioned in the message */
351
+ mentions: (User & { member: Partial<GuildMember> })[]
352
+ }
353
+
354
+ /** https://discord.com/developers/docs/topics/gateway-events#message-update */
355
+ export interface Update extends Partial<Message> {}
356
+
357
+ /** https://discord.com/developers/docs/topics/gateway-events#message-delete-message-delete */
358
+ export interface Delete {
359
+ /** the id of the message */
360
+ id: snowflake
361
+ /** the id of the channel */
362
+ channel_id: snowflake
363
+ /** the id of the guild */
364
+ guild_id?: snowflake
365
+ }
366
+
367
+ /** https://discord.com/developers/docs/topics/gateway-events#message-delete-bulk-message-delete-bulk */
368
+ export interface DeleteBulk {
369
+ /** the ids of the messages */
370
+ ids: snowflake[]
371
+ /** the id of the channel */
372
+ channel_id: snowflake
373
+ /** the id of the guild */
374
+ guild_id?: snowflake
375
+ }
376
+ }
377
+ }
378
+
379
+ declare module './gateway' {
380
+ interface GatewayEvents {
381
+ /** message was created */
382
+ MESSAGE_CREATE: Message.Event.Create
383
+ /** message was edited */
384
+ MESSAGE_UPDATE: Message.Event.Update
385
+ /** message was deleted */
386
+ MESSAGE_DELETE: Message.Event.Delete
387
+ /** multiple messages were deleted at once */
388
+ MESSAGE_DELETE_BULK: Message.Event.DeleteBulk
389
+ }
390
+ }
391
+
392
+ declare module './internal' {
393
+ interface Internal {
394
+ /**
395
+ * Returns the messages for a channel. If operating on a guild channel, this endpoint requires the VIEW_CHANNEL permission to be present on the current user. If the current user is missing the 'READ_MESSAGE_HISTORY' permission in the channel then this will return no messages (since they cannot read the message history). Returns an array of message objects on success.
396
+ * @see https://discord.com/developers/docs/resources/channel#get-channel-messages
397
+ */
398
+ getChannelMessages(channel_id: snowflake, params?: Message.GetParams): Promise<Message[]>
399
+ /**
400
+ * Returns a specific message in the channel. If operating on a guild channel, this endpoint requires the 'READ_MESSAGE_HISTORY' permission to be present on the current user. Returns a message object on success.
401
+ * @see https://discord.com/developers/docs/resources/channel#get-channel-message
402
+ */
403
+ getChannelMessage(channel_id: snowflake, message_id: snowflake): Promise<Message>
404
+ /**
405
+ * Post a message to a guild text or DM channel. Returns a message object. Fires a Message Create Gateway event. See message formatting for more information on how to properly format messages.
406
+ * @see https://discord.com/developers/docs/resources/channel#create-message
407
+ */
408
+ createMessage(channel_id: snowflake, params: Message.CreateParams): Promise<Message>
409
+ /**
410
+ * Crosspost a message in a News Channel to following channels. This endpoint requires the 'SEND_MESSAGES' permission, if the current user sent the message, or additionally the 'MANAGE_MESSAGES' permission, for all other messages, to be present for the current user.
411
+ * @see https://discord.com/developers/docs/resources/channel#crosspost-message
412
+ */
413
+ crosspostMessage(channel_id: snowflake, message_id: snowflake): Promise<Message>
414
+ /**
415
+ * Edit a previously sent message. The fields content, embeds, and flags can be edited by the original message author. Other users can only edit flags and only if they have the MANAGE_MESSAGES permission in the corresponding channel. When specifying flags, ensure to include all previously set flags/bits in addition to ones that you are modifying. Only flags documented in the table below may be modified by users (unsupported flag changes are currently ignored without error).
416
+ * @see https://discord.com/developers/docs/resources/channel#edit-message
417
+ */
418
+ editMessage(channel_id: snowflake, message_id: snowflake, params: Message.EditParams): Promise<Message>
419
+ /**
420
+ * Delete a message. If operating on a guild channel and trying to delete a message that was not sent by the current user, this endpoint requires the MANAGE_MESSAGES permission. Returns a 204 empty response on success. Fires a Message Delete Gateway event.
421
+ * @see https://discord.com/developers/docs/resources/channel#delete-message
422
+ */
423
+ deleteMessage(channel_id: snowflake, message_id: snowflake): Promise<void>
424
+ /**
425
+ * Delete multiple messages in a single request. This endpoint can only be used on guild channels and requires the MANAGE_MESSAGES permission. Returns a 204 empty response on success. Fires a Message Delete Bulk Gateway event.
426
+ * @see https://discord.com/developers/docs/resources/channel#bulk-delete-messages
427
+ */
428
+ bulkDeleteMessages(channel_id: snowflake, params: Message.BulkDeleteParams): Promise<void>
429
+ /**
430
+ * Returns all pinned messages in the channel as an array of message objects.
431
+ * @see https://discord.com/developers/docs/resources/channel#get-pinned-messages
432
+ */
433
+ getPinnedMessages(channel_id: snowflake): Promise<Message[]>
434
+ /**
435
+ * Pin a message in a channel. Requires the MANAGE_MESSAGES permission. Returns a 204 empty response on success.
436
+ * @see https://discord.com/developers/docs/resources/channel#pin-message
437
+ */
438
+ pinMessage(channel_id: snowflake, message_id: snowflake): Promise<void>
439
+ /**
440
+ * Unpin a message in a channel. Requires the MANAGE_MESSAGES permission. Returns a 204 empty response on success.
441
+ * @see https://discord.com/developers/docs/resources/channel#unpin-message
442
+ */
443
+ unpinMessage(channel_id: snowflake, message_id: snowflake): Promise<void>
444
+ }
445
+ }
446
+
447
+ Internal.define({
448
+ '/channels/{channel.id}/messages': {
449
+ GET: 'getChannelMessages',
450
+ POST: 'createMessage',
451
+ },
452
+ '/channels/{channel.id}/messages/{message.id}': {
453
+ GET: 'getChannelMessage',
454
+ PATCH: 'editMessage',
455
+ DELETE: 'deleteMessage',
456
+ },
457
+ '/channels/{channel.id}/messages/{message.id}/crosspost': {
458
+ POST: 'crosspostMessage',
459
+ },
460
+ '/channels/{channel.id}/messages/bulk-delete': {
461
+ POST: 'bulkDeleteMessages',
462
+ },
463
+ '/channels/{channel.id}/pins': {
464
+ GET: 'getPinnedMessages',
465
+ },
466
+ '/channels/{channel.id}/pins/{message.id}': {
467
+ PUT: 'pinMessage',
468
+ DELETE: 'unpinMessage',
469
+ },
470
+ })
@@ -0,0 +1,163 @@
1
+ import { Emoji, integer, snowflake, User } from '.'
2
+
3
+ /** https://discord.com/developers/docs/topics/gateway-events#presence-update-presence-update-event-fields */
4
+ export interface PresenceUpdateEvent {
5
+ /** the user presence is being updated for */
6
+ user: User
7
+ /** id of the guild */
8
+ guild_id: snowflake
9
+ /** either "idle", "dnd", "online", or "offline" */
10
+ status: StatusType
11
+ /** user's current activities */
12
+ activities: Activity[]
13
+ /** user's platform-dependent status */
14
+ client_status: ClientStatus
15
+ }
16
+
17
+ /** https://discord.com/developers/docs/topics/gateway-events#update-presence-status-types */
18
+ export enum StatusType {
19
+ /** Online */
20
+ ONLINE = 'ONLINE',
21
+ /** Do Not Disturb */
22
+ DND = 'DND',
23
+ /** AFK */
24
+ IDLE = 'IDLE',
25
+ /** Offline */
26
+ OFFLINE = 'OFFLINE',
27
+ }
28
+
29
+ /** https://discord.com/developers/docs/topics/gateway-events#client-status-object */
30
+ export interface ClientStatus {
31
+ /** the user's status set for an active desktop (Windows, Linux, Mac) application session */
32
+ desktop?: string
33
+ /** the user's status set for an active mobile (iOS, Android) application session */
34
+ mobile?: string
35
+ /** the user's status set for an active web (browser, bot account) application session */
36
+ web?: string
37
+ }
38
+
39
+ /** https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-structure */
40
+ export interface Activity {
41
+ /** the activity's name */
42
+ name: string
43
+ /** activity type */
44
+ type: ActivityType
45
+ /** stream url, is validated when type is 1 */
46
+ url?: string
47
+ /** unix timestamp (in milliseconds) of when the activity was added to the user's session */
48
+ created_at: integer
49
+ /** unix timestamps for start and/or end of the game */
50
+ timestamps?: ActivityTimestamps
51
+ /** application id for the game */
52
+ application_id?: snowflake
53
+ /** what the player is currently doing */
54
+ details?: string
55
+ /** the user's current party status */
56
+ state?: string
57
+ /** the emoji used for a custom status */
58
+ emoji?: Emoji
59
+ /** information for the current party of the player */
60
+ party?: ActivityParty
61
+ /** images for the presence and their hover texts */
62
+ assets?: ActivityAssets
63
+ /** secrets for Rich Presence joining and spectating */
64
+ secrets?: ActivitySecrets
65
+ /** whether or not the activity is an instanced game session */
66
+ instance?: boolean
67
+ /** activity flags ORd together, describes what the payload includes */
68
+ flags?: integer
69
+ /** the custom buttons shown in the Rich Presence (max 2) */
70
+ buttons?: ActivityButton[]
71
+ }
72
+
73
+ /** https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-timestamps */
74
+ export interface ActivityTimestamps {
75
+ /** unix time (in milliseconds) of when the activity started */
76
+ start?: integer
77
+ /** unix time (in milliseconds) of when the activity ends */
78
+ end?: integer
79
+ }
80
+
81
+ /** https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-emoji */
82
+ export interface ActivityEmoji {
83
+ /** the name of the emoji */
84
+ name: string
85
+ /** the id of the emoji */
86
+ id?: snowflake
87
+ /** whether this emoji is animated */
88
+ animated?: boolean
89
+ }
90
+
91
+ /** https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-party */
92
+ export interface ActivityParty {
93
+ /** the id of the party */
94
+ id?: string
95
+ /** used to show the party's current and maximum size */
96
+ size?: [current_size: integer, max_size: integer]
97
+ }
98
+
99
+ /** https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-assets */
100
+ export interface ActivityAssets {
101
+ /** the id for a large asset of the activity, usually a snowflake */
102
+ large_image?: string
103
+ /** text displayed when hovering over the large image of the activity */
104
+ large_text?: string
105
+ /** the id for a small asset of the activity, usually a snowflake */
106
+ small_image?: string
107
+ /** text displayed when hovering over the small image of the activity */
108
+ small_text?: string
109
+ }
110
+
111
+ /** https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-secrets */
112
+ export interface ActivitySecrets {
113
+ /** Secret for joining a party */
114
+ join?: string
115
+ /** Secret for spectating a game */
116
+ spectate?: string
117
+ /** Secret for a specific instanced match */
118
+ match?: string
119
+ }
120
+
121
+ /** https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-button */
122
+ export interface ActivityButton {
123
+ /** the text shown on the button (1-32 characters) */
124
+ label: string
125
+ /** the url opened when clicking the button (1-512 characters) */
126
+ url: string
127
+ }
128
+
129
+ /** https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-types */
130
+ export enum ActivityType {
131
+ /** Playing {name} */
132
+ GAME = 0,
133
+ /** Streaming {details} */
134
+ STREAMING = 1,
135
+ /** Listening to {name} */
136
+ LISTENING = 2,
137
+ /** Watching {name} */
138
+ WATCHING = 3,
139
+ /** {emoji} {name} */
140
+ CUSTOM = 4,
141
+ /** Competing in {name} */
142
+ COMPETING = 5,
143
+ }
144
+
145
+ /** https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-flags */
146
+ export enum ActivityFlag {
147
+ INSTANCE = 1 << 0,
148
+ JOIN = 1 << 1,
149
+ SPECTATE = 1 << 2,
150
+ JOIN_REQUEST = 1 << 3,
151
+ SYNC = 1 << 4,
152
+ PLAY = 1 << 5,
153
+ PARTY_PRIVACY_FRIENDS = 1 << 6,
154
+ PARTY_PRIVACY_VOICE_CHANNEL= 1 << 7,
155
+ EMBEDDED = 1 << 8,
156
+ }
157
+
158
+ declare module './gateway' {
159
+ interface GatewayEvents {
160
+ /** user was updated */
161
+ PRESENCE_UPDATE: PresenceUpdateEvent
162
+ }
163
+ }