-
-
Notifications
You must be signed in to change notification settings - Fork 99
/
shared.ts
1523 lines (1443 loc) · 53.6 KB
/
shared.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
export type BigString = bigint | string;
export enum PresenceStatus {
online,
dnd,
idle,
offline,
}
/* https://discord.com/developers/docs/resources/channel#message-object-message-flags */
export enum ApplicationCommandFlags {
/** Do not include any embeds when serialising this message */
SuppressEmbeds = 1 << 2,
/** Only visible to the user who invoked the interaction */
Ephemeral = 1 << 6,
}
/** https://discord.com/developers/docs/resources/user#user-object-premium-types */
export enum PremiumTypes {
None,
NitroClassic,
Nitro,
NitroBasic,
}
/** https://discord.com/developers/docs/resources/user#user-object-user-flags */
export enum UserFlags {
DiscordEmployee = 1 << 0,
PartneredServerOwner = 1 << 1,
HypeSquadEventsMember = 1 << 2,
BugHunterLevel1 = 1 << 3,
HouseBravery = 1 << 6,
HouseBrilliance = 1 << 7,
HouseBalance = 1 << 8,
EarlySupporter = 1 << 9,
TeamUser = 1 << 10,
BugHunterLevel2 = 1 << 14,
VerifiedBot = 1 << 16,
EarlyVerifiedBotDeveloper = 1 << 17,
DiscordCertifiedModerator = 1 << 18,
BotHttpInteractions = 1 << 19,
}
/** https://discord.com/developers/docs/resources/channel#channels-resource */
export enum ChannelFlags {
None,
/** this thread is pinned to the top of its parent `GUILD_FORUM` channel */
Pinned = 1 << 1,
/** Whether a tag is required to be specified when creating a thread in a `GUILD_FORUM` channel. Tags are specified in the `applied_tags` field. */
RequireTag,
}
/** https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors */
export enum IntegrationExpireBehaviors {
RemoveRole,
Kick,
}
/** https://discord.com/developers/docs/resources/user#connection-object-visibility-types */
export enum VisibilityTypes {
/** Invisible to everyone except the user themselves */
None,
/** Visible to everyone */
Everyone,
}
/** https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum */
export enum TeamMembershipStates {
Invited = 1,
Accepted,
}
/** https://discord.com/developers/docs/topics/oauth2#application-application-flags */
export enum ApplicationFlags {
/** Intent required for bots in **100 or more servers** to receive [`presence_update` events](#DOCS_TOPICS_GATEWAY/presence-update) */
GatewayPresence = 1 << 12,
/** Intent required for bots in under 100 servers to receive [`presence_update` events](#DOCS_TOPICS_GATEWAY/presence-update), found in Bot Settings */
GatewayPresenceLimited = 1 << 13,
/** Intent required for bots in **100 or more servers** to receive member-related events like `guild_member_add`. See list of member-related events [under `GUILD_MEMBERS`](#DOCS_TOPICS_GATEWAY/list-of-intents) */
GatewayGuildMembers = 1 << 14,
/** Intent required for bots in under 100 servers to receive member-related events like `guild_member_add`, found in Bot Settings. See list of member-related events [under `GUILD_MEMBERS`](#DOCS_TOPICS_GATEWAY/list-of-intents) */
GatewayGuildMembersLimited = 1 << 15,
/** Indicates unusual growth of an app that prevents verification */
VerificationPendingGuildLimit = 1 << 16,
/** Indicates if an app is embedded within the Discord client (currently unavailable publicly) */
Embedded = 1 << 17,
/** Intent required for bots in **100 or more servers** to receive [message content](https://support-dev.discord.com/hc/en-us/articles/4404772028055) */
GatewayMessageContent = 1 << 18,
/** Intent required for bots in under 100 servers to receive [message content](https://support-dev.discord.com/hc/en-us/articles/4404772028055), found in Bot Settings */
GatewayMessageContentLimited = 1 << 19,
/** Indicates if an app has registered global application commands */
ApplicationCommandBadge = 1 << 23,
}
/** https://discord.com/developers/docs/interactions/message-components#component-types */
export enum MessageComponentTypes {
/** A container for other components */
ActionRow = 1,
/** A button object */
Button,
/** A select menu for picking from choices */
SelectMenu,
/** A text input object */
InputText,
/** Select menu for users */
SelectMenuUsers,
/** Select menu for roles */
SelectMenuRoles,
/** Select menu for users and roles */
SelectMenuUsersAndRoles,
/** Select menu for channels */
SelectMenuChannels,
}
export enum TextStyles {
/** Intended for short single-line text */
Short = 1,
/** Intended for much longer inputs */
Paragraph = 2,
}
/** https://discord.com/developers/docs/interactions/message-components#buttons-button-styles */
export enum ButtonStyles {
/** A blurple button */
Primary = 1,
/** A grey button */
Secondary,
/** A green button */
Success,
/** A red button */
Danger,
/** A button that navigates to a URL */
Link,
}
/** https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types */
export enum AllowedMentionsTypes {
/** Controls role mentions */
RoleMentions = "roles",
/** Controls user mentions */
UserMentions = "users",
/** Controls @everyone and @here mentions */
EveryoneMentions = "everyone",
}
/** https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types */
export enum WebhookTypes {
/** Incoming Webhooks can post messages to channels with a generated token */
Incoming = 1,
/** Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels */
ChannelFollower,
/** Application webhooks are webhooks used with Interactions */
Application,
}
/** https://discord.com/developers/docs/resources/channel#embed-object-embed-types */
export type EmbedTypes = "rich" | "image" | "video" | "gifv" | "article" | "link";
/** https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level */
export enum DefaultMessageNotificationLevels {
/** Members will receive notifications for all messages by default */
AllMessages,
/** Members will receive notifications only for messages that @mention them by default */
OnlyMentions,
}
/** https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level */
export enum ExplicitContentFilterLevels {
/** Media content will not be scanned */
Disabled,
/** Media content sent by members without roles will be scanned */
MembersWithoutRoles,
/** Media content sent by all members will be scanned */
AllMembers,
}
/** https://discord.com/developers/docs/resources/guild#guild-object-verification-level */
export enum VerificationLevels {
/** Unrestricted */
None,
/** Must have verified email on account */
Low,
/** Must be registered on Discord for longer than 5 minutes */
Medium,
/** Must be a member of the server for longer than 10 minutes */
High,
/** Must have a verified phone number */
VeryHigh,
}
/** https://discord.com/developers/docs/topics/permissions#role-object-role-structure */
export interface BaseRole {
/** Role name */
name: string;
/** Integer representation of hexadecimal color code */
color: number;
/** Position of this role */
position: number;
/** role unicode emoji */
unicodeEmoji?: string;
}
/** https://discord.com/developers/docs/resources/guild#guild-object-guild-features */
export enum GuildFeatures {
/** Guild has access to set an invite splash background */
InviteSplash = "INVITE_SPLASH",
/** Guild has access to set 384 kbps bitrate in voice (previously VIP voice servers) */
VipRegions = "VIP_REGIONS",
/** Guild has access to set a vanity URL */
VanityUrl = "VANITY_URL",
/** Guild is verified */
Verified = "VERIFIED",
/** Guild is partnered */
Partnered = "PARTNERED",
/** Guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates */
Community = "COMMUNITY",
/** Guild has been set as a support server on the App Directory */
DeveloperSupportServer = "DEVELOPER_SUPPORT_SERVER",
/** Guild has access to create news channels */
News = "NEWS",
/** Guild is able to be discovered in the directory */
Discoverable = "DISCOVERABLE",
/** Guild is able to be featured in the directory */
Featurable = "FEATURABLE",
/** Guild has access to set an animated guild icon */
AnimatedIcon = "ANIMATED_ICON",
/** Guild has access to set a guild banner image */
Banner = "BANNER",
/** Guild has enabled the welcome screen */
WelcomeScreenEnabled = "WELCOME_SCREEN_ENABLED",
/** Guild has enabled [Membership Screening](https://discord.com/developers/docs/resources/guild#membership-screening-object) */
MemberVerificationGateEnabled = "MEMBER_VERIFICATION_GATE_ENABLED",
/** Guild can be previewed before joining via Membership Screening or the directory */
PreviewEnabled = "PREVIEW_ENABLED",
/** Guild has enabled ticketed events */
TicketedEventsEnabled = "TICKETED_EVENTS_ENABLED",
/** Guild has enabled monetization */
MonetizationEnabled = "MONETIZATION_ENABLED",
/** Guild has increased custom sticker slots */
MoreStickers = "MORE_STICKERS",
/** Guild has access to create private threads */
PrivateThreads = "PRIVATE_THREADS",
/** Guild is able to set role icons */
RoleIcons = "ROLE_ICONS",
/** Guild has set up auto moderation rules */
AutoModeration = "AUTO_MODERATION",
/** Guild has paused invites, preventing new users from joining */
InvitesDisabled = "INVITES_DISABLED",
/** Guild has access to set an animated guild banner image */
AnimatedBanner = "ANIMATED_BANNER",
}
/** https://discord.com/developers/docs/resources/guild#guild-object-mfa-level */
export enum MfaLevels {
/** Guild has no MFA/2FA requirement for moderation actions */
None,
/** Guild has a 2FA requirement for moderation actions */
Elevated,
}
/** https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags */
export enum SystemChannelFlags {
/** Suppress member join notifications */
SuppressJoinNotifications = 1 << 0,
/** Suppress server boost notifications */
SuppressPremiumSubscriptions = 1 << 1,
/** Suppress server setup tips */
SuppressGuildReminderNotifications = 1 << 2,
/** Hide member join sticker reply buttons */
SuppressJoinNotificationReplies = 1 << 3,
}
/** https://discord.com/developers/docs/resources/guild#guild-object-premium-tier */
export enum PremiumTiers {
/** Guild has not unlocked any Server Boost perks */
None,
/** Guild has unlocked Server Boost level 1 perks */
Tier1,
/** Guild has unlocked Server Boost level 2 perks */
Tier2,
/** Guild has unlocked Server Boost level 3 perks */
Tier3,
}
/** https://discord.com/developers/docs/resources/guild#guild-object-guild-nsfw-level */
export enum GuildNsfwLevel {
Default,
Explicit,
Safe,
AgeRestricted,
}
/** https://discord.com/developers/docs/resources/channel#channel-object-channel-types */
export enum ChannelTypes {
/** A text channel within a server */
GuildText,
/** A direct message between users */
DM,
/** A voice channel within a server */
GuildVoice,
/** A direct message between multiple users */
GroupDm,
/** An organizational category that contains up to 50 channels */
GuildCategory,
/** A channel that users can follow and crosspost into their own server */
GuildAnnouncement,
/** A temporary sub-channel within a GUILD_ANNOUNCEMENT channel */
AnnouncementThread = 10,
/** A temporary sub-channel within a GUILD_TEXT or GUILD_FORUM channel */
PublicThread,
/** A temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission */
PrivateThread,
/** A voice channel for hosting events with an audience */
GuildStageVoice,
/** A channel in a hub containing the listed servers */
GuildDirectory,
/** A channel which can only contains threads */
GuildForum,
}
export enum OverwriteTypes {
Role,
Member,
}
export enum VideoQualityModes {
/** Discord chooses the quality for optimal performance */
Auto = 1,
/** 720p */
Full,
}
/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-types */
export enum ActivityTypes {
Game,
Streaming,
Listening,
Watching,
Custom = 4,
Competing,
}
/** https://discord.com/developers/docs/resources/channel#message-object-message-types */
export enum MessageTypes {
Default,
RecipientAdd,
RecipientRemove,
Call,
ChannelNameChange,
ChannelIconChange,
ChannelPinnedMessage,
UserJoin,
GuildBoost,
GuildBoostTier1,
GuildBoostTier2,
GuildBoostTier3,
ChannelFollowAdd,
GuildDiscoveryDisqualified = 14,
GuildDiscoveryRequalified,
GuildDiscoveryGracePeriodInitialWarning,
GuildDiscoveryGracePeriodFinalWarning,
ThreadCreated,
Reply,
ChatInputCommand,
ThreadStarterMessage,
GuildInviteReminder,
ContextMenuCommand,
AutoModerationAction,
}
/** https://discord.com/developers/docs/resources/channel#message-object-message-activity-types */
export enum MessageActivityTypes {
Join = 1,
Spectate,
Listen,
JoinRequest,
}
/** https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types */
export enum StickerTypes {
/** an official sticker in a pack, part of Nitro or in a removed purchasable pack */
Standard = 1,
/** a sticker uploaded to a Boosted guild for the guild's members */
Guild,
}
/** https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types */
export enum StickerFormatTypes {
Png = 1,
APng,
Lottie,
}
/** https://discord.com/developers/docs/interactions/slash-commands#interaction-interactiontype */
export enum InteractionTypes {
Ping = 1,
ApplicationCommand = 2,
MessageComponent = 3,
ApplicationCommandAutocomplete = 4,
ModalSubmit = 5,
}
/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptiontype */
export enum ApplicationCommandOptionTypes {
SubCommand = 1,
SubCommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
Number,
Attachment,
}
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events */
export enum AuditLogEvents {
/** Server settings were updated */
GuildUpdate = 1,
/** Channel was created */
ChannelCreate = 10,
/** Channel settings were updated */
ChannelUpdate,
/** Channel was deleted */
ChannelDelete,
/** Permission overwrite was added to a channel */
ChannelOverwriteCreate,
/** Permission overwrite was updated for a channel */
ChannelOverwriteUpdate,
/** Permission overwrite was deleted from a channel */
ChannelOverwriteDelete,
/** Member was removed from server */
MemberKick = 20,
/** Members were pruned from server */
MemberPrune,
/** Member was banned from server */
MemberBanAdd,
/** Server ban was lifted for a member */
MemberBanRemove,
/** Member was updated in server */
MemberUpdate,
/** Member was added or removed from a role */
MemberRoleUpdate,
/** Member was moved to a different voice channel */
MemberMove,
/** Member was disconnected from a voice channel */
MemberDisconnect,
/** Bot user was added to server */
BotAdd,
/** Role was created */
RoleCreate = 30,
/** Role was edited */
RoleUpdate,
/** Role was deleted */
RoleDelete,
/** Server invite was created */
InviteCreate = 40,
/** Server invite was updated */
InviteUpdate,
/** Server invite was deleted */
InviteDelete,
/** Webhook was created */
WebhookCreate = 50,
/** Webhook properties or channel were updated */
WebhookUpdate,
/** Webhook was deleted */
WebhookDelete,
/** Emoji was created */
EmojiCreate = 60,
/** Emoji name was updated */
EmojiUpdate,
/** Emoji was deleted */
EmojiDelete,
/** Single message was deleted */
MessageDelete = 72,
/** Multiple messages were deleted */
MessageBulkDelete,
/** Messaged was pinned to a channel */
MessagePin,
/** Message was unpinned from a channel */
MessageUnpin,
/** App was added to server */
IntegrationCreate = 80,
/** App was updated (as an example, its scopes were updated) */
IntegrationUpdate,
/** App was removed from server */
IntegrationDelete,
/** Stage instance was created (stage channel becomes live) */
StageInstanceCreate,
/** Stage instace details were updated */
StageInstanceUpdate,
/** Stage instance was deleted (stage channel no longer live) */
StageInstanceDelete,
/** Sticker was created */
StickerCreate = 90,
/** Sticker details were updated */
StickerUpdate,
/** Sticker was deleted */
StickerDelete,
/** Event was created */
GuildScheduledEventCreate = 100,
/** Event was updated */
GuildScheduledEventUpdate,
/** Event was cancelled */
GuildScheduledEventDelete,
/** Thread was created in a channel */
ThreadCreate = 110,
/** Thread was updated */
ThreadUpdate,
/** Thread was deleted */
ThreadDelete,
/** Permissions were updated for a command */
ApplicationCommandPermissionUpdate = 121,
/** Auto moderation rule was created */
AutoModerationRuleCreate = 140,
/** Auto moderation rule was updated */
AutoModerationRuleUpdate,
/** Auto moderation rule was deleted */
AutoModerationRuleDelete,
/** Message was blocked by AutoMod according to a rule. */
AutoModerationBlockMessage,
}
export enum ScheduledEventPrivacyLevel {
/** the scheduled event is public and available in discovery. DISCORD DEVS DISABLED THIS! WILL ERROR IF USED! */
// Public = 1,
/** the scheduled event is only accessible to guild members */
GuildOnly = 2,
}
export enum ScheduledEventEntityType {
StageInstance = 1,
Voice,
External,
}
export enum ScheduledEventStatus {
Scheduled = 1,
Active,
Completed,
Canceled,
}
/** https://discord.com/developers/docs/resources/invite#invite-object-target-user-types */
export enum TargetTypes {
Stream = 1,
EmbeddedApplication,
}
export enum ApplicationCommandTypes {
/** A text-based command that shows up when a user types `/` */
ChatInput = 1,
/** A UI-based command that shows up when you right click or tap on a user */
User,
/** A UI-based command that shows up when you right click or tap on a message */
Message,
}
export enum ApplicationCommandPermissionTypes {
Role = 1,
User,
Channel,
}
/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-flags */
export enum ActivityFlags {
Instance = 1 << 0,
Join = 1 << 1,
Spectate = 1 << 2,
JoinRequest = 1 << 3,
Sync = 1 << 4,
Play = 1 << 5,
PartyPrivacyFriends = 1 << 6,
PartyPrivacyVoiceChannel = 1 << 7,
Embedded = 1 << 8,
}
/** https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags */
export enum BitwisePermissionFlags {
/** Allows creation of instant invites */
CREATE_INSTANT_INVITE = 0x0000000000000001,
/** Allows kicking members */
KICK_MEMBERS = 0x0000000000000002,
/** Allows banning members */
BAN_MEMBERS = 0x0000000000000004,
/** Allows all permissions and bypasses channel permission overwrites */
ADMINISTRATOR = 0x0000000000000008,
/** Allows management and editing of channels */
MANAGE_CHANNELS = 0x0000000000000010,
/** Allows management and editing of the guild */
MANAGE_GUILD = 0x0000000000000020,
/** Allows for the addition of reactions to messages */
ADD_REACTIONS = 0x0000000000000040,
/** Allows for viewing of audit logs */
VIEW_AUDIT_LOG = 0x0000000000000080,
/** Allows for using priority speaker in a voice channel */
PRIORITY_SPEAKER = 0x0000000000000100,
/** Allows the user to go live */
STREAM = 0x0000000000000200,
/** Allows guild members to view a channel, which includes reading messages in text channels and joining voice channels */
VIEW_CHANNEL = 0x0000000000000400,
/** Allows for sending messages in a channel. (does not allow sending messages in threads) */
SEND_MESSAGES = 0x0000000000000800,
/** Allows for sending of /tts messages */
SEND_TTS_MESSAGES = 0x0000000000001000,
/** Allows for deletion of other users messages */
MANAGE_MESSAGES = 0x0000000000002000,
/** Links sent by users with this permission will be auto-embedded */
EMBED_LINKS = 0x0000000000004000,
/** Allows for uploading images and files */
ATTACH_FILES = 0x0000000000008000,
/** Allows for reading of message history */
READ_MESSAGE_HISTORY = 0x0000000000010000,
/** Allows for using the @everyone tag to notify all users in a channel, and the @here tag to notify all online users in a channel */
MENTION_EVERYONE = 0x0000000000020000,
/** Allows the usage of custom emojis from other servers */
USE_EXTERNAL_EMOJIS = 0x0000000000040000,
/** Allows for viewing guild insights */
VIEW_GUILD_INSIGHTS = 0x0000000000080000,
/** Allows for joining of a voice channel */
CONNECT = 0x0000000000100000,
/** Allows for speaking in a voice channel */
SPEAK = 0x0000000000200000,
/** Allows for muting members in a voice channel */
MUTE_MEMBERS = 0x0000000000400000,
/** Allows for deafening of members in a voice channel */
DEAFEN_MEMBERS = 0x0000000000800000,
/** Allows for moving of members between voice channels */
MOVE_MEMBERS = 0x0000000001000000,
/** Allows for using voice-activity-detection in a voice channel */
USE_VAD = 0x0000000002000000,
/** Allows for modification of own nickname */
CHANGE_NICKNAME = 0x0000000004000000,
/** Allows for modification of other users nicknames */
MANAGE_NICKNAMES = 0x0000000008000000,
/** Allows management and editing of roles */
MANAGE_ROLES = 0x0000000010000000,
/** Allows management and editing of webhooks */
MANAGE_WEBHOOKS = 0x0000000020000000,
/** Allows management and editing of emojis and stickers */
MANAGE_EMOJIS_AND_STICKERS = 0x0000000040000000,
/** Allows members to use application commands in text channels */
USE_SLASH_COMMANDS = 0x0000000080000000,
/** Allows for requesting to speak in stage channels. */
REQUEST_TO_SPEAK = 0x0000000100000000,
/** Allows for creating, editing, and deleting scheduled events */
MANAGE_EVENTS = 0x0000000200000000,
/** Allows for deleting and archiving threads, and viewing all private threads */
MANAGE_THREADS = 0x0000000400000000,
/** Allows for creating public and announcement threads */
CREATE_PUBLIC_THREADS = 0x0000000800000000,
/** Allows for creating private threads */
CREATE_PRIVATE_THREADS = 0x0000001000000000,
/** Allows the usage of custom stickers from other servers */
USE_EXTERNAL_STICKERS = 0x0000002000000000,
/** Allows for sending messages in threads */
SEND_MESSAGES_IN_THREADS = 0x0000004000000000,
/** Allows for launching activities (applications with the `EMBEDDED` flag) in a voice channel. */
USE_EMBEDDED_ACTIVITIES = 0x0000008000000000,
/** Allows for timing out users to prevent them from sending or reacting to messages in chat and threads, and from speaking in voice and stage channels */
MODERATE_MEMBERS = 0x0000010000000000,
}
export type PermissionStrings = keyof typeof BitwisePermissionFlags;
/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice */
export enum VoiceOpcodes {
/** Begin a voice websocket connection. */
Identify,
/** Select the voice protocol. */
SelectProtocol,
/** Complete the websocket handshake. */
Ready,
/** Keep the websocket connection alive. */
Heartbeat,
/** Describe the session. */
SessionDescription,
/** Indicate which users are speaking. */
Speaking,
/** Sent to acknowledge a received client heartbeat. */
HeartbeatACK,
/** Resume a connection. */
Resume,
/** Time to wait between sending heartbeats in milliseconds. */
Hello,
/** Acknowledge a successful session resume. */
Resumed,
/** A client has disconnected from the voice channel */
ClientDisconnect = 13,
}
/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice */
export enum VoiceCloseEventCodes {
/** You sent an invalid [opcode](https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-opcodes). */
UnknownOpcode = 4001,
/** You sent a invalid payload in your [identifying](https://discord.com/developers/docs/topics/gateway#identify) to the Gateway. */
FailedToDecodePayload,
/** You sent a payload before [identifying](https://discord.com/developers/docs/topics/gateway#identify) with the Gateway. */
NotAuthenticated,
/** The token you sent in your [identify](https://discord.com/developers/docs/topics/gateway#identify) payload is incorrect. */
AuthenticationFailed,
/** You sent more than one [identify](https://discord.com/developers/docs/topics/gateway#identify) payload. Stahp. */
AlreadyAuthenticated,
/** Your session is no longer valid. */
SessionNoLongerValid,
/** Your session has timed out. */
SessionTimedOut = 4009,
/** We can't find the server you're trying to connect to. */
ServerNotFound = 4011,
/** We didn't recognize the [protocol](https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection-example-select-protocol-payload) you sent. */
UnknownProtocol,
/** Channel was deleted, you were kicked, voice server changed, or the main gateway session was dropped. Should not reconnect. */
Disconnect = 4014,
/** The server crashed. Our bad! Try [resuming](https://discord.com/developers/docs/topics/voice-connections#resuming-voice-connection). */
VoiceServerCrashed,
/** We didn't recognize your [encryption](https://discord.com/developers/docs/topics/voice-connections#encrypting-and-sending-voice). */
UnknownEncryptionMode,
}
/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc */
export enum RpcErrorCodes {
/** An unknown error occurred. */
UnknownError = 1000,
/** You sent an invalid payload. */
InvalidPayload = 4000,
/** Invalid command name specified. */
InvalidCommand = 4002,
/** Invalid guild ID specified. */
InvalidGuild,
/** Invalid event name specified. */
InvalidEvent,
/** Invalid channel ID specified. */
InvalidChannel,
/** You lack permissions to access the given resource. */
InvalidPermissions,
/** An invalid OAuth2 application ID was used to authorize or authenticate with. */
InvalidClientId,
/** An invalid OAuth2 application origin was used to authorize or authenticate with. */
InvalidOrigin,
/** An invalid OAuth2 token was used to authorize or authenticate with. */
InvalidToken,
/** The specified user ID was invalid. */
InvalidUser,
/** A standard OAuth2 error occurred; check the data object for the OAuth2 error details. */
OAuth2Error = 5000,
/** An asynchronous `SELECT_TEXT_CHANNEL`/`SELECT_VOICE_CHANNEL` command timed out. */
SelectChannelTimedOut,
/** An asynchronous `GET_GUILD` command timed out. */
GetGuildTimedOut,
/** You tried to join a user to a voice channel but the user was already in one. */
SelectVoiceForceRequired,
/** You tried to capture more than one shortcut key at once. */
CaptureShortcutAlreadyListening,
}
/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc */
export enum RpcCloseEventCodes {
/** You connected to the RPC server with an invalid client ID. */
InvalidClientId = 4000,
/** You connected to the RPC server with an invalid origin. */
InvalidOrigin,
/** You are being rate limited. */
RateLimited,
/** The OAuth2 token associated with a connection was revoked, get a new one! */
TokenRevoked,
/** The RPC Server version specified in the connection string was not valid. */
InvalidVersion,
/** The encoding specified in the connection string was not valid. */
InvalidEncoding,
}
/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#json */
export enum JsonErrorCodes {
/** General error (such as a malformed request body, amongst other things) */
GeneralError,
UnknownAccount = 10001,
UnknownApplication,
UnknownChannel,
UnknownGuild,
UnknownIntegration,
UnknownInvite,
UnknownMember,
UnknownMessage,
UnknownPermissionOverwrite,
UnknownProvider,
UnknownRole,
UnknownToken,
UnknownUser,
UnknownEmoji,
UnknownWebhook,
UnknownWebhookService,
UnknownSession = 10020,
UnknownBan = 10026,
UnknownSKU,
UnknownStoreListing,
UnknownEntitlement,
UnknownBuild,
UnknownLobby,
UnknownBranch,
UnknownStoreDirectoryLayout,
UnknownRedistributable = 10036,
UnknownGiftCode = 10038,
UnknownStream = 10049,
UnknownPremiumServerSubscribeCooldown,
UnknownGuildTemplate = 10057,
UnknownDiscoveryCategory = 10059,
UnknownSticker,
UnknownInteraction = 10062,
UnknownApplicationCommand = 10063,
UnknownVoiceState = 10065,
UnknownApplicationCommandPermissions,
UnknownStageInstance,
UnknownGuildMemberVerificationForm,
UnknownGuildWelcomeScreen,
UnknownGuildScheduledEvent,
UnknownGuildScheduledEventUser,
UnknownTag = 10087,
BotsCannotUseThisEndpoint = 20001,
OnlyBotsCanUseThisEndpoint,
ExplicitContentCannotBeSentToTheDesiredRecipient = 20009,
YouAreNotAuthorizedToPerformThisActionOnThisApplication = 20012,
ThisActionCannotBePerformedDueToSlowmodeRateLimit = 20016,
OnlyTheOwnerOfThisAccountCanPerformThisAction = 20018,
ThisMessageCannotBeEditedDueToAnnouncementRateLimits = 20022,
UnderMinimumAge = 20024,
TheChannelYouAreWritingHasHitTheWriteRateLimit = 20028,
TheWriteActionYouArePerformingOnTheServerHasHitTheWriteRateLimit,
YourStageTopicOrServerNameOrServerDescriptionOrChannelNamesContainsWordsThatAreNotAllowedForPublicStages = 20031,
GuildPremiumSubscriptionLevelTooLow = 20035,
MaximumNumberOfGuildsReached = 30001,
MaximumNumberOfFriendsReached,
MaximumNumberOfPinsReachedForTheChannel,
MaximumNumberOfRecipientsReached,
MaximumNumberOfGuildRolesReached,
MaximumNumberOfWebhooksReached = 30007,
MaximumNumberOfEmojisReached,
MaximumNumberOfReactionsReached = 30010,
MaximumNumberOfGuildChannelsReached = 30013,
MaximumNumberOfAttachmentsInAMessageReached = 30015,
MaximumNumberOfInvitesReached,
MaximumNumberOfAnimatedEmojisReached = 30018,
MaximumNumberOfServerMembersReached,
MaximumNumberOfServerCategoriesHasBeenReached = 30030,
GuildAlreadyHasTemplate,
MaximumNumbersOfApplicationCommandsReached,
MaxNumberOfThreadParticipantsHasBeenReached,
MaxNumberOfDailyApplicationCommandCreatesHasBeenReached,
MaximumNumberOfBansForNonGuildMembersHaveBeenExceeded,
MaximumNumberOfBansFetchesHasBeenReached = 30037,
MaximumNumberOfUncompletedGuildScheduledEventsReached = 30038,
MaximumNumberOfStickersReached = 30039,
MaximumNumberOfPruneRequestsHasBeenReachedTryAgainLater,
MaximumNumberOfGuildWidgetSettingsUpdatesHasBeenReachedTryAgainLater = 30042,
MaximumNumberOfEditsToMessagesOlderThan1HourReachedTryAgainLater = 30046,
MaximumNumberOfPinnedThreadsInAForumChannelHasBeenReached,
MaxiumNumberOfTagsInAForumChannelHasBeenReached,
BitrateIsTooHighForChannelOfThisType = 30052,
UnauthorizedProvideAValidTokenAndTryAgain = 40001,
YouNeedToVerifyYourAccountInOrderToPerformThisAction,
YouAreOpeningDirectMessagesTooFast,
SendMessagesHasBeenTemporarilyDisabled,
RequestEntityTooLargeTrySendingSomethingSmallerInSize,
ThisFeatureHasBeenTemporarilyDisabledServerSide,
ThisUserBannedFromThisGuild,
ConnectionHasBeenRevoked = 40012,
TargetUserIsNotConnectedToVoice = 40032,
ThisMessageHasAlreadyBeenCrossposted,
AnApplicationCommandWithThatNameAlreadyExists = 40041,
ApplicationInteractionFailedToSend = 40043,
InteractionHasAlreadyBeenAcknowledged = 40060,
MissingAccess = 50001,
InvalidAccountType,
CannotExecuteActionOnADMChannel,
GuildWidgetDisabled,
CannotEditMessageAuthoredByAnotherUser,
CannotSendAnEmptyMessage,
CannotSendMessagesToThisUser,
CannotSendMessagesInANonTextChannel,
ChannelVerificationLevelIsTooHighForYouToGainAccess,
OAuth2ApplicationDoesNotHaveABot,
OAuth2ApplicationLimitReached,
InvalidOAuth2State,
YouLackPermissionsToPerformThatAction,
InvalidAuthenticationTokenProvided,
NoteWasTooLong,
ProvidedTooFewOrTooManyMessagesToDeleteMustProvideAtLeast2AndFewerThan100MessagesToDelete,
InvalidMFALevel,
AMessageCanOnlyBePinnedInTheChannelItWasSentIn = 50019,
InviteCodeWasEitherInvalidOrTaken,
CannotExecuteActionOnASystemMessage,
CannotExecuteActionOnThisChannelType = 50024,
InvalidOAuth2AccessTokenProvided,
MissingRequiredOAuth2Scope,
InvalidWebhookTokenProvided,
InvalidRole,
InvalidRecipients = 50033,
AMessageProvidedWasTooOldToBulkDelete,
/** Invalid form body (returned for both `application/json` and `multipart/form-data` bodies), or invalid `Content-Type` provided */
InvalidFormBodyOrContentTypeProvided,
AnInviteWasAcceptedToAGuildTheApplicationsBotIsNotIn,
InvalidActivityAction = 50039,
InvalidApiVersionProvided = 50041,
FileUploadedExceedsTheMaximumSize = 50045,
InvalidFileUploaded,
CannotSelfRedeemThisGift = 50054,
InvalidGuild,
InvalidMessageType = 50068,
PaymentSourceRequiredToRedeemGift = 50070,
CannotDeleteAChannelRequiredForCommunityGuilds = 50074,
CannotEditStickersWithinAMessage = 50080,
InvalidStickerSent,
TriedToPerformAnOperationOnAnArchivedThreadSuchAsEditingAMessageOrAddingAUserToTheThread = 50083,
InvalidThreadNotificationSettings,
BeforeValueIsEarlierThanTheThreadCreationDate,
CommunityServerChannelsMustBeTextChannels,
ThisServerIsNotAvailableInYourLocation = 50095,
ThisServerNeedsMonetizationEnabledInOrderToPerformThisAction = 50097,
ThisServerNeedsMoreBoostsToPerformThisAction = 50101,
TheRequestBodyContainsInvalidJSON = 50109,
OwnershipCannotBeTransferredToABotUser = 50132,
FailedToResizeAssetBelowTheMaximumSize = 50138,
UploadedFileNotFound = 50146,
TwoFactorIsRequiredForThisOperation = 60003,
NoUsersWithDiscordTagExist = 80004,
ReactionWasBlocked = 90001,
ApplicationNotYetAvailable = 110001,
ApiResourceIsCurrentlyOverloadedTryAgainALittleLater = 130000,
TheStageIsAlreadyOpen = 150006,
CannotReplyWithoutPermissionToReadMessageHistory = 160002,
AThreadHasAlreadyBeenCreatedForThisMessage = 160004,
ThreadIsLocked = 160005,
MaximumNumberOfActiveThreadsReached = 160006,
MaximumNumberOfActiveAnnouncementThreadsReached = 160007,
InvalidJsonForUploadedLottieFile = 170001,
UploadedLottiesCannotContainRasterizedImagesSuchAsPngOrJpeg,
StickerMaximumFramerateExceeded,
StickerFrameCountExceedsMaximumOf1000Frames,
LottieAnimationMaximumDimensionsExceeded,
StickerFrameRateIsEitherTooSmallOrTooLarge,
StickerAnimationDurationExceedsMaximumOf5Seconds,
CannotUpdateAFinishedEvent = 180000,
FailedToCreateStageNeededForStageEvent = 180002,
MessageWasBlockedByAutomaticModeration = 200000,
TitleWasBlockedByAutomaticModeration,
WebhooksCanOnlyCreateThreadsInForumChannels = 220003,
}
/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#http */
export enum HTTPResponseCodes {
/** The request completed successfully. */
Ok = 200,
/** The entity was created successfully. */
Created,
/** The request completed successfully but returned no content. */
NoContent = 204,
/** The entity was not modified (no action was taken). */
NotModified = 304,
/** The request was improperly formatted, or the server couldn't understand it. */
BadRequest = 400,
/** The `Authorization` header was missing or invalid. */
Unauthorized,
/** The `Authorization` token you passed did not have permission to the resource. */
Forbidden = 403,
/** The resource at the location specified doesn't exist. */
NotFound,
/** The HTTP method used is not valid for the location specified. */
MethodNotAllowed,
/** You are being rate limited, see [Rate Limits](https://discord.com/developers/docs/topics/rate-limits). */
TooManyRequests = 429,
/** There was not a gateway available to process your request. Wait a bit and retry. */
GatewayUnavailable = 502,
}
/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#opcodes-and-status-codes */
export enum GatewayCloseEventCodes {
/** A normal closure of the gateway.
* You may attempt to reconnect.
*/
NormalClosure = 1000,
/** We're not sure what went wrong. Try reconnecting? */
UnknownError = 4000,
/** You sent an invalid [Gateway opcode](https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes) or an invalid payload for an opcode. Don't do that! */
UnknownOpcode,
/** You sent an invalid [payload](https://discord.com/developers/docs/topics/gateway#sending-payloads) to us. Don't do that! */
DecodeError,
/** You sent us a payload prior to [identifying](https://discord.com/developers/docs/topics/gateway#identify). */
NotAuthenticated,
/** The account token sent with your [identify payload](https://discord.com/developers/docs/topics/gateway#identify) is incorrect. */
AuthenticationFailed,
/** You sent more than one identify payload. Don't do that! */
AlreadyAuthenticated,
/** The sequence sent when [resuming](https://discord.com/developers/docs/topics/gateway#resume) the session was invalid. Reconnect and start a new session. */
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](https://discord.com/developers/docs/topics/gateway#sharding). */