-
-
Notifications
You must be signed in to change notification settings - Fork 114
/
v8.ts
1554 lines (1419 loc) · 40.1 KB
/
v8.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Types extracted from https://discord.com/developers/docs/topics/gateway
*/
import type { Snowflake } from '../globals.ts';
import type {
APIApplication,
APIApplicationCommand,
APIApplicationCommandInteraction,
APIChannel,
APIEmoji,
APIGuild,
APIGuildIntegration,
APIGuildMember,
APIMessage,
APIRole,
APIUnavailableGuild,
APIUser,
GatewayActivity,
GatewayPresenceUpdate as RawGatewayPresenceUpdate,
GatewayVoiceState,
InviteTargetUserType,
PresenceUpdateStatus,
} from '../payloads/v8/mod.ts';
export * from './common.ts';
export const GatewayVersion = '8';
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes
*/
export enum GatewayOPCodes {
/**
* An event was dispatched
*/
Dispatch,
/**
* A bidirectional opcode to maintain an active gateway connection.
* Fired periodically by the client, or fired by the gateway to request an immediate heartbeat from the client.
*/
Heartbeat,
/**
* Starts a new session during the initial handshake
*/
Identify,
/**
* Update the client's presence
*/
PresenceUpdate,
/**
* Used to join/leave or move between voice channels
*/
VoiceStateUpdate,
/**
* Resume a previous session that was disconnected
*/
Resume = 6,
/**
* You should attempt to reconnect and resume immediately
*/
Reconnect,
/**
* Request information about offline guild members in a large guild
*/
RequestGuildMembers,
/**
* The session has been invalidated. You should reconnect and identify/resume accordingly
*/
InvalidSession,
/**
* Sent immediately after connecting, contains the `heartbeat_interval` to use
*/
Hello,
/**
* Sent in response to receiving a heartbeat to acknowledge that it has been received
*/
HeartbeatAck,
}
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes
*/
export enum GatewayCloseCodes {
/**
* We're not sure what went wrong. Try reconnecting?
*/
UnknownError = 4000,
/**
* You sent an invalid Gateway opcode or an invalid payload for an opcode. Don't do that!
*
* See https://discord.com/developers/docs/topics/gateway#payloads-and-opcodes
*/
UnknownOpCode,
/**
* You sent an invalid payload to us. Don't do that!
*
* See https://discord.com/developers/docs/topics/gateway#sending-payloads
*/
DecodeError,
/**
* You sent us a payload prior to identifying
*
* See https://discord.com/developers/docs/topics/gateway#identify
*/
NotAuthenticated,
/**
* The account token sent with your identify payload is incorrect
*
* See https://discord.com/developers/docs/topics/gateway#identify
*/
AuthenticationFailed,
/**
* You sent more than one identify payload. Don't do that!
*/
AlreadyAuthenticated,
/**
* The sequence sent when resuming the session was invalid. Reconnect and start a new session
*
* See https://discord.com/developers/docs/topics/gateway#resume
*/
InvalidSeq = 4007,
/**
* Woah nelly! You're sending payloads to us too quickly. Slow it down! You will be disconnected on receiving this
*/
RateLimited,
/**
* Your session timed out. Reconnect and start a new one
*/
SessionTimedOut,
/**
* You sent us an invalid shard when identifying
*
* See https://discord.com/developers/docs/topics/gateway#sharding
*/
InvalidShard,
/**
* The session would have handled too many guilds - you are required to shard your connection in order to connect
*
* See https://discord.com/developers/docs/topics/gateway#sharding
*/
ShardingRequired,
/**
* You sent an invalid version for the gateway
*/
InvalidAPIVersion,
/**
* You sent an invalid intent for a Gateway Intent. You may have incorrectly calculated the bitwise value
*
* See https://discord.com/developers/docs/topics/gateway#gateway-intents
*/
InvalidIntents,
/**
* You sent a disallowed intent for a Gateway Intent. You may have tried to specify an intent that you have not
* enabled or are not whitelisted for
*
* See https://discord.com/developers/docs/topics/gateway#gateway-intents
*
* See https://discord.com/developers/docs/topics/gateway#privileged-intents
*/
DisallowedIntents,
}
/**
* https://discord.com/developers/docs/topics/gateway#list-of-intents
*/
export enum GatewayIntentBits {
GUILDS = 1 << 0,
GUILD_MEMBERS = 1 << 1,
GUILD_BANS = 1 << 2,
GUILD_EMOJIS = 1 << 3,
GUILD_INTEGRATIONS = 1 << 4,
GUILD_WEBHOOKS = 1 << 5,
GUILD_INVITES = 1 << 6,
GUILD_VOICE_STATES = 1 << 7,
GUILD_PRESENCES = 1 << 8,
GUILD_MESSAGES = 1 << 9,
GUILD_MESSAGE_REACTIONS = 1 << 10,
GUILD_MESSAGE_TYPING = 1 << 11,
DIRECT_MESSAGES = 1 << 12,
DIRECT_MESSAGE_REACTIONS = 1 << 13,
DIRECT_MESSAGE_TYPING = 1 << 14,
}
/**
* https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
*/
export enum GatewayDispatchEvents {
ApplicationCommandCreate = 'APPLICATION_COMMAND_CREATE',
ApplicationCommandDelete = 'APPLICATION_COMMAND_DELETE',
ApplicationCommandUpdate = 'APPLICATION_COMMAND_UPDATE',
ChannelCreate = 'CHANNEL_CREATE',
ChannelDelete = 'CHANNEL_DELETE',
ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE',
ChannelUpdate = 'CHANNEL_UPDATE',
GuildBanAdd = 'GUILD_BAN_ADD',
GuildBanRemove = 'GUILD_BAN_REMOVE',
GuildCreate = 'GUILD_CREATE',
GuildDelete = 'GUILD_DELETE',
GuildEmojisUpdate = 'GUILD_EMOJIS_UPDATE',
GuildIntegrationsUpdate = 'GUILD_INTEGRATIONS_UPDATE',
GuildMemberAdd = 'GUILD_MEMBER_ADD',
GuildMemberRemove = 'GUILD_MEMBER_REMOVE',
GuildMembersChunk = 'GUILD_MEMBERS_CHUNK',
GuildMemberUpdate = 'GUILD_MEMBER_UPDATE',
GuildRoleCreate = 'GUILD_ROLE_CREATE',
GuildRoleDelete = 'GUILD_ROLE_DELETE',
GuildRoleUpdate = 'GUILD_ROLE_UPDATE',
GuildUpdate = 'GUILD_UPDATE',
IntegrationCreate = 'INTEGRATION_CREATE',
IntegrationDelete = 'INTEGRATION_DELETE',
IntegrationUpdate = 'INTEGRATION_UPDATE',
InteractionCreate = 'INTERACTION_CREATE',
InviteCreate = 'INVITE_CREATE',
InviteDelete = 'INVITE_DELETE',
MessageCreate = 'MESSAGE_CREATE',
MessageDelete = 'MESSAGE_DELETE',
MessageDeleteBulk = 'MESSAGE_DELETE_BULK',
MessageReactionAdd = 'MESSAGE_REACTION_ADD',
MessageReactionRemove = 'MESSAGE_REACTION_REMOVE',
MessageReactionRemoveAll = 'MESSAGE_REACTION_REMOVE_ALL',
MessageReactionRemoveEmoji = 'MESSAGE_REACTION_REMOVE_EMOJI',
MessageUpdate = 'MESSAGE_UPDATE',
PresenceUpdate = 'PRESENCE_UPDATE',
Ready = 'READY',
Resumed = 'RESUMED',
TypingStart = 'TYPING_START',
UserUpdate = 'USER_UPDATE',
VoiceServerUpdate = 'VOICE_SERVER_UPDATE',
VoiceStateUpdate = 'VOICE_STATE_UPDATE',
WebhooksUpdate = 'WEBHOOKS_UPDATE',
}
export type GatewaySendPayload =
| GatewayHeartbeat
| GatewayIdentify
| GatewayUpdatePresence
| GatewayVoiceStateUpdate
| GatewayResume
| GatewayRequestGuildMembers;
export type GatewayReceivePayload =
| GatewayHello
| GatewayHeartbeatRequest
| GatewayHeartbeatAck
| GatewayInvalidSession
| GatewayReconnect
| GatewayDispatchPayload;
export type GatewayDispatchPayload =
| GatewayChannelModifyDispatch
| GatewayChannelPinsUpdateDispatch
| GatewayGuildBanModifyDispatch
| GatewayGuildDeleteDispatch
| GatewayGuildEmojisUpdateDispatch
| GatewayGuildIntegrationsUpdateDispatch
| GatewayGuildMemberAddDispatch
| GatewayGuildMemberRemoveDispatch
| GatewayGuildMembersChunkDispatch
| GatewayGuildMemberUpdateDispatch
| GatewayGuildModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayGuildRoleModifyDispatch
| GatewayIntegrationCreateDispatch
| GatewayIntegrationDeleteDispatch
| GatewayIntegrationUpdateDispatch
| GatewayInteractionCreateDispatch
| GatewayInviteCreateDispatch
| GatewayInviteDeleteDispatch
| GatewayMessageCreateDispatch
| GatewayMessageDeleteBulkDispatch
| GatewayMessageDeleteDispatch
| GatewayMessageReactionAddDispatch
| GatewayMessageReactionRemoveAllDispatch
| GatewayMessageReactionRemoveDispatch
| GatewayMessageReactionRemoveEmojiDispatch
| GatewayMessageUpdateDispatch
| GatewayPresenceUpdateDispatch
| GatewayReadyDispatch
| GatewayResumedDispatch
| GatewayTypingStartDispatch
| GatewayUserUpdateDispatch
| GatewayVoiceServerUpdateDispatch
| GatewayVoiceStateUpdateDispatch
| GatewayWebhooksUpdateDispatch;
// #region Dispatch Payloads
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatch = DataPayload<
| GatewayDispatchEvents.ApplicationCommandCreate
| GatewayDispatchEvents.ApplicationCommandUpdate
| GatewayDispatchEvents.ApplicationCommandDelete,
GatewayApplicationCommandModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export interface GatewayApplicationCommandModifyDispatchData extends APIApplicationCommand {
guild_id?: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#hello
*/
export interface GatewayHello extends NonDispatchPayload {
op: GatewayOPCodes.Hello;
d: GatewayHelloData;
}
/**
* https://discord.com/developers/docs/topics/gateway#hello
*/
export interface GatewayHelloData {
/**
* The interval (in milliseconds) the client should heartbeat with
*/
heartbeat_interval: number;
}
/**
* https://discord.com/developers/docs/topics/gateway#heartbeating
*/
export interface GatewayHeartbeatRequest extends NonDispatchPayload {
op: GatewayOPCodes.Heartbeat;
d: never;
}
/**
* https://discord.com/developers/docs/topics/gateway#heartbeating-example-gateway-heartbeat-ack
*/
export interface GatewayHeartbeatAck extends NonDispatchPayload {
op: GatewayOPCodes.HeartbeatAck;
d: never;
}
/**
* https://discord.com/developers/docs/topics/gateway#invalid-session
*/
export interface GatewayInvalidSession extends NonDispatchPayload {
op: GatewayOPCodes.InvalidSession;
d: GatewayInvalidSessionData;
}
/**
* https://discord.com/developers/docs/topics/gateway#invalid-session
*/
export type GatewayInvalidSessionData = boolean;
/**
* https://discord.com/developers/docs/topics/gateway#reconnect
*/
export interface GatewayReconnect extends NonDispatchPayload {
op: GatewayOPCodes.Reconnect;
d: never;
}
/**
* https://discord.com/developers/docs/topics/gateway#ready
*/
export type GatewayReadyDispatch = DataPayload<GatewayDispatchEvents.Ready, GatewayReadyDispatchData>;
/**
* https://discord.com/developers/docs/topics/gateway#ready
*/
export interface GatewayReadyDispatchData {
/**
* Gateway version
*
* See https://discord.com/developers/docs/topics/gateway#gateways-gateway-versions
*/
v: number;
/**
* Information about the user including email
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
user: APIUser;
/**
* The guilds the user is in
*
* See https://discord.com/developers/docs/resources/guild#unavailable-guild-object
*/
guilds: APIUnavailableGuild[];
/**
* Used for resuming connections
*/
session_id: string;
/**
* The shard information associated with this session, if sent when identifying
*
* See https://discord.com/developers/docs/topics/gateway#sharding
*/
shard?: [shard_id: number, shard_count: number];
/**
* Contains `id` and `flags`
*
* See https://discord.com/developers/docs/topics/oauth2#application-object
*/
application: Pick<APIApplication, 'id' | 'flags'>;
}
/**
* https://discord.com/developers/docs/topics/gateway#resumed
*/
export type GatewayResumedDispatch = DataPayload<GatewayDispatchEvents.Resumed, never>;
/**
* https://discord.com/developers/docs/topics/gateway#channel-create
* https://discord.com/developers/docs/topics/gateway#channel-update
* https://discord.com/developers/docs/topics/gateway#channel-delete
*/
export type GatewayChannelModifyDispatch = DataPayload<
GatewayDispatchEvents.ChannelCreate | GatewayDispatchEvents.ChannelDelete | GatewayDispatchEvents.ChannelUpdate,
GatewayChannelModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#channel-create
* https://discord.com/developers/docs/topics/gateway#channel-update
* https://discord.com/developers/docs/topics/gateway#channel-delete
*/
export type GatewayChannelModifyDispatchData = APIChannel;
/**
* https://discord.com/developers/docs/topics/gateway#channel-create
*/
export type GatewayChannelCreateDispatch = GatewayChannelModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#channel-create
*/
export type GatewayChannelCreateDispatchData = GatewayChannelModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#channel-update
*/
export type GatewayChannelUpdateDispatch = GatewayChannelModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#channel-update
*/
export type GatewayChannelUpdateDispatchData = GatewayChannelModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#channel-delete
*/
export type GatewayChannelDeleteDispatch = GatewayChannelModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#channel-delete
*/
export type GatewayChannelDeleteDispatchData = GatewayChannelModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#channel-pins-update
*/
export type GatewayChannelPinsUpdateDispatch = DataPayload<
GatewayDispatchEvents.ChannelPinsUpdate,
GatewayChannelPinsUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#channel-pins-update
*/
export interface GatewayChannelPinsUpdateDispatchData {
/**
* The id of the guild
*/
guild_id?: Snowflake;
/**
* The id of the channel
*/
channel_id: Snowflake;
/**
* The time at which the most recent pinned message was pinned
*/
last_pin_timestamp?: string | null;
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-create
* https://discord.com/developers/docs/topics/gateway#guild-update
*/
export type GatewayGuildModifyDispatch = DataPayload<
GatewayDispatchEvents.GuildCreate | GatewayDispatchEvents.GuildUpdate,
GatewayGuildModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-create
* https://discord.com/developers/docs/topics/gateway#guild-update
*/
export type GatewayGuildModifyDispatchData = APIGuild;
/**
* https://discord.com/developers/docs/topics/gateway#guild-create
*/
export type GatewayGuildCreateDispatch = GatewayGuildModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#guild-create
*/
export type GatewayGuildCreateDispatchData = GatewayGuildModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#guild-update
*/
export type GatewayGuildUpdateDispatch = GatewayGuildModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#guild-update
*/
export type GatewayGuildUpdateDispatchData = GatewayGuildModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#guild-delete
*/
export type GatewayGuildDeleteDispatch = DataPayload<GatewayDispatchEvents.GuildDelete, GatewayGuildDeleteDispatchData>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-delete
*/
export type GatewayGuildDeleteDispatchData = APIUnavailableGuild;
/**
* https://discord.com/developers/docs/topics/gateway#guild-ban-add
* https://discord.com/developers/docs/topics/gateway#guild-ban-remove
*/
export type GatewayGuildBanModifyDispatch = DataPayload<
GatewayDispatchEvents.GuildBanAdd | GatewayDispatchEvents.GuildBanRemove,
GatewayGuildBanModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-ban-add
* https://discord.com/developers/docs/topics/gateway#guild-ban-remove
*/
export interface GatewayGuildBanModifyDispatchData {
/**
* ID of the guild
*/
guild_id: Snowflake;
/**
* The banned user
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
user: APIUser;
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-ban-add
*/
export type GatewayGuildBanAddDispatch = GatewayGuildBanModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#guild-ban-add
*/
export type GatewayGuildBanAddDispatchData = GatewayGuildBanModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#guild-ban-remove
*/
export type GatewayGuildBanRemoveDispatch = GatewayGuildBanModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#guild-ban-remove
*/
export type GatewayGuildBanRemoveDispatchData = GatewayGuildBanModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#guild-emojis-update
*/
export type GatewayGuildEmojisUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildEmojisUpdate,
GatewayGuildEmojisUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-emojis-update
*/
export interface GatewayGuildEmojisUpdateDispatchData {
/**
* ID of the guild
*/
guild_id: Snowflake;
/**
* Array of emojis
*
* See https://discord.com/developers/docs/resources/emoji#emoji-object
*/
emojis: APIEmoji[];
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-integrations-update
*/
export type GatewayGuildIntegrationsUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildIntegrationsUpdate,
GatewayGuildIntegrationsUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-integrations-update
*/
export interface GatewayGuildIntegrationsUpdateDispatchData {
/**
* ID of the guild whose integrations were updated
*/
guild_id: Snowflake;
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-add
*/
export type GatewayGuildMemberAddDispatch = DataPayload<
GatewayDispatchEvents.GuildMemberAdd,
GatewayGuildMemberAddDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-add
*/
export interface GatewayGuildMemberAddDispatchData extends APIGuildMember {
/**
* The id of the guild
*/
guild_id: Snowflake;
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-remove
*/
export type GatewayGuildMemberRemoveDispatch = DataPayload<
GatewayDispatchEvents.GuildMemberRemove,
GatewayGuildMemberRemoveDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-remove
*/
export interface GatewayGuildMemberRemoveDispatchData {
/**
* The id of the guild
*/
guild_id: Snowflake;
/**
* The user who was removed
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
user: APIUser;
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-update
*/
export type GatewayGuildMemberUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildMemberUpdate,
GatewayGuildMemberUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-update
*/
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user'> &
Partial<Pick<APIGuildMember, 'deaf' | 'mute'>> &
Required<Pick<APIGuildMember, 'user'>> & {
/**
* The id of the guild
*/
guild_id: Snowflake;
};
/**
* https://discord.com/developers/docs/topics/gateway#guild-members-chunk
*/
export type GatewayGuildMembersChunkDispatch = DataPayload<
GatewayDispatchEvents.GuildMembersChunk,
GatewayGuildMembersChunkDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-members-chunk
*/
export interface GatewayGuildMembersChunkDispatchData {
/**
* The id of the guild
*/
guild_id: Snowflake;
/**
* Set of guild members
*
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
members: APIGuildMember[];
/**
* The chunk index in the expected chunks for this response (`0 <= chunk_index < chunk_count`)
*/
chunk_index?: number;
/**
* The total number of expected chunks for this response
*/
chunk_count?: number;
/**
* If passing an invalid id to `REQUEST_GUILD_MEMBERS`, it will be returned here
*/
not_found?: unknown[];
/**
* If passing true to `REQUEST_GUILD_MEMBERS`, presences of the returned members will be here
*
* See https://discord.com/developers/docs/topics/gateway#presence
*/
presences?: RawGatewayPresenceUpdate[];
/**
* The nonce used in the Guild Members Request
*
* See https://discord.com/developers/docs/topics/gateway#request-guild-members
*/
nonce?: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-role-create
* https://discord.com/developers/docs/topics/gateway#guild-role-update
*/
export type GatewayGuildRoleModifyDispatch = DataPayload<
GatewayDispatchEvents.GuildRoleCreate | GatewayDispatchEvents.GuildRoleUpdate,
GatewayGuildRoleModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-role-create
* https://discord.com/developers/docs/topics/gateway#guild-role-update
*/
export interface GatewayGuildRoleModifyDispatchData {
/**
* The id of the guild
*/
guild_id: Snowflake;
/**
* The role created or updated
*
* See https://discord.com/developers/docs/topics/permissions#role-object
*/
role: APIRole;
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-role-create
*/
export type GatewayGuildRoleCreateDispatch = GatewayGuildRoleModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#guild-role-create
*/
export type GatewayGuildRoleCreateDispatchData = GatewayGuildRoleModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#guild-role-update
*/
export type GatewayGuildRoleUpdateDispatch = GatewayGuildRoleModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#guild-role-update
*/
export type GatewayGuildRoleUpdateDispatchData = GatewayGuildRoleModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#guild-role-delete
*/
export type GatewayGuildRoleDeleteDispatch = DataPayload<
GatewayDispatchEvents.GuildRoleDelete,
GatewayGuildRoleDeleteDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-role-delete
*/
export interface GatewayGuildRoleDeleteDispatchData {
/**
* The id of the guild
*/
guild_id: Snowflake;
/**
* The id of the role
*/
role_id: Snowflake;
}
/**
* https://discord.com/developers/docs/topics/gateway#integration-create
*/
export type GatewayIntegrationCreateDispatch = DataPayload<
GatewayDispatchEvents.IntegrationCreate,
GatewayIntegrationCreateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#integration-create
*/
export type GatewayIntegrationCreateDispatchData = APIGuildIntegration & { guild_id: Snowflake };
/**
* https://discord.com/developers/docs/topics/gateway#integration-update
*/
export type GatewayIntegrationUpdateDispatch = DataPayload<
GatewayDispatchEvents.IntegrationUpdate,
GatewayIntegrationUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#integration-update
*/
export type GatewayIntegrationUpdateDispatchData = APIGuildIntegration & { guild_id: Snowflake };
/**
* https://discord.com/developers/docs/topics/gateway#integration-update
*/
export type GatewayIntegrationDeleteDispatch = DataPayload<
GatewayDispatchEvents.IntegrationDelete,
GatewayIntegrationDeleteDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#integration-delete
*/
export interface GatewayIntegrationDeleteDispatchData {
/**
* Integration id
*/
id: Snowflake;
/**
* ID of the guild
*/
guild_id: Snowflake;
/**
* ID of the bot/OAuth2 application for this Discord integration
*/
application_id?: Snowflake;
}
/**
* https://discord.com/developers/docs/topics/gateway#interaction-create
*/
export type GatewayInteractionCreateDispatch = DataPayload<
GatewayDispatchEvents.InteractionCreate,
GatewayInteractionCreateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#interaction-create
*/
export type GatewayInteractionCreateDispatchData = APIApplicationCommandInteraction;
/**
* https://discord.com/developers/docs/topics/gateway#invite-create
*/
export type GatewayInviteCreateDispatch = DataPayload<
GatewayDispatchEvents.InviteCreate,
GatewayInviteCreateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#invite-create
*/
export interface GatewayInviteCreateDispatchData {
/**
* The channel the invite is for
*/
channel_id: Snowflake;
/**
* The unique invite code
*
* See https://discord.com/developers/docs/resources/invite#invite-object
*/
code: string;
/**
* The time at which the invite was created
*/
created_at: number;
/**
* The guild of the invite
*/
guild_id?: Snowflake;
/**
* The user that created the invite
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
inviter?: APIUser;
/**
* How long the invite is valid for (in seconds)
*/
max_age: number;
/**
* The maximum number of times the invite can be used
*/
max_uses: number;
/**
* The type of user target for this voice channel invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
*/
target_type?: InviteTargetUserType;
/**
* The user whose stream to display for this voice channel stream invite
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
target_user?: APIUser;
/**
* The embedded application to open for this voice channel embedded application invite
*/
target_application?: Partial<APIApplication>;
/**
* Whether or not the invite is temporary (invited users will be kicked on disconnect unless they're assigned a role)
*/
temporary: boolean;
/**
* How many times the invite has been used (always will be `0`)
*/
uses: 0;
}
/**
* https://discord.com/developers/docs/topics/gateway#invite-delete
*/
export type GatewayInviteDeleteDispatch = DataPayload<
GatewayDispatchEvents.InviteDelete,
GatewayInviteDeleteDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#invite-delete
*/
export interface GatewayInviteDeleteDispatchData {
/**
* The channel of the invite
*/
channel_id: Snowflake;
/**
* The guild of the invite
*/
guild_id?: Snowflake;
/**
* The unique invite code
*
* See https://discord.com/developers/docs/resources/invite#invite-object
*/
code: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#message-create
*/
export type GatewayMessageCreateDispatch = DataPayload<
GatewayDispatchEvents.MessageCreate,
GatewayMessageCreateDispatchData
>;
/**