-
-
Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy pathindex.d.ts
4977 lines (4429 loc) · 177 KB
/
index.d.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
import {
blockQuote,
bold,
channelMention,
codeBlock,
formatEmoji,
hideLinkEmbed,
hyperlink,
inlineCode,
italic,
memberNicknameMention,
quote,
roleMention,
spoiler,
strikethrough,
time,
TimestampStyles,
TimestampStylesString,
underscore,
userMention,
} from '@discordjs/builders';
import { Collection } from '@discordjs/collection';
import { ChildProcess } from 'child_process';
import {
APIActionRowComponent,
APIApplicationCommand,
APIApplicationCommandInteractionData,
APIApplicationCommandOption,
APIApplicationCommandPermission,
APIAuditLogChange,
APIEmbed,
APIEmoji,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
APIInteractionGuildMember,
APIMessage,
APIMessageComponent,
APIOverwrite,
APIPartialChannel,
APIPartialEmoji,
APIPartialGuild,
APIRole,
APITemplateSerializedSourceGuild,
APIUser,
GatewayVoiceServerUpdateDispatchData,
GatewayVoiceStateUpdateDispatchData,
RESTPostAPIApplicationCommandsJSONBody,
Snowflake,
} from 'discord-api-types/v9';
import { EventEmitter } from 'events';
import { AgentOptions } from 'https';
import { Stream } from 'stream';
import { MessagePort, Worker } from 'worker_threads';
import * as WebSocket from 'ws';
import {
ActivityTypes,
ApplicationCommandOptionTypes,
ApplicationCommandPermissionTypes,
ApplicationCommandTypes,
ChannelTypes,
DefaultMessageNotificationLevels,
ExplicitContentFilterLevels,
InteractionResponseTypes,
InteractionTypes,
InviteTargetType,
MembershipStates,
MessageButtonStyles,
MessageComponentTypes,
MFALevels,
NSFWLevels,
OverwriteTypes,
PremiumTiers,
PrivacyLevels,
StickerFormatTypes,
StickerTypes,
VerificationLevels,
WebhookTypes,
} from './enums';
import {
RawActivityData,
RawAnonymousGuildData,
RawApplicationCommandData,
RawApplicationData,
RawBaseGuildData,
RawChannelData,
RawClientApplicationData,
RawDMChannelData,
RawEmojiData,
RawGuildAuditLogData,
RawGuildAuditLogEntryData,
RawGuildBanData,
RawGuildChannelData,
RawGuildData,
RawGuildEmojiData,
RawGuildMemberData,
RawGuildPreviewData,
RawGuildTemplateData,
RawIntegrationApplicationData,
RawIntegrationData,
RawInteractionData,
RawInviteData,
RawInviteGuildData,
RawInviteStageInstance,
RawMessageAttachementData,
RawMessageButtonInteractionData,
RawMessageComponentInteractionData,
RawMessageData,
RawMessagePayloadData,
RawMessageReactionData,
RawMessageSelectMenuInteractionData,
RawOAuth2GuildData,
RawPartialGroupDMChannelData,
RawPartialMessageData,
RawPermissionOverwriteData,
RawPresenceData,
RawReactionEmojiData,
RawRichPresenceAssets,
RawRoleData,
RawStageInstanceData,
RawStickerData,
RawStickerPackData,
RawTeamData,
RawTeamMemberData,
RawThreadChannelData,
RawThreadMemberData,
RawTypingData,
RawUserData,
RawVoiceRegionData,
RawVoiceStateData,
RawWebhookData,
RawWelcomeChannelData,
RawWelcomeScreenData,
RawWidgetData,
RawWidgetMemberData,
} from './rawDataTypes';
//#region Classes
export class Activity {
public constructor(presence: Presence, data?: RawActivityData);
public applicationId: Snowflake | null;
public assets: RichPresenceAssets | null;
public buttons: string[];
public readonly createdAt: Date;
public createdTimestamp: number;
public details: string | null;
public emoji: Emoji | null;
public flags: Readonly<ActivityFlags>;
public id: string;
public name: string;
public party: {
id: string | null;
size: [number, number];
} | null;
public platform: ActivityPlatform | null;
public sessionId: string | null;
public state: string | null;
public syncId: string | null;
public timestamps: {
start: Date | null;
end: Date | null;
} | null;
public type: ActivityType;
public url: string | null;
public equals(activity: Activity): boolean;
}
export class ActivityFlags extends BitField<ActivityFlagsString> {
public static FLAGS: Record<ActivityFlagsString, number>;
public static resolve(bit?: BitFieldResolvable<ActivityFlagsString, number>): number;
}
export abstract class AnonymousGuild extends BaseGuild {
public constructor(client: Client, data: RawAnonymousGuildData, immediatePatch?: boolean);
public banner: string | null;
public description: string | null;
public nsfwLevel: NSFWLevel;
public splash: string | null;
public vanityURLCode: string | null;
public verificationLevel: VerificationLevel;
public bannerURL(options?: StaticImageURLOptions): string | null;
public splashURL(options?: StaticImageURLOptions): string | null;
}
export abstract class Application extends Base {
public constructor(client: Client, data: RawApplicationData);
public readonly createdAt: Date;
public readonly createdTimestamp: number;
public description: string | null;
public icon: string | null;
public id: Snowflake;
public name: string | null;
public coverURL(options?: StaticImageURLOptions): string | null;
public fetchAssets(): Promise<ApplicationAsset[]>;
public iconURL(options?: StaticImageURLOptions): string | null;
public toJSON(): unknown;
public toString(): string | null;
}
export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
public constructor(client: Client, data: RawApplicationCommandData, guild?: Guild, guildId?: Snowflake);
public applicationId: Snowflake;
public readonly createdAt: Date;
public readonly createdTimestamp: number;
public defaultPermission: boolean;
public description: string;
public guild: Guild | null;
public guildId: Snowflake | null;
public readonly manager: ApplicationCommandManager;
public id: Snowflake;
public name: string;
public options: ApplicationCommandOption[];
public permissions: ApplicationCommandPermissionsManager<
PermissionsFetchType,
PermissionsFetchType,
PermissionsFetchType,
Guild | null,
Snowflake
>;
public type: ApplicationCommandType;
public version: Snowflake;
public delete(): Promise<ApplicationCommand<PermissionsFetchType>>;
public edit(data: ApplicationCommandData): Promise<ApplicationCommand<PermissionsFetchType>>;
public equals(
command: ApplicationCommand | ApplicationCommandData | RawApplicationCommandData,
enforceOptionorder?: boolean,
): boolean;
public static optionsEqual(
existing: ApplicationCommandOption[],
options: ApplicationCommandOption[] | ApplicationCommandOptionData[] | APIApplicationCommandOption[],
enforceOptionorder?: boolean,
): boolean;
private static _optionEquals(
existing: ApplicationCommandOption,
options: ApplicationCommandOption | ApplicationCommandOptionData | APIApplicationCommandOption,
enforceOptionorder?: boolean,
): boolean;
private static transformOption(option: ApplicationCommandOptionData, received?: boolean): unknown;
private static transformCommand(command: ApplicationCommandData): RESTPostAPIApplicationCommandsJSONBody;
private static isAPICommandData(command: object): command is RESTPostAPIApplicationCommandsJSONBody;
}
export type ApplicationResolvable = Application | Activity | Snowflake;
export class ApplicationFlags extends BitField<ApplicationFlagsString> {
public static FLAGS: Record<ApplicationFlagsString, number>;
public static resolve(bit?: BitFieldResolvable<ApplicationFlagsString, number>): number;
}
export class Base {
public constructor(client: Client);
public readonly client: Client;
public toJSON(...props: Record<string, boolean | string>[]): unknown;
public valueOf(): string;
}
export class BaseClient extends EventEmitter {
public constructor(options?: ClientOptions | WebhookClientOptions);
private readonly api: unknown;
private rest: unknown;
private decrementMaxListeners(): void;
private incrementMaxListeners(): void;
public options: ClientOptions | WebhookClientOptions;
public destroy(): void;
public toJSON(...props: Record<string, boolean | string>[]): unknown;
}
export abstract class BaseCommandInteraction extends Interaction {
public readonly command: ApplicationCommand | ApplicationCommand<{ guild: GuildResolvable }> | null;
public readonly channel: TextBasedChannels | null;
public channelId: Snowflake;
public commandId: Snowflake;
public commandName: string;
public deferred: boolean;
public ephemeral: boolean | null;
public replied: boolean;
public webhook: InteractionWebhook;
public deferReply(options: InteractionDeferReplyOptions & { fetchReply: true }): Promise<Message | APIMessage>;
public deferReply(options?: InteractionDeferReplyOptions): Promise<void>;
public deleteReply(): Promise<void>;
public editReply(options: string | MessagePayload | WebhookEditMessageOptions): Promise<Message | APIMessage>;
public fetchReply(): Promise<Message | APIMessage>;
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message | APIMessage>;
public reply(options: InteractionReplyOptions & { fetchReply: true }): Promise<Message | APIMessage>;
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
private transformOption(
option: APIApplicationCommandOption,
resolved: APIApplicationCommandInteractionData['resolved'],
): CommandInteractionOption;
private transformResolved(resolved: APIApplicationCommandInteractionData['resolved']): CommandInteractionResolvedData;
}
export abstract class BaseGuild extends Base {
public constructor(client: Client, data: RawBaseGuildData);
public readonly createdAt: Date;
public readonly createdTimestamp: number;
public features: GuildFeatures[];
public icon: string | null;
public id: Snowflake;
public name: string;
public readonly nameAcronym: string;
public readonly partnered: boolean;
public readonly verified: boolean;
public fetch(): Promise<Guild>;
public iconURL(options?: ImageURLOptions): string | null;
public toString(): string;
}
export class BaseGuildEmoji extends Emoji {
public constructor(client: Client, data: RawGuildEmojiData, guild: Guild | GuildPreview);
public available: boolean | null;
public readonly createdAt: Date;
public readonly createdTimestamp: number;
public guild: Guild | GuildPreview;
public id: Snowflake;
public managed: boolean | null;
public requiresColons: boolean | null;
}
export class BaseGuildTextChannel extends TextBasedChannel(GuildChannel) {
public constructor(guild: Guild, data?: RawGuildChannelData, client?: Client, immediatePatch?: boolean);
public defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
public messages: MessageManager;
public nsfw: boolean;
public threads: ThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>;
public topic: string | null;
public createInvite(options?: CreateInviteOptions): Promise<Invite>;
public createWebhook(name: string, options?: ChannelWebhookCreateOptions): Promise<Webhook>;
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
public setDefaultAutoArchiveDuration(
defaultAutoArchiveDuration: ThreadAutoArchiveDuration,
reason?: string,
): Promise<this>;
public setNSFW(nsfw?: boolean, reason?: string): Promise<this>;
public setTopic(topic: string | null, reason?: string): Promise<this>;
public setType(type: Pick<typeof ChannelTypes, 'GUILD_TEXT'>, reason?: string): Promise<TextChannel>;
public setType(type: Pick<typeof ChannelTypes, 'GUILD_NEWS'>, reason?: string): Promise<NewsChannel>;
public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
}
export class BaseGuildVoiceChannel extends GuildChannel {
public constructor(guild: Guild, data?: RawGuildChannelData);
public readonly members: Collection<Snowflake, GuildMember>;
public readonly full: boolean;
public readonly joinable: boolean;
public rtcRegion: string | null;
public bitrate: number;
public userLimit: number;
public createInvite(options?: CreateInviteOptions): Promise<Invite>;
public setRTCRegion(region: string | null): Promise<this>;
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
}
export class BaseMessageComponent {
public constructor(data?: BaseMessageComponent | BaseMessageComponentOptions);
public type: MessageComponentType | null;
private static create(
data: MessageComponentOptions,
client?: Client | WebhookClient,
skipValidation?: boolean,
): MessageComponent | undefined;
private static resolveType(type: MessageComponentTypeResolvable): MessageComponentType;
}
export class BitField<S extends string, N extends number | bigint = number> {
public constructor(bits?: BitFieldResolvable<S, N>);
public bitfield: N;
public add(...bits: BitFieldResolvable<S, N>[]): BitField<S, N>;
public any(bit: BitFieldResolvable<S, N>): boolean;
public equals(bit: BitFieldResolvable<S, N>): boolean;
public freeze(): Readonly<BitField<S, N>>;
public has(bit: BitFieldResolvable<S, N>): boolean;
public missing(bits: BitFieldResolvable<S, N>, ...hasParams: readonly unknown[]): S[];
public remove(...bits: BitFieldResolvable<S, N>[]): BitField<S, N>;
public serialize(...hasParams: readonly unknown[]): Record<S, boolean>;
public toArray(...hasParams: readonly unknown[]): S[];
public toJSON(): N extends number ? number : string;
public valueOf(): N;
public [Symbol.iterator](): IterableIterator<S>;
public static FLAGS: Record<string, number | bigint>;
public static resolve(bit?: BitFieldResolvable<string, number | bigint>): number | bigint;
}
export class ButtonInteraction extends MessageComponentInteraction {
public constructor(client: Client, data: RawMessageButtonInteractionData);
public componentType: 'BUTTON';
}
export class CategoryChannel extends GuildChannel {
public readonly children: Collection<Snowflake, GuildChannel>;
public type: 'GUILD_CATEGORY';
}
export type CategoryChannelResolvable = Snowflake | CategoryChannel;
export class Channel extends Base {
public constructor(client: Client, data?: RawChannelData, immediatePatch?: boolean);
public readonly createdAt: Date;
public readonly createdTimestamp: number;
public deleted: boolean;
public id: Snowflake;
public readonly partial: false;
public type: keyof typeof ChannelTypes;
public delete(): Promise<Channel>;
public fetch(force?: boolean): Promise<Channel>;
public isText(): this is TextBasedChannels;
public isVoice(): this is BaseGuildVoiceChannel;
public isThread(): this is ThreadChannel;
public toString(): ChannelMention;
}
type If<T extends boolean, A, B = null> = T extends true ? A : T extends false ? B : A | B;
export class Client<Ready extends boolean = boolean> extends BaseClient {
public constructor(options: ClientOptions);
private actions: unknown;
private presence: ClientPresence;
private _eval(script: string): unknown;
private _validateOptions(options: ClientOptions): void;
public application: If<Ready, ClientApplication>;
public channels: ChannelManager;
public readonly emojis: BaseGuildEmojiManager;
public guilds: GuildManager;
public options: ClientOptions;
public readyAt: If<Ready, Date>;
public readonly readyTimestamp: If<Ready, number>;
public shard: ShardClientUtil | null;
public token: If<Ready, string, string | null>;
public uptime: If<Ready, number>;
public user: If<Ready, ClientUser>;
public users: UserManager;
public voice: ClientVoiceManager;
public ws: WebSocketManager;
public destroy(): void;
public fetchGuildPreview(guild: GuildResolvable): Promise<GuildPreview>;
public fetchInvite(invite: InviteResolvable): Promise<Invite>;
public fetchGuildTemplate(template: GuildTemplateResolvable): Promise<GuildTemplate>;
public fetchVoiceRegions(): Promise<Collection<string, VoiceRegion>>;
public fetchSticker(id: Snowflake): Promise<Sticker>;
public fetchPremiumStickerPacks(): Promise<Collection<Snowflake, StickerPack>>;
public fetchWebhook(id: Snowflake, token?: string): Promise<Webhook>;
public fetchGuildWidget(guild: GuildResolvable): Promise<Widget>;
public generateInvite(options?: InviteGenerationOptions): string;
public login(token?: string): Promise<string>;
public isReady(): this is Client<true>;
public sweepMessages(lifetime?: number): number;
public toJSON(): unknown;
public on<K extends keyof ClientEvents>(event: K, listener: (...args: ClientEvents[K]) => Awaited<void>): this;
public on<S extends string | symbol>(
event: Exclude<S, keyof ClientEvents>,
listener: (...args: any[]) => Awaited<void>,
): this;
public once<K extends keyof ClientEvents>(event: K, listener: (...args: ClientEvents[K]) => Awaited<void>): this;
public once<S extends string | symbol>(
event: Exclude<S, keyof ClientEvents>,
listener: (...args: any[]) => Awaited<void>,
): this;
public emit<K extends keyof ClientEvents>(event: K, ...args: ClientEvents[K]): boolean;
public emit<S extends string | symbol>(event: Exclude<S, keyof ClientEvents>, ...args: unknown[]): boolean;
public off<K extends keyof ClientEvents>(event: K, listener: (...args: ClientEvents[K]) => Awaited<void>): this;
public off<S extends string | symbol>(
event: Exclude<S, keyof ClientEvents>,
listener: (...args: any[]) => Awaited<void>,
): this;
public removeAllListeners<K extends keyof ClientEvents>(event?: K): this;
public removeAllListeners<S extends string | symbol>(event?: Exclude<S, keyof ClientEvents>): this;
}
export class ClientApplication extends Application {
public constructor(client: Client, data: RawClientApplicationData);
public botPublic: boolean | null;
public botRequireCodeGrant: boolean | null;
public commands: ApplicationCommandManager;
public cover: string | null;
public flags: Readonly<ApplicationFlags>;
public owner: User | Team | null;
public readonly partial: boolean;
public rpcOrigins: string[];
public fetch(): Promise<ClientApplication>;
}
export class ClientPresence extends Presence {
public constructor(client: Client, data: RawPresenceData);
private _parse(data: PresenceData): RawPresenceData;
public set(presence: PresenceData): ClientPresence;
}
export class ClientUser extends User {
public mfaEnabled: boolean;
public readonly presence: ClientPresence;
public verified: boolean;
public edit(data: ClientUserEditData): Promise<this>;
public setActivity(options?: ActivityOptions): ClientPresence;
public setActivity(name: string, options?: ActivityOptions): ClientPresence;
public setAFK(afk?: boolean, shardId?: number | number[]): ClientPresence;
public setAvatar(avatar: BufferResolvable | Base64Resolvable | null): Promise<this>;
public setPresence(data: PresenceData): ClientPresence;
public setStatus(status: PresenceStatusData, shardId?: number | number[]): ClientPresence;
public setUsername(username: string): Promise<this>;
}
export class Options extends null {
private constructor();
public static defaultMakeCacheSettings: CacheWithLimitsOptions;
public static createDefault(): ClientOptions;
public static cacheWithLimits(settings?: CacheWithLimitsOptions): CacheFactory;
public static cacheEverything(): CacheFactory;
}
export class ClientVoiceManager {
public constructor(client: Client);
public readonly client: Client;
public adapters: Map<Snowflake, InternalDiscordGatewayAdapterLibraryMethods>;
}
export { Collection } from '@discordjs/collection';
export abstract class Collector<K, V, F extends unknown[] = []> extends EventEmitter {
public constructor(client: Client, options?: CollectorOptions<[V, ...F]>);
private _timeout: NodeJS.Timeout | null;
private _idletimeout: NodeJS.Timeout | null;
public readonly client: Client;
public collected: Collection<K, V>;
public ended: boolean;
public abstract readonly endReason: string | null;
public filter: CollectorFilter<[V, ...F]>;
public readonly next: Promise<V>;
public options: CollectorOptions<[V, ...F]>;
public checkEnd(): boolean;
public handleCollect(...args: unknown[]): Promise<void>;
public handleDispose(...args: unknown[]): Promise<void>;
public stop(reason?: string): void;
public resetTimer(options?: CollectorResetTimerOptions): void;
public [Symbol.asyncIterator](): AsyncIterableIterator<V>;
public toJSON(): unknown;
protected listener: (...args: any[]) => void;
public abstract collect(...args: unknown[]): K | null | Promise<K | null>;
public abstract dispose(...args: unknown[]): K | null;
public on(event: 'collect' | 'dispose', listener: (...args: [V, ...F]) => Awaited<void>): this;
public on(event: 'end', listener: (collected: Collection<K, V>, reason: string) => Awaited<void>): this;
public once(event: 'collect' | 'dispose', listener: (...args: [V, ...F]) => Awaited<void>): this;
public once(event: 'end', listener: (collected: Collection<K, V>, reason: string) => Awaited<void>): this;
}
export class CommandInteraction extends BaseCommandInteraction {
public options: CommandInteractionOptionResolver;
}
export class CommandInteractionOptionResolver {
public constructor(client: Client, options: CommandInteractionOption[], resolved: CommandInteractionResolvedData);
public readonly client: Client;
public readonly data: readonly CommandInteractionOption[];
public readonly resolved: Readonly<CommandInteractionResolvedData>;
private _group: string | null;
private _hoistedOptions: CommandInteractionOption[];
private _subcommand: string | null;
private _getTypedOption(
name: string,
type: ApplicationCommandOptionType,
properties: (keyof ApplicationCommandOption)[],
required: true,
): CommandInteractionOption;
private _getTypedOption(
name: string,
type: ApplicationCommandOptionType,
properties: (keyof ApplicationCommandOption)[],
required: boolean,
): CommandInteractionOption | null;
public get(name: string, required: true): CommandInteractionOption;
public get(name: string, required?: boolean): CommandInteractionOption | null;
public getSubcommand(required?: true): string;
public getSubcommand(required: boolean): string | null;
public getSubcommandGroup(required?: true): string;
public getSubcommandGroup(required: boolean): string | null;
public getBoolean(name: string, required: true): boolean;
public getBoolean(name: string, required?: boolean): boolean | null;
public getChannel(name: string, required: true): NonNullable<CommandInteractionOption['channel']>;
public getChannel(name: string, required?: boolean): NonNullable<CommandInteractionOption['channel']> | null;
public getString(name: string, required: true): string;
public getString(name: string, required?: boolean): string | null;
public getInteger(name: string, required: true): number;
public getInteger(name: string, required?: boolean): number | null;
public getNumber(name: string, required: true): number;
public getNumber(name: string, required?: boolean): number | null;
public getUser(name: string, required: true): NonNullable<CommandInteractionOption['user']>;
public getUser(name: string, required?: boolean): NonNullable<CommandInteractionOption['user']> | null;
public getMember(name: string, required: true): NonNullable<CommandInteractionOption['member']>;
public getMember(name: string, required?: boolean): NonNullable<CommandInteractionOption['member']> | null;
public getRole(name: string, required: true): NonNullable<CommandInteractionOption['role']>;
public getRole(name: string, required?: boolean): NonNullable<CommandInteractionOption['role']> | null;
public getMentionable(
name: string,
required: true,
): NonNullable<CommandInteractionOption['member' | 'role' | 'user']>;
public getMentionable(
name: string,
required?: boolean,
): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null;
public getMessage(name: string, required: true): NonNullable<CommandInteractionOption['message']>;
public getMessage(name: string, required?: boolean): NonNullable<CommandInteractionOption['message']> | null;
}
export class ContextMenuInteraction extends BaseCommandInteraction {
public options: CommandInteractionOptionResolver;
public targetId: Snowflake;
public targetType: Exclude<ApplicationCommandType, 'CHAT_INPUT'>;
private resolveContextMenuOptions(data: APIApplicationCommandInteractionData): CommandInteractionOption[];
}
export class DataResolver extends null {
private constructor();
public static resolveBase64(data: Base64Resolvable): string;
public static resolveCode(data: string, regx: RegExp): string;
public static resolveFile(resource: BufferResolvable | Stream): Promise<Buffer | Stream>;
public static resolveFileAsBuffer(resource: BufferResolvable | Stream): Promise<Buffer>;
public static resolveImage(resource: BufferResolvable | Base64Resolvable): Promise<string | null>;
public static resolveInviteCode(data: InviteResolvable): string;
public static resolveGuildTemplateCode(data: GuildTemplateResolvable): string;
}
export class DiscordAPIError extends Error {
public constructor(error: unknown, status: number, request: unknown);
private static flattenErrors(obj: unknown, key: string): string[];
public code: number;
public method: string;
public path: string;
public httpStatus: number;
public requestData: HTTPErrorData;
}
export class DMChannel extends TextBasedChannel(Channel, ['bulkDelete']) {
public constructor(client: Client, data?: RawDMChannelData);
public messages: MessageManager;
public recipient: User;
public type: 'DM';
public fetch(force?: boolean): Promise<this>;
}
export class Emoji extends Base {
public constructor(client: Client, emoji: RawEmojiData);
public animated: boolean | null;
public readonly createdAt: Date | null;
public readonly createdTimestamp: number | null;
public deleted: boolean;
public id: Snowflake | null;
public name: string | null;
public readonly identifier: string;
public readonly url: string | null;
public toJSON(): unknown;
public toString(): string;
}
export class Guild extends AnonymousGuild {
public constructor(client: Client, data: RawGuildData);
private _sortedRoles(): Collection<Snowflake, Role>;
private _sortedChannels(channel: Channel): Collection<Snowflake, GuildChannel>;
public readonly afkChannel: VoiceChannel | null;
public afkChannelId: Snowflake | null;
public afkTimeout: number;
public applicationId: Snowflake | null;
public approximateMemberCount: number | null;
public approximatePresenceCount: number | null;
public available: boolean;
public bans: GuildBanManager;
public channels: GuildChannelManager;
public commands: GuildApplicationCommandManager;
public defaultMessageNotifications: DefaultMessageNotificationLevel | number;
public deleted: boolean;
public discoverySplash: string | null;
public emojis: GuildEmojiManager;
public explicitContentFilter: ExplicitContentFilterLevel;
public invites: GuildInviteManager;
public readonly joinedAt: Date;
public joinedTimestamp: number;
public large: boolean;
public maximumMembers: number | null;
public maximumPresences: number | null;
public readonly me: GuildMember | null;
public memberCount: number;
public members: GuildMemberManager;
public mfaLevel: MFALevel;
public ownerId: Snowflake;
public preferredLocale: string;
public premiumSubscriptionCount: number | null;
public premiumTier: PremiumTier;
public presences: PresenceManager;
public readonly publicUpdatesChannel: TextChannel | null;
public publicUpdatesChannelId: Snowflake | null;
public roles: RoleManager;
public readonly rulesChannel: TextChannel | null;
public rulesChannelId: Snowflake | null;
public readonly shard: WebSocketShard;
public shardId: number;
public stageInstances: StageInstanceManager;
public stickers: GuildStickerManager;
public readonly systemChannel: TextChannel | null;
public systemChannelFlags: Readonly<SystemChannelFlags>;
public systemChannelId: Snowflake | null;
public vanityURLUses: number | null;
public readonly voiceAdapterCreator: InternalDiscordGatewayAdapterCreator;
public readonly voiceStates: VoiceStateManager;
public readonly widgetChannel: TextChannel | null;
public widgetChannelId: Snowflake | null;
public widgetEnabled: boolean | null;
public readonly maximumBitrate: number;
public createTemplate(name: string, description?: string): Promise<GuildTemplate>;
public delete(): Promise<Guild>;
public discoverySplashURL(options?: StaticImageURLOptions): string | null;
public edit(data: GuildEditData, reason?: string): Promise<Guild>;
public editWelcomeScreen(data: WelcomeScreenEditData): Promise<WelcomeScreen>;
public equals(guild: Guild): boolean;
public fetchAuditLogs(options?: GuildAuditLogsFetchOptions): Promise<GuildAuditLogs>;
public fetchIntegrations(): Promise<Collection<Snowflake | string, Integration>>;
public fetchOwner(options?: FetchOwnerOptions): Promise<GuildMember>;
public fetchPreview(): Promise<GuildPreview>;
public fetchTemplates(): Promise<Collection<GuildTemplate['code'], GuildTemplate>>;
public fetchVanityData(): Promise<Vanity>;
public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
public fetchWelcomeScreen(): Promise<WelcomeScreen>;
public fetchWidget(): Promise<Widget>;
public fetchWidgetSettings(): Promise<GuildWidgetSettings>;
public leave(): Promise<Guild>;
public setAFKChannel(afkChannel: VoiceChannelResolvable | null, reason?: string): Promise<Guild>;
public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>;
public setBanner(banner: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
public setChannelPositions(channelPositions: readonly ChannelPosition[]): Promise<Guild>;
public setDefaultMessageNotifications(
defaultMessageNotifications: DefaultMessageNotificationLevel | number,
reason?: string,
): Promise<Guild>;
public setDiscoverySplash(
discoverySplash: BufferResolvable | Base64Resolvable | null,
reason?: string,
): Promise<Guild>;
public setExplicitContentFilter(
explicitContentFilter: ExplicitContentFilterLevel | number,
reason?: string,
): Promise<Guild>;
public setIcon(icon: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
public setName(name: string, reason?: string): Promise<Guild>;
public setOwner(owner: GuildMemberResolvable, reason?: string): Promise<Guild>;
public setPreferredLocale(preferredLocale: string, reason?: string): Promise<Guild>;
public setPublicUpdatesChannel(publicUpdatesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
public setRolePositions(rolePositions: readonly RolePosition[]): Promise<Guild>;
public setRulesChannel(rulesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
public setSplash(splash: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
public setSystemChannel(systemChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
public setSystemChannelFlags(systemChannelFlags: SystemChannelFlagsResolvable, reason?: string): Promise<Guild>;
public setVerificationLevel(verificationLevel: VerificationLevel | number, reason?: string): Promise<Guild>;
public setWidgetSettings(settings: GuildWidgetSettingsData, reason?: string): Promise<Guild>;
public toJSON(): unknown;
}
export class GuildAuditLogs {
public constructor(guild: Guild, data: RawGuildAuditLogData);
private webhooks: Collection<Snowflake, Webhook>;
private integrations: Collection<Snowflake | string, Integration>;
public entries: Collection<Snowflake, GuildAuditLogsEntry>;
public static Actions: GuildAuditLogsActions;
public static Targets: GuildAuditLogsTargets;
public static Entry: typeof GuildAuditLogsEntry;
public static actionType(action: number): GuildAuditLogsActionType;
public static build(...args: unknown[]): Promise<GuildAuditLogs>;
public static targetType(target: number): GuildAuditLogsTarget;
public toJSON(): unknown;
}
export class GuildAuditLogsEntry {
public constructor(logs: GuildAuditLogs, guild: Guild, data: RawGuildAuditLogEntryData);
public action: GuildAuditLogsAction;
public actionType: GuildAuditLogsActionType;
public changes: AuditLogChange[] | null;
public readonly createdAt: Date;
public readonly createdTimestamp: number;
public executor: User | null;
public extra: unknown | Role | GuildMember | null;
public id: Snowflake;
public reason: string | null;
public target:
| Guild
| GuildChannel
| User
| Role
| GuildEmoji
| Invite
| Webhook
| Message
| Integration
| StageInstance
| Sticker
| ThreadChannel
| { id: Snowflake }
| null;
public targetType: GuildAuditLogsTarget;
public toJSON(): unknown;
}
export class GuildBan extends Base {
public constructor(client: Client, data: RawGuildBanData, guild: Guild);
public guild: Guild;
public user: User;
public readonly partial: boolean;
public reason?: string | null;
public fetch(force?: boolean): Promise<GuildBan>;
}
export class GuildChannel extends Channel {
public constructor(guild: Guild, data?: RawGuildChannelData, client?: Client, immediatePatch?: boolean);
private memberPermissions(member: GuildMember): Readonly<Permissions>;
private rolePermissions(role: Role): Readonly<Permissions>;
public readonly calculatedPosition: number;
public readonly deletable: boolean;
public guild: Guild;
public guildId: Snowflake;
public readonly manageable: boolean;
public readonly members: Collection<Snowflake, GuildMember>;
public name: string;
public readonly parent: CategoryChannel | null;
public parentId: Snowflake | null;
public permissionOverwrites: PermissionOverwriteManager;
public readonly permissionsLocked: boolean | null;
public readonly position: number;
public rawPosition: number;
public type: Exclude<keyof typeof ChannelTypes, 'DM' | 'GROUP_DM' | 'UNKNOWN'>;
public readonly viewable: boolean;
public clone(options?: GuildChannelCloneOptions): Promise<this>;
public delete(reason?: string): Promise<this>;
public edit(data: ChannelData, reason?: string): Promise<this>;
public equals(channel: GuildChannel): boolean;
public lockPermissions(): Promise<this>;
public permissionsFor(memberOrRole: GuildMember | Role): Readonly<Permissions>;
public permissionsFor(memberOrRole: GuildMemberResolvable | RoleResolvable): Readonly<Permissions> | null;
public setName(name: string, reason?: string): Promise<this>;
public setParent(channel: CategoryChannelResolvable | null, options?: SetParentOptions): Promise<this>;
public setPosition(position: number, options?: SetChannelPositionOptions): Promise<this>;
public isText(): this is TextChannel | NewsChannel;
}
export class GuildEmoji extends BaseGuildEmoji {
public constructor(client: Client, data: RawGuildEmojiData, guild: Guild);
private _roles: Snowflake[];
public readonly deletable: boolean;
public guild: Guild;
public author: User | null;
public readonly roles: GuildEmojiRoleManager;
public readonly url: string;
public delete(reason?: string): Promise<GuildEmoji>;
public edit(data: GuildEmojiEditData, reason?: string): Promise<GuildEmoji>;
public equals(other: GuildEmoji | unknown): boolean;
public fetchAuthor(): Promise<User>;
public setName(name: string, reason?: string): Promise<GuildEmoji>;
}
export class GuildMember extends PartialTextBasedChannel(Base) {
public constructor(client: Client, data: RawGuildMemberData, guild: Guild);
public avatar: string | null;
public readonly bannable: boolean;
public deleted: boolean;
public readonly displayColor: number;
public readonly displayHexColor: HexColorString;
public readonly displayName: string;
public guild: Guild;
public readonly id: Snowflake;
public pending: boolean;
public readonly joinedAt: Date | null;
public joinedTimestamp: number | null;
public readonly kickable: boolean;
public readonly manageable: boolean;
public nickname: string | null;
public readonly partial: false;
public readonly permissions: Readonly<Permissions>;
public readonly premiumSince: Date | null;
public premiumSinceTimestamp: number | null;
public readonly presence: Presence | null;
public readonly roles: GuildMemberRoleManager;
public user: User;
public readonly voice: VoiceState;
public avatarURL(options?: ImageURLOptions): string | null;
public ban(options?: BanOptions): Promise<GuildMember>;
public fetch(force?: boolean): Promise<GuildMember>;
public createDM(force?: boolean): Promise<DMChannel>;
public deleteDM(): Promise<DMChannel>;
public displayAvatarURL(options?: ImageURLOptions): string;
public edit(data: GuildMemberEditData, reason?: string): Promise<GuildMember>;
public kick(reason?: string): Promise<GuildMember>;
public permissionsIn(channel: GuildChannelResolvable): Readonly<Permissions>;
public setNickname(nickname: string | null, reason?: string): Promise<GuildMember>;
public toJSON(): unknown;
public toString(): MemberMention;
public valueOf(): string;
}
export class GuildPreview extends Base {
public constructor(client: Client, data: RawGuildPreviewData);
public approximateMemberCount: number;
public approximatePresenceCount: number;
public readonly createdAt: Date;
public readonly createdTimestamp: number;
public description: string | null;
public discoverySplash: string | null;
public emojis: Collection<Snowflake, GuildPreviewEmoji>;
public features: GuildFeatures[];
public icon: string | null;
public id: Snowflake;
public name: string;
public splash: string | null;
public discoverySplashURL(options?: StaticImageURLOptions): string | null;
public iconURL(options?: ImageURLOptions): string | null;
public splashURL(options?: StaticImageURLOptions): string | null;
public fetch(): Promise<GuildPreview>;
public toJSON(): unknown;
public toString(): string;
}
export class GuildTemplate extends Base {
public constructor(client: Client, data: RawGuildTemplateData);
public readonly createdTimestamp: number;
public readonly updatedTimestamp: number;
public readonly url: string;
public code: string;
public name: string;
public description: string | null;
public usageCount: number;
public creator: User;
public creatorId: Snowflake;
public createdAt: Date;
public updatedAt: Date;
public guild: Guild | null;
public guildId: Snowflake;
public serializedGuild: APITemplateSerializedSourceGuild;
public unSynced: boolean | null;
public createGuild(name: string, icon?: BufferResolvable | Base64Resolvable): Promise<Guild>;
public delete(): Promise<GuildTemplate>;
public edit(options?: EditGuildTemplateOptions): Promise<GuildTemplate>;
public sync(): Promise<GuildTemplate>;
public static GUILD_TEMPLATES_PATTERN: RegExp;
}
export class GuildPreviewEmoji extends BaseGuildEmoji {
public constructor(client: Client, data: RawGuildEmojiData, guild: GuildPreview);
public guild: GuildPreview;
public roles: Snowflake[];
}
export class HTTPError extends Error {
public constructor(message: string, name: string, code: number, request: unknown);
public code: number;
public method: string;
public name: string;
public path: string;
public requestData: HTTPErrorData;
}
// tslint:disable-next-line:no-empty-interface - Merge RateLimitData into RateLimitError to not have to type it again
export interface RateLimitError extends RateLimitData {}
export class RateLimitError extends Error {
public constructor(data: RateLimitData);
public name: 'RateLimitError';
}
export class Integration extends Base {
public constructor(client: Client, data: RawIntegrationData, guild: Guild);
public account: IntegrationAccount;
public application: IntegrationApplication | null;
public enabled: boolean;
public expireBehavior: number | undefined;
public expireGracePeriod: number | undefined;
public guild: Guild;
public id: Snowflake | string;
public name: string;
public role: Role | undefined;
public enableEmoticons: boolean | null;
public readonly roles: Collection<Snowflake, Role>;
public syncedAt: number | undefined;
public syncing: boolean | undefined;
public type: string;
public user: User | null;
public subscriberCount: number | null;
public revoked: boolean | null;
public delete(reason?: string): Promise<Integration>;