· 7 years ago · Jul 31, 2018, 11:02 AM
1// Type definitions for discord.js 11.3.0
2// Project: https://github.com/hydrabolt/discord.js
3// Definitions by:
4// acdenisSK <acdenissk69@gmail.com> (https://github.com/acdenisSK)
5// Zack Campbell <zajrik@gmail.com> (https://github.com/zajrik)
6// License: MIT
7
8declare module 'discord.js' {
9 import { EventEmitter } from 'events';
10 import { Stream, Readable as ReadableStream } from 'stream';
11 import { ChildProcess } from 'child_process';
12
13 export const version: string;
14
15//#region Classes
16
17 class Attachment {
18 constructor(file: BufferResolvable | Stream, name?: string);
19 private _attach(file: BufferResolvable | Stream, name: string): void;
20
21 public readonly attachment: BufferResolvable | Stream;
22 public readonly name: string;
23 public setAttachment(file: BufferResolvable | Stream, name: string): this;
24 public setFile(attachment: BufferResolvable | Stream): this;
25 public setName(name: string): this;
26 }
27
28 class AudioPlayer extends EventEmitter {
29 constructor(voiceConnection: VoiceConnection);
30 public readonly dispatcher: StreamDispatcher;
31 public opusEncoder: object;
32 public prism: object;
33 public readonly transcoder: object;
34 public voiceConnection: VoiceConnection;
35 public setBitrate(value: number | 'auto'): void;
36 }
37
38 class BaseOpus {
39 constructor(options?: { bitrate?: number, fec?: boolean, plp?: number });
40 public bitrate: number;
41 public options: object;
42 }
43
44 export class CategoryChannel extends GuildChannel {
45 public readonly children: Collection<Snowflake, GuildChannel>;
46 }
47
48 export class Channel {
49 constructor(client: Client, data: object);
50 public readonly client: Client;
51 public readonly createdAt: Date;
52 public readonly createdTimestamp: number;
53 public id: Snowflake;
54 public type: 'dm' | 'group' | 'text' | 'voice' | 'category';
55 public delete(): Promise<Channel>;
56 }
57
58 export class Client extends EventEmitter {
59 constructor(options?: ClientOptions);
60 private _intervals: Set<NodeJS.Timer>;
61 private _pingTimestamp: number;
62 private _timeouts: Set<NodeJS.Timer>;
63 private actions: object;
64 private dataManager: object;
65 private manager: ClientManager;
66 private resolver: ClientDataResolver;
67 private rest: object;
68 private voice: ClientVoiceManager;
69 private ws: object;
70 private _eval(script: string): any;
71 private _pong(startTime: number): void;
72 private _setPresence(id: Snowflake, presence: object): void;
73 private _validateOptions(options?: ClientOptions): void;
74
75 public broadcasts: VoiceBroadcast[];
76 public readonly browser: boolean;
77 public channels: Collection<Snowflake, Channel>;
78 public readonly emojis: Collection<Snowflake, Emoji>;
79 public guilds: Collection<Snowflake, Guild>;
80 public options: ClientOptions;
81 public readonly ping: number;
82 public pings: number[];
83 public presences: Collection<Snowflake, Presence>;
84 public readyAt: Date;
85 public readonly readyTimestamp: number;
86 public shard: ShardClientUtil;
87 public readonly status: number;
88 public token: string;
89 public readonly uptime: number;
90 public user: ClientUser;
91 public users: Collection<Snowflake, User>;
92 public readonly voiceConnections: Collection<Snowflake, VoiceConnection>;
93 public clearInterval(interval: NodeJS.Timer): void;
94 public clearTimeout(timeout: NodeJS.Timer): void;
95 public createVoiceBroadcast(): VoiceBroadcast;
96 public destroy(): Promise<void>;
97 public fetchApplication(id?: Snowflake): Promise<OAuth2Application>;
98 public fetchInvite(invite: InviteResolvable): Promise<Invite>;
99 public fetchUser(id: Snowflake, cache?: boolean): Promise<User>;
100 public fetchVoiceRegions(): Promise<Collection<string, VoiceRegion>>;
101 public fetchWebhook(id: Snowflake, token?: string): Promise<Webhook>;
102 public generateInvite(permissions?: PermissionResolvable[] | number): Promise<string>;
103 public login(token?: string): Promise<string>;
104 public setInterval(fn: Function, delay: number, ...args: any[]): NodeJS.Timer;
105 public setTimeout(fn: Function, delay: number, ...args: any[]): NodeJS.Timer;
106 public sweepMessages(lifetime?: number): number;
107 public syncGuilds(guilds?: Guild[] | Collection<Snowflake, Guild>): void;
108
109 public on(event: 'channelCreate', listener: (channel: Channel) => void): this;
110 public on(event: 'channelDelete', listener: (channel: Channel) => void): this;
111 public on(event: 'channelPinsUpdate', listener: (channel: Channel, time: Date) => void): this;
112 public on(event: 'channelUpdate', listener: (oldChannel: Channel, newChannel: Channel) => void): this;
113 public on(event: 'clientUserGuildSettingsUpdate', listener: (clientUserGuildSettings: ClientUserGuildSettings) => void): this;
114 public on(event: 'clientUserSettingsUpdate', listener: (clientUserSettings: ClientUserSettings) => void): this;
115 public on(event: 'debug', listener: (info: string) => void): this;
116 public on(event: 'disconnect', listener: (event: any) => void): this;
117 public on(event: 'emojiCreate', listener: (emoji: Emoji) => void): this;
118 public on(event: 'emojiDelete', listener: (emoji: Emoji) => void): this;
119 public on(event: 'emojiUpdate', listener: (oldEmoji: Emoji, newEmoji: Emoji) => void): this;
120 public on(event: 'error', listener: (error: Error) => void): this;
121 public on(event: 'guildBanAdd', listener: (guild: Guild, user: User) => void): this;
122 public on(event: 'guildBanRemove', listener: (guild: Guild, user: User) => void): this;
123 public on(event: 'guildCreate', listener: (guild: Guild) => void): this;
124 public on(event: 'guildDelete', listener: (guild: Guild) => void): this;
125 public on(event: 'guildMemberAdd', listener: (member: GuildMember) => void): this;
126 public on(event: 'guildMemberAvailable', listener: (member: GuildMember) => void): this;
127 public on(event: 'guildMemberRemove', listener: (member: GuildMember) => void): this;
128 public on(event: 'guildMembersChunk', listener: (members: GuildMember[], guild: Guild) => void): this;
129 public on(event: 'guildMemberSpeaking', listener: (member: GuildMember, speaking: boolean) => void): this;
130 public on(event: 'guildMemberUpdate', listener: (oldMember: GuildMember, newMember: GuildMember) => void): this;
131 public on(event: 'guildUnavailable', listener: (guild: Guild) => void): this;
132 public on(event: 'guildUpdate', listener: (oldGuild: Guild, newGuild: Guild) => void): this;
133 public on(event: 'message', listener: (message: Message) => void): this;
134 public on(event: 'messageDelete', listener: (message: Message) => void): this;
135 public on(event: 'messageDeleteBulk', listener: (messages: Collection<Snowflake, Message>) => void): this;
136 public on(event: 'messageReactionAdd', listener: (messageReaction: MessageReaction, user: User) => void): this;
137 public on(event: 'messageReactionRemove', listener: (messageReaction: MessageReaction, user: User) => void): this;
138 public on(event: 'messageReactionRemoveAll', listener: (message: Message) => void): this;
139 public on(event: 'messageUpdate', listener: (oldMessage: Message, newMessage: Message) => void): this;
140 public on(event: 'presenceUpdate', listener: (oldMember: GuildMember, newMember: GuildMember) => void): this;
141 public on(event: 'ready', listener: () => void): this;
142 public on(event: 'reconnecting', listener: () => void): this;
143 public on(event: 'resume', listener: (replayed: number) => void): this;
144 public on(event: 'roleCreate', listener: (role: Role) => void): this;
145 public on(event: 'roleDelete', listener: (role: Role) => void): this;
146 public on(event: 'roleUpdate', listener: (oldRole: Role, newRole: Role) => void): this;
147 public on(event: 'typingStart', listener: (channel: Channel, user: User) => void): this;
148 public on(event: 'typingStop', listener: (channel: Channel, user: User) => void): this;
149 public on(event: 'userNoteUpdate', listener: (user: UserResolvable, oldNote: string, newNote: string) => void): this;
150 public on(event: 'userUpdate', listener: (oldUser: User, newUser: User) => void): this;
151 public on(event: 'voiceStateUpdate', listener: (oldMember: GuildMember, newMember: GuildMember) => void): this;
152 public on(event: 'warn', listener: (info: string) => void): this;
153 public on(event: string, listener: Function): this;
154
155 public once(event: 'channelCreate', listener: (channel: Channel) => void): this;
156 public once(event: 'channelDelete', listener: (channel: Channel) => void): this;
157 public once(event: 'channelPinsUpdate', listener: (channel: Channel, time: Date) => void): this;
158 public once(event: 'channelUpdate', listener: (oldChannel: Channel, newChannel: Channel) => void): this;
159 public once(event: 'clientUserGuildSettingsUpdate', listener: (clientUserGuildSettings: ClientUserGuildSettings) => void): this;
160 public once(event: 'clientUserSettingsUpdate', listener: (clientUserSettings: ClientUserSettings) => void): this;
161 public once(event: 'debug', listener: (info: string) => void): this;
162 public once(event: 'disconnect', listener: (event: any) => void): this;
163 public once(event: 'emojiCreate', listener: (emoji: Emoji) => void): this;
164 public once(event: 'emojiDelete', listener: (emoji: Emoji) => void): this;
165 public once(event: 'emojiUpdate', listener: (oldEmoji: Emoji, newEmoji: Emoji) => void): this;
166 public once(event: 'error', listener: (error: Error) => void): this;
167 public once(event: 'guildBanAdd', listener: (guild: Guild, user: User) => void): this;
168 public once(event: 'guildBanRemove', listener: (guild: Guild, user: User) => void): this;
169 public once(event: 'guildCreate', listener: (guild: Guild) => void): this;
170 public once(event: 'guildDelete', listener: (guild: Guild) => void): this;
171 public once(event: 'guildMemberAdd', listener: (member: GuildMember) => void): this;
172 public once(event: 'guildMemberAvailable', listener: (member: GuildMember) => void): this;
173 public once(event: 'guildMemberRemove', listener: (member: GuildMember) => void): this;
174 public once(event: 'guildMembersChunk', listener: (members: GuildMember[], guild: Guild) => void): this;
175 public once(event: 'guildMemberSpeaking', listener: (member: GuildMember, speaking: boolean) => void): this;
176 public once(event: 'guildMemberUpdate', listener: (oldMember: GuildMember, newMember: GuildMember) => void): this;
177 public once(event: 'guildUnavailable', listener: (guild: Guild) => void): this;
178 public once(event: 'guildUpdate', listener: (oldGuild: Guild, newGuild: Guild) => void): this;
179 public once(event: 'message', listener: (message: Message) => void): this;
180 public once(event: 'messageDelete', listener: (message: Message) => void): this;
181 public once(event: 'messageDeleteBulk', listener: (messages: Collection<Snowflake, Message>) => void): this;
182 public once(event: 'messageReactionAdd', listener: (messageReaction: MessageReaction, user: User) => void): this;
183 public once(event: 'messageReactionRemove', listener: (messageReaction: MessageReaction, user: User) => void): this;
184 public once(event: 'messageReactionRemoveAll', listener: (message: Message) => void): this;
185 public once(event: 'messageUpdate', listener: (oldMessage: Message, newMessage: Message) => void): this;
186 public once(event: 'presenceUpdate', listener: (oldMember: GuildMember, newMember: GuildMember) => void): this;
187 public once(event: 'ready', listener: () => void): this;
188 public once(event: 'reconnecting', listener: () => void): this;
189 public once(event: 'resume', listener: (replayed: number) => void): this;
190 public once(event: 'roleCreate', listener: (role: Role) => void): this;
191 public once(event: 'roleDelete', listener: (role: Role) => void): this;
192 public once(event: 'roleUpdate', listener: (oldRole: Role, newRole: Role) => void): this;
193 public once(event: 'typingStart', listener: (channel: Channel, user: User) => void): this;
194 public once(event: 'typingStop', listener: (channel: Channel, user: User) => void): this;
195 public once(event: 'userNoteUpdate', listener: (user: UserResolvable, oldNote: string, newNote: string) => void): this;
196 public once(event: 'userUpdate', listener: (oldUser: User, newUser: User) => void): this;
197 public once(event: 'voiceStateUpdate', listener: (oldMember: GuildMember, newMember: GuildMember) => void): this;
198 public once(event: 'warn', listener: (info: string) => void): this;
199 public once(event: string, listener: Function): this;
200 }
201
202 class ClientDataResolver {
203 constructor(client: Client);
204 public resolveBase64(data: Base64Resolvable): string;
205 public resolveChannel(channel: ChannelResolvable): Channel;
206 public resolveChannelID(channel: ChannelResolvable): Snowflake;
207 public resolveColor(color: ColorResolvable): number;
208 public resolveEmojiIdentifier(emoji: EmojiIdentifierResolvable): string;
209 public resolveFile(resource: BufferResolvable | Stream): Promise<Buffer>;
210 public resolveGuild(guild: GuildResolvable): Guild;
211 public resolveGuildMember(guild: GuildResolvable, user: UserResolvable): GuildMember;
212 public resolveImage(imge: BufferResolvable | Base64Resolvable): Promise<string>;
213 public resolveInviteCode(data: InviteResolvable): string;
214 public resolveString(data: StringResolvable): string;
215 public resolveUser(user: UserResolvable): User;
216 public resolveUserID(user: UserResolvable): Snowflake;
217
218 public static resolveColor(color: ColorResolvable): number;
219 }
220
221 class ClientManager {
222 constructor(client: Client);
223 public client: Client;
224 public heartbeatInterval: number;
225 public status: number;
226 public connectToWebSocket(token: string, resolve: Function, reject: Function): void;
227 }
228
229 export class ClientUser extends User {
230 public blocked: Collection<Snowflake, User>;
231 public email: string;
232 public friends: Collection<Snowflake, User>;
233 public guildSettings: Collection<Snowflake, ClientUserGuildSettings>;
234 public mfaEnabled: boolean;
235 public mobile: boolean;
236 public notes: Collection<Snowflake, string>;
237 public premium: boolean;
238 public settings: ClientUserSettings;
239 public verified: boolean;
240 public acceptInvite(invite: Invite | string): Promise<Guild>
241 public addFriend(user?: UserResolvable): Promise<User>;
242 public createGroupDM(recipients: GroupDMRecipientOptions[]): Promise<GroupDMChannel>;
243 public createGuild(name: string, region: string, icon?: BufferResolvable | Base64Resolvable): Promise<Guild>;
244 public fetchMentions(options?: { limit?: number; roles?: boolean, everyone?: boolean; guild?: Guild | Snowflake }): Promise<Message[]>;
245 public removeFriend(user?: UserResolvable): Promise<User>;
246 public setActivity(name: string, options?: { url?: string, type?: ActivityType | number }): Promise<ClientUser>;
247 public setAFK(afk: boolean): Promise<ClientUser>;
248 public setAvatar(avatar: BufferResolvable | Base64Resolvable): Promise<ClientUser>;
249 public setEmail(email: string, password: string): Promise<ClientUser>;
250 public setGame(game: string, streamingURL?: string): Promise<ClientUser>;
251 public setPassword(newPassword: string, oldPassword: string): Promise<ClientUser>;
252 public setPresence(data: PresenceData): Promise<ClientUser>;
253 public setStatus(status: PresenceStatus): Promise<ClientUser>;
254 public setUsername(username: string, password?: string): Promise<ClientUser>;
255 }
256
257 class ClientUserChannelOverride {
258 constructor(user: User, data: object);
259 private patch(data: object): void;
260
261 public messageNotifications: GuildChannelMessageNotifications;
262 public muted: boolean;
263 }
264
265 class ClientUserGuildSettings {
266 constructor(data: object, guild: Guild);
267 private patch(data: object): void;
268
269 public channelOverrides: Collection<Snowflake, ClientUserChannelOverride>;
270 public readonly client: Client;
271 public guildID: Snowflake;
272 public messageNotifications: GuildChannelMessageNotifications;
273 public mobilePush: boolean;
274 public muted: boolean;
275 public suppressEveryone: boolean;
276 public update(name: string, value: any): Promise<object>;
277 }
278
279 export class ClientUserSettings {
280 constructor(user: User, data: object);
281 private patch(data: object): void;
282
283 public convertEmoticons: boolean;
284 public defaultGuildsRestricted: boolean;
285 public detectPlatformAccounts: boolean;
286 public developerMode: boolean;
287 public enableTTSCommand: boolean;
288 public explicitContentFilter: 'DISABLED' | 'NON_FRIENDS' | 'FRIENDS_AND_NON_FRIENDS' | string;
289 public friendsSources: { all: boolean, mutualGuilds: boolean, mutualFriends: boolean };
290 public guildsPositions: Snowflake[];
291 public inlineAttachmentMedia: boolean;
292 public inlineEmbedMedia: boolean;
293 public locale: string;
294 public messageDisplayCompact: boolean;
295 public renderReactions: boolean;
296 public restrictedGuilds: Snowflake[];
297 public showCurrentGame: boolean;
298 public status: PresenceStatus;
299 public theme: string;
300 public addRestrictedGuild(guild: Guild): Promise<Guild>;
301 public removeRestrictedGuild(guild: Guild): Promise<Guild>;
302 public setGuildPosition(guild: Guild, position: number, relative?: boolean): Promise<Guild>;
303 public update(name: string, value: any): Promise<object>;
304 }
305
306 class ClientVoiceManager {
307 constructor(client: Client);
308 public client: Client;
309 public connections: Collection<Snowflake, VoiceConnection>;
310 public joinChannel(channel: VoiceChannel): Promise<VoiceConnection>;
311 }
312
313 export class Collection<K, V> extends Map<K, V> {
314 private _array: V[];
315 private _keyArray: K[];
316
317 public array(): V[];
318 public clone(): Collection<K, V>;
319 public concat(...collections: Collection<K, V>[]): Collection<K, V>;
320 public deleteAll(): Promise<V>[];
321 public equals(collection: Collection<any, any>): boolean;
322 public every(fn: (value: V, key: K, collection: Collection<K, V>) => boolean, thisArg?: any): boolean;
323 public exists(prop: keyof V, value: any): boolean;
324 public filter(fn: (value: V, key: K, collection: Collection<K, V>) => boolean, thisArg?: any): Collection<K, V>;
325 public filterArray(fn: (value: V, key: K, collection: Collection<K, V>) => boolean, thisArg?: any): V[];
326 public find(prop: keyof V, value: any): V;
327 public find(fn: (value: V, key: K, collection: Collection<K, V>) => boolean): V;
328 public findAll(prop: keyof V, value: any): V[];
329 public findKey(prop: keyof V, value: any): K;
330 public findKey(fn: (value: V, key: K, collection: Collection<K, V>) => boolean): K;
331 public first(): V;
332 public first(count: number): V[];
333 public firstKey(): K;
334 public firstKey(count: number): K[];
335 public keyArray(): K[];
336 public last(): V;
337 public last(count: number): V[];
338 public lastKey(): K;
339 public lastKey(count: number): K[];
340 public map<T>(fn: (value: V, key: K, collection: Collection<K, V>) => T, thisArg?: any): T[];
341 public random(): V;
342 public random(count: number): V[];
343 public randomKey(): K;
344 public randomKey(count: number): K[];
345 public reduce<T>(fn: (accumulator: any, value: V, key: K, collection: Collection<K, V>) => T, initialValue?: any): T;
346 public some(fn: (value: V, key: K, collection: Collection<K, V>) => boolean, thisArg?: any): boolean;
347 public sort(compareFunction?: (a: V, b: V, c?: K, d?: K) => number): Collection<K, V>;
348 }
349
350 abstract class Collector<K, V> extends EventEmitter {
351 constructor(client: Client, filter: CollectorFilter, options?: CollectorOptions);
352 private _timeout: NodeJS.Timer;
353 private _handle(...args: any[]): void;
354
355 public readonly client: Client;
356 public collected: Collection<K, V>;
357 public ended: boolean;
358 public filter: CollectorFilter;
359 public readonly next: Promise<V>;
360 public options: CollectorOptions;
361 public stop(reason?: string): void;
362
363 protected listener: Function;
364 public abstract cleanup(): void;
365 public abstract handle(...args: any[]): CollectorHandler<K, V>;
366 public abstract postCheck(...args: any[]): string | null;
367
368 public on(event: 'collect', listener: (element: V, collector: Collector<K, V>) => void): this;
369 public on(event: 'end', listener: (collected: Collection<K, V>, reason: string) => void): this;
370 public on(event: string, listener: Function): this;
371
372 public once(event: 'collect', listener: (element: V, collector: Collector<K, V>) => void): this;
373 public once(event: 'end', listener: (collected: Collection<K, V>, reason: string) => void): this;
374 public once(event: string, listener: Function): this;
375 }
376
377 class DiscordAPIError extends Error {
378 constructor(error: object);
379 private static flattenErrors(obj: object, key: string): string[];
380
381 public code: number;
382 public path: string;
383 }
384
385 export class DMChannel extends TextBasedChannel(Channel) {
386 constructor(client: Client, data: object);
387 public lastMessageID: Snowflake;
388 public messages: Collection<Snowflake, Message>;
389 public recipient: User;
390 public toString(): string;
391 }
392
393 export class Emoji {
394 constructor(guild: Guild, data: object);
395 public animated: boolean;
396 public readonly client: Client;
397 public readonly createdAt: Date;
398 public readonly createdTimestamp: number;
399 public guild: Guild;
400 public id: Snowflake;
401 public readonly identifier: string;
402 public managed: boolean;
403 public name: string;
404 public requiresColons: boolean;
405 public readonly roles: Collection<Snowflake, Role>;
406 public readonly url: string;
407 public addRestrictedRole(role: Role): Promise<Emoji>;
408 public addRestrictedRoles(roles: Role[]): Promise<Emoji>;
409 public edit(data: EmojiEditData, reason?: string): Promise<Emoji>;
410 public equals(other: Emoji | object): boolean;
411 public removeRestrictedRole(role: Role): Promise<Emoji>;
412 public removeRestrictedRoles(roles: Role[]): Promise<Emoji>;
413 public setName(name: string, reason?: string): Promise<Emoji>;
414 public toString(): string;
415 }
416
417 export class Game {
418 constructor(data: object);
419 public name: string;
420 public readonly streaming: boolean;
421 public type: number;
422 public url: string;
423 public equals(game: Game): boolean;
424 }
425
426 export class GroupDMChannel extends TextBasedChannel(Channel) {
427 constructor(client: Client, data: object);
428 public applicationID: string;
429 public icon: string;
430 public lastMessageID: string;
431 public managed: boolean;
432 public messages: Collection<Snowflake, Message>;
433 public name: string;
434 public nicks: Collection<Snowflake, string>;
435 public readonly owner: User;
436 public ownerID: string;
437 public recipients: Collection<Snowflake, User>;
438 public addUser(accessTokenOrID: UserResolvable | string, nick?: string): Promise<GroupDMChannel>
439 public equals(channel: GroupDMChannel): boolean;
440 public setIcon(icon: Base64Resolvable | BufferResolvable): Promise<GroupDMChannel>;
441 public toString(): string;
442 }
443
444 export class Guild {
445 constructor(client: Client, data: object);
446 private readonly _sortedRoles: Collection<Snowflake, Role>;
447 private _sortedChannels(type: string): Collection<Snowflake, GuildChannel>
448 private _sortPositionWithID(collection: Collection<any, any>): Collection<any, any>;
449
450 protected setup(data: any): void;
451
452 public readonly afkChannel: VoiceChannel;
453 public afkChannelID: string;
454 public afkTimeout: number;
455 public applicationID: string;
456 public available: boolean;
457 public channels: Collection<Snowflake, GuildChannel>;
458 public readonly client: Client;
459 public readonly createdAt: Date;
460 public readonly createdTimestamp: number;
461 public readonly defaultChannel: TextChannel;
462 public readonly defaultRole: Role;
463 public embedEnabled: boolean;
464 public emojis: Collection<Snowflake, Emoji>;
465 public explicitContentFilter: number;
466 public features: string[];
467 public icon: string;
468 public readonly iconURL: string;
469 public id: Snowflake;
470 public readonly joinedAt: Date;
471 public joinedTimestamp: number;
472 public large: boolean;
473 public readonly me: GuildMember;
474 public memberCount: number;
475 public members: Collection<Snowflake, GuildMember>;
476 public readonly messageNotifications: MessageNotifications;
477 public readonly mobilePush: boolean;
478 public readonly muted: boolean;
479 public name: string;
480 public readonly nameAcronym: string;
481 public readonly owner: GuildMember;
482 public ownerID: string;
483 public readonly position: number;
484 public presences: Collection<Snowflake, Presence>;
485 public region: string;
486 public roles: Collection<Snowflake, Role>;
487 public splash: string;
488 public readonly splashURL: string;
489 public readonly suppressEveryone: boolean;
490 public readonly systemChannel: GuildChannel;
491 public systemChannelID: Snowflake;
492 public verificationLevel: number;
493 public readonly voiceConnection: VoiceConnection;
494 public acknowledge(): Promise<Guild>;
495 public addMember(user: UserResolvable, options: AddGuildMemberOptions): Promise<GuildMember>;
496 public allowDMs(allow: boolean): Promise<Guild>;
497 public ban(user: UserResolvable, options?: BanOptions | number | string): Promise<GuildMember | User | string>;
498 public createChannel(name: string, type?: 'category' | 'text' | 'voice', overwrites?: PermissionOverwrites[] | object[], reason?: string): Promise<CategoryChannel | TextChannel | VoiceChannel>;
499 public createEmoji(attachment: BufferResolvable | Base64Resolvable, name: string, roles?: Collection<Snowflake, Role> | Role[], reason?: string): Promise<Emoji>;
500 public createRole(data?: RoleData, reason?: string): Promise<Role>;
501 public delete(): Promise<Guild>;
502 public deleteEmoji(emoji: Emoji | string, reason?: string): Promise<void>;
503 public edit(data: GuildEditData, reason?: string): Promise<Guild>;
504 public equals(guild: Guild): boolean;
505 public fetchAuditLogs(options?: GuildAuditLogsFetchOptions): Promise<GuildAuditLogs>;
506 public fetchBans(): Promise<Collection<Snowflake, User>>;
507 public fetchInvites(): Promise<Collection<Snowflake, Invite>>;
508 public fetchMember(user: UserResolvable, cache?: boolean): Promise<GuildMember>;
509 public fetchMembers(query?: string, limit?: number): Promise<Guild>;
510 public fetchVoiceRegions(): Promise<Collection<string, VoiceRegion>>;
511 public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
512 public leave(): Promise<Guild>;
513 public member(user: UserResolvable): GuildMember;
514 public pruneMembers(days: number, dry?: boolean, reason?: string): Promise<number>;
515 public search(options?: MessageSearchOptions): Promise<MessageSearchResult>;
516 public setAFKChannel(afkChannel: ChannelResolvable, reason?: string): Promise<Guild>;
517 public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>;
518 public setChannelPosition(channel: string | GuildChannel, position: number, relative?: boolean): Promise<Guild>;
519 public setChannelPositions(channelPositions: ChannelPosition[]): Promise<Guild>;
520 public setExcplicitContentFilter(explicitContentFilter: number, reason?: string): Promise<Guild>;
521 public setIcon(icon: Base64Resolvable, reason?: string): Promise<Guild>;
522 public setName(name: string, reason?: string): Promise<Guild>;
523 public setOwner(owner: GuildMemberResolvable, reason?: string): Promise<Guild>;
524 public setPosition(position: number, relative?: boolean): Promise<Guild>;
525 public setRegion(region: string, reason?: string): Promise<Guild>;
526 public setRolePosition(role: string | Role, position: number, relative?: boolean): Promise<Guild>;
527 public setSplash(splash: Base64Resolvable, reason?: string): Promise<Guild>;
528 public setSystemChannel(systemChannel: ChannelResolvable, reason?: string): Promise<Guild>;
529 public setVerificationLevel(verificationLevel: number, reason?: string): Promise<Guild>;
530 public sync(): void;
531 public toString(): string;
532 public unban(user: UserResolvable, reason?: string): Promise<User>;
533 }
534
535 export class GuildAuditLogs {
536 constructor(guild: Guild, data: object);
537 private webhooks: Collection<Snowflake, Webhook>;
538
539 public entries: Collection<Snowflake, GuildAuditLogsEntry>;
540
541 public static Actions: GuildAuditLogsActions;
542 public static Targets: GuildAuditLogsTargets;
543 public static Entry: typeof GuildAuditLogsEntry;
544 public static actionType(action: number): GuildAuditLogsActionType;
545 public static build(...args: any[]): Promise<GuildAuditLogs>;
546 public static targetType(target: number): GuildAuditLogsTarget;
547 }
548
549 class GuildAuditLogsEntry {
550 constructor(logs: GuildAuditLogs, guild: Guild, data: object);
551 public action: GuildAuditLogsAction;
552 public actionType: GuildAuditLogsActionType;
553 public changes: AuditLogChange[];
554 public readonly createdAt: Date;
555 public readonly createdTimestamp: number;
556 public executor: User;
557 public extra: object | Role | GuildMember;
558 public id: Snowflake;
559 public reason: string;
560 public target: Guild | User | Role | Emoji | Invite | Webhook;
561 public targetType: GuildAuditLogsTarget;
562 }
563
564 export class GuildChannel extends Channel {
565 constructor(guild: Guild, data: object);
566 public readonly calculatedPosition: number;
567 public readonly deletable: boolean;
568 public guild: Guild;
569 public readonly messageNotifications: GuildChannelMessageNotifications;
570 public readonly muted: boolean;
571 public name: string;
572 public readonly parent: CategoryChannel;
573 public parentID: Snowflake;
574 public permissionOverwrites: Collection<Snowflake, PermissionOverwrites>;
575 public position: number;
576 public clone(name?: string, withPermissions?: boolean, withTopic?: boolean, reason?: string): Promise<GuildChannel>;
577 public createInvite(options?: InviteOptions, reason?: string): Promise<Invite>;
578 public delete(reason?: string): Promise<GuildChannel>
579 public edit(data: ChannelData, reason?: string): Promise<GuildChannel>;
580 public equals(channel: GuildChannel): boolean;
581 public overwritePermissions(userOrRole: RoleResolvable | UserResolvable, options: PermissionOverwriteOptions, reason?: string): Promise<void>;
582 public permissionsFor(member: GuildMemberResolvable): Permissions;
583 public setName(name: string, reason?: string): Promise<GuildChannel>;
584 public setParent(parent: ChannelResolvable, reason?: string): Promise<GuildChannel>
585 public setPosition(position: number, relative?: boolean): Promise<GuildChannel>;
586 public setTopic(topic: string, reason?: string): Promise<GuildChannel>;
587 public toString(): string;
588 }
589
590 export class GuildMember extends PartialTextBasedChannel() {
591 constructor(guild: Guild, data: object);
592 public readonly bannable: boolean;
593 public readonly client: Client;
594 public readonly colorRole: Role;
595 public readonly deaf: boolean;
596 public readonly displayColor: number;
597 public readonly displayHexColor: string;
598 public readonly displayName: string;
599 public guild: Guild;
600 public readonly highestRole: Role;
601 public readonly hoistRole: Role;
602 public readonly id: Snowflake;
603 public readonly joinedAt: Date;
604 public joinedTimestamp: number;
605 public readonly kickable: boolean;
606 public lastMessageID: string;
607 public readonly mute: boolean;
608 public nickname: string;
609 public readonly permissions: Permissions;
610 public readonly presence: Presence;
611 public readonly roles: Collection<Snowflake, Role>;
612 public selfDeaf: boolean;
613 public selfMute: boolean;
614 public serverDeaf: boolean;
615 public serverMute: boolean;
616 public speaking: boolean;
617 public user: User;
618 public readonly voiceChannel: VoiceChannel;
619 public voiceChannelID: string;
620 public voiceSessionID: string;
621 public addRole(role: Role | Snowflake, reason?: string): Promise<GuildMember>;
622 public addRoles(roles: Collection<Snowflake, Role> | Role[] | Snowflake[], reason?: string): Promise<GuildMember>;
623 public ban(options?: BanOptions | number | string): Promise<GuildMember>;
624 public createDM(): Promise<DMChannel>;
625 public deleteDM(): Promise<DMChannel>;
626 public edit(data: object, reason?: string): Promise<GuildMember>;
627 public hasPermission(permission: PermissionResolvable | PermissionResolvable[], explicit?: boolean, checkAdmin?: boolean, checkOwner?: boolean): boolean;
628 public hasPermissions(permission: PermissionResolvable[], explicit?: boolean): boolean;
629 public kick(reason?: string): Promise<GuildMember>;
630 public missingPermissions(permissions: PermissionResolvable[], explicit?: boolean): PermissionResolvable[];
631 public permissionsIn(channel: ChannelResolvable): Permissions;
632 public removeRole(role: Role | Snowflake, reason?: string): Promise<GuildMember>;
633 public removeRoles(roles: Collection<Snowflake, Role> | Role[] | Snowflake[], reason?: string): Promise<GuildMember>;
634 public setDeaf(deaf: boolean, reason?: string): Promise<GuildMember>;
635 public setMute(mute: boolean, reason?: string): Promise<GuildMember>;
636 public setNickname(nickname: string, reason?: string): Promise<GuildMember>;
637 public setRoles(roles: Collection<Snowflake, Role> | Role[] | Snowflake[], reason?: string): Promise<GuildMember>;
638 public setVoiceChannel(voiceChannel: ChannelResolvable): Promise<GuildMember>;
639 public toString(): string;
640 }
641
642 export class Invite {
643 constructor(client: Client, data: object);
644 public channel: GuildChannel | PartialGuildChannel;
645 public readonly client: Client;
646 public code: string;
647 public readonly createdAt: Date;
648 public createdTimestamp: number;
649 public readonly expiresAt: Date;
650 public readonly expiresTimestamp: number;
651 public guild: Guild | PartialGuild;
652 public inviter: User;
653 public maxAge: number;
654 public maxUses: number;
655 public memberCount: number;
656 public presenceCount: number;
657 public temporary: boolean;
658 public textChannelCount: number;
659 public readonly url: string;
660 public uses: number;
661 public voiceChannelCount: number;
662 public delete(reason?: string): Promise<Invite>;
663 public toString(): string;
664 }
665
666 export class Message {
667 constructor(channel: TextChannel | DMChannel | GroupDMChannel, data: object, client: Client);
668 private _edits: Message[];
669 private patch(data: object): void;
670
671 public attachments: Collection<Snowflake, MessageAttachment>;
672 public author: User;
673 public channel: TextChannel | DMChannel | GroupDMChannel;
674 public readonly cleanContent: string;
675 public readonly client: Client;
676 public content: string;
677 public readonly createdAt: Date;
678 public createdTimestamp: number;
679 public readonly deletable: boolean;
680 public readonly editable: boolean;
681 public readonly editedAt: Date;
682 public editedTimestamp: number;
683 public readonly edits: Message[];
684 public embeds: MessageEmbed[];
685 public readonly guild: Guild;
686 public hit: boolean;
687 public id: Snowflake;
688 public member: GuildMember;
689 public mentions: MessageMentions;
690 public nonce: string;
691 public readonly pinnable: boolean;
692 public pinned: boolean;
693 public reactions: Collection<Snowflake, MessageReaction>;
694 public system: boolean;
695 public tts: boolean;
696 public type: string;
697 public webhookID: Snowflake;
698 public acknowledge(): Promise<Message>;
699 public awaitReactions(filter: CollectorFilter, options?: AwaitReactionsOptions): Promise<Collection<Snowflake, MessageReaction>>;
700 public clearReactions(): Promise<Message>;
701 public createReactionCollector(filter: CollectorFilter, options?: ReactionCollectorOptions): ReactionCollector;
702 public delete(timeout?: number): Promise<Message>;
703 public edit(content: StringResolvable, options?: MessageEditOptions | RichEmbed): Promise<Message>;
704 public editCode(lang: string, content: StringResolvable): Promise<Message>;
705 public equals(message: Message, rawData: object): boolean;
706 public fetchWebhook(): Promise<Webhook>;
707 public isMemberMentioned(member: GuildMember | User): boolean;
708 public isMentioned(data: GuildChannel | User | Role | Snowflake): boolean;
709 public pin(): Promise<Message>;
710 public react(emoji: string | Emoji | ReactionEmoji): Promise<MessageReaction>;
711 public reply(content?: StringResolvable, options?: MessageOptions): Promise<Message | Message[]>;
712 public reply(options?: MessageOptions): Promise<Message | Message[]>;
713 public toString(): string;
714 public unpin(): Promise<Message>;
715 }
716
717 export class MessageAttachment {
718 constructor(message: Message, data: object);
719 public readonly client: Client;
720 public filename: string;
721 public filesize: number;
722 public height: number;
723 public id: Snowflake;
724 public message: Message;
725 public proxyURL: string;
726 public url: string;
727 public width: number;
728 }
729
730 export class MessageCollector extends Collector<Snowflake, Message> {
731 constructor(channel: TextChannel | DMChannel | GroupDMChannel, filter: CollectorFilter, options?: MessageCollectorOptions);
732 public channel: Channel;
733 public options: MessageCollectorOptions;
734 public received: number;
735
736 public cleanup(): void;
737 public handle(message: Message): CollectorHandler<Snowflake, Message>;
738 public postCheck(): string;
739 }
740
741 export class MessageEmbed {
742 constructor(message: Message, data: object);
743 public author: MessageEmbedAuthor;
744 public readonly client: Client;
745 public color: number;
746 public readonly createdAt: Date;
747 public timestamp: number;
748 public description: string;
749 public fields: MessageEmbedField[];
750 public footer: MessageEmbedFooter;
751 public readonly hexColor: string;
752 public image: MessageEmbedImage;
753 public message: Message;
754 public provider: MessageEmbedProvider;
755 public thumbnail: MessageEmbedThumbnail;
756 public title: string;
757 public type: string;
758 public url: string;
759 public video: MessageEmbedVideo;
760 }
761
762 export class MessageEmbedAuthor {
763 constructor(embed: MessageEmbed, data: object);
764 public embed: MessageEmbed;
765 public iconURL: string;
766 public name: string;
767 public url: string;
768 }
769
770 export class MessageEmbedField {
771 constructor(embed: MessageEmbed, data: object);
772 public embed: MessageEmbed;
773 public inline: boolean;
774 public name: string;
775 public value: string;
776 }
777
778 export class MessageEmbedFooter {
779 constructor(embed: MessageEmbed, data: object);
780 public embed: MessageEmbed;
781 public iconURL: string;
782 public proxyIconURL: string;
783 public text: string;
784 }
785
786 export class MessageEmbedImage {
787 constructor(embed: MessageEmbed, data: object);
788 public embed: MessageEmbed;
789 public height: number;
790 public proxyURL: string;
791 public url: string;
792 public width: number;
793 }
794
795 export class MessageEmbedProvider {
796 constructor(embed: MessageEmbed, data: object);
797 public embed: MessageEmbed;
798 public name: string;
799 public url: string;
800 }
801
802 export class MessageEmbedThumbnail {
803 constructor(embed: MessageEmbed, data: object);
804 public embed: MessageEmbed;
805 public height: number;
806 public proxyURL: string;
807 public url: string;
808 public width: number;
809 }
810
811 export class MessageEmbedVideo {
812 constructor(embed: MessageEmbed, data: object);
813 public embed: MessageEmbed;
814 public height: number;
815 public url: string;
816 public width: number;
817 }
818
819 export class MessageMentions {
820 private _channels: Collection<Snowflake, GuildChannel>;
821 private _client: Client;
822 private _content: Message;
823 private _guild: Guild;
824 private _members: Collection<Snowflake, GuildMember>;
825
826 public readonly channels: Collection<Snowflake, TextChannel>;
827 public everyone: boolean;
828 public readonly members: Collection<Snowflake, GuildMember>;
829 public roles: Collection<Snowflake, Role>;
830 public users: Collection<Snowflake, User>;
831
832 public static CHANNELS_PATTERN: RegExp;
833 public static EVERYONE_PATTERN: RegExp;
834 public static ROLES_PATTERN: RegExp;
835 public static USERS_PATTERN: RegExp;
836 }
837
838 export class MessageReaction {
839 constructor(message: Message, emoji: object, count: number, me: boolean);
840 public count: number;
841 public readonly emoji: Emoji | ReactionEmoji;
842 public me: boolean;
843 public message: Message;
844 public users: Collection<string, User>;
845 public fetchUsers(limit?: number, options?: { after?: number; before?: number }): Promise<Collection<Snowflake, User>>;
846 public remove(user?: UserResolvable): Promise<MessageReaction>;
847 }
848
849 export class OAuth2Application {
850 constructor(client: Client, data: object);
851 public bot: object;
852 public botPublic: boolean;
853 public botRequireCodeGrant: boolean;
854 public readonly client: Client;
855 public readonly createdAt: Date;
856 public readonly createdTimestamp: number;
857 public description: string;
858 public flags: number;
859 public icon: string;
860 public iconURL: string;
861 public id: Snowflake;
862 public name: string;
863 public owner: User;
864 public redirectURIs: string[];
865 public rpcApplicationState: boolean;
866 public rpcOrigins: string[];
867 public secret: string;
868 public reset(): OAuth2Application;
869 public toString(): string;
870 }
871
872 export class PartialGuild {
873 constructor(client: Client, data: object);
874 public readonly client: Client;
875 public icon: string;
876 public id: Snowflake;
877 public name: string;
878 public splash: string;
879 }
880
881 export class PartialGuildChannel {
882 constructor(client: Client, data: object);
883 public readonly client: Client;
884 public id: Snowflake;
885 public name: string;
886 public type: string;
887 }
888
889 export class PermissionOverwrites {
890 constructor(guildChannel: GuildChannel, data: object);
891 public allow: number;
892 public channel: GuildChannel;
893 public deny: number;
894 public id: Snowflake;
895 public type: string;
896 public delete(reason?: string): Promise<PermissionOverwrites>;
897 }
898
899 export class Permissions {
900 constructor(permissions: number | PermissionResolvable[]);
901 constructor(member: GuildMember, permissions: number | PermissionResolvable[]);
902 private readonly raw: number;
903
904 public bitfield: number;
905 public member: GuildMember;
906 public add(...permissions: PermissionResolvable[]): this;
907 public has(permission: PermissionResolvable | PermissionResolvable[], checkAdmin?: boolean): boolean;
908 public hasPermission(permission: PermissionResolvable, explicit?: boolean): boolean;
909 public hasPermissions(permissions: PermissionResolvable[], explicit?: boolean): boolean;
910 public missing(permissions: PermissionResolvable[], checkAdmin?: boolean): PermissionResolvable[];
911 public missingPermissions(permissions: PermissionResolvable[], checkAdmin?: boolean): PermissionResolvable[];
912 public remove(...permissions: PermissionResolvable[]): this;
913 public serialize(checkAdmin?: boolean): PermissionObject;
914
915 public static ALL: number;
916 public static DEFAULT: number;
917 public static FLAGS: PermissionFlags;
918 public static resolve(permission: PermissionResolvable | PermissionResolvable[]): number;
919 }
920
921 export class Presence {
922 constructor(data: object);
923 public game: Game;
924 public status: 'online' | 'offline' | 'idle' | 'dnd';
925 public equals(presence: Presence): boolean;
926 }
927
928 export class ReactionCollector extends Collector<Snowflake, MessageReaction> {
929 constructor(message: Message, filter: CollectorFilter, options?: ReactionCollectorOptions);
930 public message: Message;
931 public options: ReactionCollectorOptions;
932 public total: number;
933 public users: Collection<Snowflake, User>;
934
935 public cleanup(): void;
936 public handle(reaction: MessageReaction): CollectorHandler<Snowflake, MessageReaction>;
937 public postCheck(reaction: MessageReaction, user: User): string;
938 }
939
940 export class ReactionEmoji {
941 constructor(reaction: MessageReaction, name: string, id: string);
942 public id: Snowflake;
943 public readonly identifier: string;
944 public name: string;
945 public reaction: MessageReaction;
946 public toString(): string;
947 }
948
949 class RequestHandler {
950 constructor(restManager: object);
951 public readonly globalLimit: boolean;
952 public queue: object[];
953 public restManager: object;
954 public handle(): void;
955 public push(request: object): void;
956 }
957
958 export class RichEmbed {
959 constructor(data?: RichEmbedOptions);
960 public author?: { name: string; url?: string; icon_url?: string; };
961 public color?: number;
962 public description?: string;
963 public fields?: { name: string; value: string; inline?: boolean; }[];
964 public file?: Attachment | string | FileOptions;
965 public footer?: { text?: string; icon_url?: string; };
966 public image?: { url: string; proxy_url?: string; height?: number; width?: number; };
967 public thumbnail?: { url: string; height?: number; width?: number; };
968 public timestamp?: Date;
969 public title?: string;
970 public url?: string;
971 public addBlankField(inline?: boolean): this;
972 public addField(name: StringResolvable, value: StringResolvable, inline?: boolean): this;
973 public attachFile(file: Attachment | FileOptions | string): this;
974 public setAuthor(name: StringResolvable, icon?: string, url?: string): this;
975 public setColor(color: ColorResolvable): this;
976 public setDescription(description: StringResolvable): this;
977 public setFooter(text: StringResolvable, icon?: string): this;
978 public setImage(url: string): this;
979 public setThumbnail(url: string): this;
980 public setTimestamp(timestamp?: Date): this;
981 public setTitle(title: StringResolvable): this;
982 public setURL(url: string): this;
983 }
984
985 export class Role {
986 constructor(guild: Guild, data: object);
987 public readonly calculatedPosition: number;
988 public readonly client: Client;
989 public color: number;
990 public readonly createdAt: Date;
991 public readonly createdTimestamp: number;
992 public readonly editable: boolean;
993 public guild: Guild;
994 public readonly hexColor: string;
995 public hoist: boolean;
996 public id: Snowflake;
997 public managed: boolean;
998 public readonly members: Collection<Snowflake, GuildMember>;
999 public mentionable: boolean;
1000 public name: string;
1001 public permissions: number;
1002 public position: number;
1003 public comparePositionTo(role: Role): number;
1004 public delete(reason?: string): Promise<Role>;
1005 public edit(data: RoleData, reason?: string): Promise<Role>;
1006 public equals(role: Role): boolean;
1007 public hasPermission(permission: PermissionResolvable | PermissionResolvable[], explicit?: boolean, checkAdmin?: boolean): boolean;
1008 public hasPermissions(permissions: PermissionResolvable[], explicit?: boolean): boolean;
1009 public serialize(): PermissionObject;
1010 public setColor(color: string | number, reason?: string): Promise<Role>;
1011 public setHoist(hoist: boolean, reason?: string): Promise<Role>;
1012 public setMentionable(mentionable: boolean, reason?: string): Promise<Role>;
1013 public setName(name: string, reason?: string): Promise<Role>;
1014 public setPermissions(permissions: PermissionResolvable[], reason?: string): Promise<Role>;
1015 public setPosition(position: number, relative?: boolean): Promise<Role>;
1016 public toString(): string;
1017
1018 public static comparePositions(role1: Role, role2: Role): number;
1019 }
1020
1021 class SecretKey {
1022 constructor(key: Uint8Array);
1023 public key: Uint8Array;
1024 }
1025
1026 class SequentialRequestHandler extends RequestHandler {
1027 constructor(restManager: object, endpoint: string);
1028 public busy: boolean;
1029 public endpoint: string;
1030 public readonly globalLimit: boolean;
1031 public queue: object[];
1032 public restManager: object;
1033 public timeDifference: number;
1034 public execute(item: object): Promise<object | Error>;
1035 public handle(): void;
1036 public push(request: object): void;
1037 }
1038
1039 export class Shard {
1040 constructor(manager: ShardingManager, id: number, args?: string[]);
1041 private _handleMessage(message: any): void;
1042
1043 public env: object;
1044 public id: string;
1045 public manager: ShardingManager;
1046 public process: ChildProcess;
1047 public eval(script: string): Promise<any>;
1048 public fetchClientValue(prop: string): Promise<any>;
1049 public send(message: any): Promise<Shard>;
1050 }
1051
1052 export class ShardClientUtil {
1053 constructor(client: Client);
1054 private _handleMessage(message: any): void;
1055 private _respond(type: string, message: any): void;
1056
1057 public readonly count: number;
1058 public readonly id: number;
1059 public broadcastEval(script: string): Promise<any[]>;
1060 public fetchClientValues(prop: string): Promise<any[]>;
1061 public send(message: any): Promise<void>;
1062
1063 public static singleton(client: Client): ShardClientUtil;
1064 }
1065
1066 export class ShardingManager extends EventEmitter {
1067 constructor(file: string, options?: {
1068 totalShards?: number | 'auto';
1069 respawn?: boolean;
1070 shardArgs?: string[];
1071 token?: string;
1072 });
1073 private _spawn(amount: number, delay: number): Promise<Collection<number, Shard>>;
1074
1075 public file: string;
1076 public respawn: boolean;
1077 public shardArgs: string[];
1078 public shards: Collection<number, Shard>;
1079 public token: string;
1080 public totalShards: number | string;
1081 public broadcast(message: any): Promise<Shard[]>;
1082 public broadcastEval(script: string): Promise<any[]>;
1083 public createShard(id: number): Promise<Shard>;
1084 public fetchClientValues(prop: string): Promise<any[]>;
1085 public spawn(amount?: number, delay?: number): Promise<Collection<number, Shard>>;
1086
1087 public on(event: 'launch', listener: (shard: Shard) => void): this;
1088 public on(event: 'message', listener: (shard: Shard, message: any) => void): this;
1089 public on(event: string, listener: Function): this;
1090
1091 public once(event: 'launch', listener: (shard: Shard) => void): this;
1092 public once(event: 'message', listener: (shard: Shard, message: any) => void): this;
1093 public once(event: string, listener: Function): this;
1094 }
1095
1096 export class SnowflakeUtil {
1097 public static deconstruct(snowflake: Snowflake): DeconstructedSnowflake;
1098 public static generate(): Snowflake;
1099 }
1100
1101 export class StreamDispatcher extends VolumeInterface {
1102 constructor(player: AudioPlayer, stream: NodeJS.ReadableStream, streamOptions: StreamOptions);
1103 public destroyed: boolean;
1104 public readonly passes: number;
1105 public paused: boolean;
1106 public player: AudioPlayer;
1107 public stream: ReadableStream | VoiceBroadcast;
1108 public readonly time: number;
1109 public readonly totalStreamTime: number;
1110 public end(reason?: string): void;
1111 public pause(): void;
1112 public resume(): void;
1113 public setBitrate(bitrate: number | 'auto'): void;
1114 }
1115
1116 export class TextChannel extends TextBasedChannel(GuildChannel) {
1117 constructor(guild: Guild, data: object);
1118 public lastMessageID: string;
1119 public readonly members: Collection<Snowflake, GuildMember>;
1120 public messages: Collection<Snowflake, Message>;
1121 public nsfw: boolean;
1122 public topic: string;
1123 public createWebhook(name: string, avatar: BufferResolvable, reason?: string): Promise<Webhook>;
1124 public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
1125 }
1126
1127 export class User extends PartialTextBasedChannel() {
1128 constructor(client: Client, data: object);
1129 public avatar: string;
1130 public readonly avatarURL: string;
1131 public bot: boolean;
1132 public readonly client: Client;
1133 public readonly createdAt: Date;
1134 public readonly createdTimestamp: number;
1135 public readonly defaultAvatarURL: string;
1136 public discriminator: string;
1137 public readonly displayAvatarURL: string;
1138 public readonly dmChannel: DMChannel;
1139 public id: Snowflake;
1140 public lastMessageID: string;
1141 public readonly note: string;
1142 public readonly presence: Presence;
1143 public readonly tag: string;
1144 public username: string;
1145 public addFriend(): Promise<User>;
1146 public block(): Promise<User>;
1147 public createDM(): Promise<DMChannel>;
1148 public deleteDM(): Promise<DMChannel>;
1149 public equals(user: User): boolean;
1150 public fetchProfile(): Promise<UserProfile>;
1151 public removeFriend(): Promise<User>;
1152 public setNote(note: string): Promise<User>;
1153 public toString(): string;
1154 public typingDurationIn(channel: ChannelResolvable): number;
1155 public typingIn(channel: ChannelResolvable): boolean;
1156 public typingSinceIn(channel: ChannelResolvable): Date;
1157 public unblock(): Promise<User>;
1158 }
1159
1160 export class UserConnection {
1161 constructor(user: User, data: object);
1162 public id: string;
1163 public integrations: object[];
1164 public name: string;
1165 public revoked: boolean;
1166 public type: string;
1167 public user: User;
1168 }
1169
1170 export class UserProfile {
1171 constructor(user: User, data: object);
1172 public readonly client: Client;
1173 public connections: Collection<string, UserConnection>;
1174 public mutualGuilds: Collection<Snowflake, Guild>;
1175 public premium: boolean;
1176 public premiumSince: Date;
1177 public user: User;
1178 }
1179
1180 export class Util {
1181 public static arraysEqual(a: any[], b: any[]): boolean;
1182 public static cloneObject(obj: object): object;
1183 public static convertToBuffer(ab: ArrayBuffer | string): Buffer;
1184 public static escapeMarkdown(text: string, onlyCodeBlock?: boolean, onlyInlineCode?: boolean): string;
1185 public static fetchRecommendedShards(token: string, guildsPerShard?: number): Promise<number>;
1186 public static makeError(obj: { name: string, message: string, stack: string }): Error;
1187 public static makePlainError(err: Error): object;
1188 public static mergeDefault(def: object, given: object): object;
1189 public static moveElementInArray(array: any[], element: any, newIndex: number, offset?: boolean): number;
1190 public static parseEmoji(text: string): { animated: boolean; name: string; id: string; };
1191 public static splitMessage(text: string, options?: SplitOptions): string | string[];
1192 public static str2ab(str: string): ArrayBuffer;
1193 }
1194
1195 export class VoiceBroadcast extends EventEmitter {
1196 constructor(client: Client);
1197 public readonly client: Client;
1198 public currentTranscoder: object;
1199 public readonly dispatchers: StreamDispatcher[];
1200 public prism: object;
1201 public destroy(): void;
1202 public end(): void;
1203 public pause(): void;
1204 public playArbitraryInput(input: string, options?: StreamOptions): VoiceBroadcast;
1205 public playConvertedStream(stream: ReadableStream, options?: StreamOptions): VoiceBroadcast;
1206 public playFile(file: string, options?: StreamOptions): StreamDispatcher;
1207 public playOpusStream(stream: ReadableStream, options?: StreamOptions): StreamDispatcher;
1208 public playStream(stream: ReadableStream, options?: StreamOptions): VoiceBroadcast;
1209 public resume(): void;
1210
1211 public on(event: string, listener: Function): this;
1212 public on(event: 'end', listener: () => void): this;
1213 public on(event: 'error', listener: (error: Error) => void): this;
1214 public on(event: 'subscribe', listener: (dispatcher: StreamDispatcher) => void): this;
1215 public on(event: 'unsubscribe', listener: (dispatcher: StreamDispatcher) => void): this;
1216 public on(event: 'warn', listener: (warning: string | Error) => void): this;
1217 public on(event: string, listener: Function): this;
1218
1219 public once(event: 'end', listener: () => void): this;
1220 public once(event: 'error', listener: (error: Error) => void): this;
1221 public once(event: 'subscribe', listener: (dispatcher: StreamDispatcher) => void): this;
1222 public once(event: 'unsubscribe', listener: (dispatcher: StreamDispatcher) => void): this;
1223 public once(event: 'warn', listener: (warning: string | Error) => void): this;
1224 public once(event: string, listener: Function): this;
1225 }
1226
1227 export class VoiceChannel extends GuildChannel {
1228 constructor(guild: Guild, data: object);
1229 public bitrate: number;
1230 public readonly connection: VoiceConnection;
1231 public readonly full: boolean;
1232 public readonly joinable: boolean;
1233 public members: Collection<Snowflake, GuildMember>;
1234 public readonly speakable: boolean;
1235 public userLimit: number;
1236 public join(): Promise<VoiceConnection>;
1237 public leave(): void;
1238 public setBitrate(bitrate: number, reason?: string): Promise<VoiceChannel>;
1239 public setUserLimit(userLimit: number, reason?: string): Promise<VoiceChannel>;
1240 }
1241
1242 export class VoiceConnection extends EventEmitter {
1243 constructor(voiceManager: ClientVoiceManager, channel: VoiceChannel);
1244 private authentication: object;
1245 private sockets: object;
1246 private ssrcMap: Map<number, boolean>;
1247 private authenticate(): void;
1248 private authenticateFailed(reason: string): void;
1249 private checkAuthenticated(): void;
1250 private cleanup(): void;
1251 private connect(): void;
1252 private onReady(data: object): void;
1253 private onSessionDescription(mode: string, secret: string): void;
1254 private onSpeaking(data: object): void;
1255 private reconnect(token: string, endpoint: string): void;
1256 private setSpeaking(value: boolean): void;
1257 private updateChannel(channel: VoiceChannel): void;
1258
1259 public channel: VoiceChannel;
1260 public readonly client: Client;
1261 public readonly dispatcher: StreamDispatcher;
1262 public player: AudioPlayer;
1263 public prism: object;
1264 public receivers: VoiceReceiver[];
1265 public speaking: boolean;
1266 public status: number;
1267 public voiceManager: ClientVoiceManager;
1268 public createReceiver(): VoiceReceiver;
1269 public disconnect(): void;
1270 public playArbitraryInput(input: string, options?: StreamOptions): StreamDispatcher;
1271 public playBroadcast(broadcast: VoiceBroadcast, options?: StreamOptions): StreamDispatcher;
1272 public playConvertedStream(stream: ReadableStream, options?: StreamOptions): StreamDispatcher;
1273 public playFile(file: string, options?: StreamOptions): StreamDispatcher;
1274 public playOpusStream(steam: ReadableStream, options?: StreamOptions): StreamDispatcher;
1275 public playStream(stream: ReadableStream, options?: StreamOptions): StreamDispatcher;
1276 public sendVoiceStateUpdate(options: object): void;
1277 public setSessionID(sessionID: string): void;
1278 public setTokenAndEndpoint(token: string, endpoint: string): void;
1279
1280 public on(event: 'authenticated', listener: () => void): this;
1281 public on(event: 'debug', listener: (message: string) => void): this;
1282 public on(event: 'disconnect', listener: (error: Error) => void): this;
1283 public on(event: 'error', listener: (error: Error) => void): this;
1284 public on(event: 'failed', listener: (error: Error) => void): this;
1285 public on(event: 'newSession', listener: () => void): this;
1286 public on(event: 'ready', listener: () => void): this;
1287 public on(event: 'reconnecting', listener: () => void): this;
1288 public on(event: 'speaking', listener: (user: User, speaking: boolean) => void): this;
1289 public on(event: 'warn', listener: (warning: string | Error) => void): this;
1290 public on(event: string, listener: Function): this;
1291
1292 public once(event: 'authenticated', listener: () => void): this;
1293 public once(event: 'debug', listener: (message: string) => void): this;
1294 public once(event: 'disconnect', listener: (error: Error) => void): this;
1295 public once(event: 'error', listener: (error: Error) => void): this;
1296 public once(event: 'failed', listener: (error: Error) => void): this;
1297 public once(event: 'newSession', listener: () => void): this;
1298 public once(event: 'ready', listener: () => void): this;
1299 public once(event: 'reconnecting', listener: () => void): this;
1300 public once(event: 'speaking', listener: (user: User, speaking: boolean) => void): this;
1301 public once(event: 'warn', listener: (warning: string | Error) => void): this;
1302 public once(event: string, listener: Function): this;
1303 }
1304
1305 class VoiceConnectionUDPClient extends EventEmitter {
1306 constructor(voiceConnection: VoiceConnection);
1307 public discordAddress: string;
1308 public readonly discordPort: number;
1309 public localAddress: string;
1310 public localPort: string;
1311 public socket: any;
1312 public voiceConnection: VoiceConnection;
1313 public findEndpointAddress(): Promise<string>;
1314 public send(packet: object): Promise<object>;
1315 }
1316
1317 export class VoiceReceiver extends EventEmitter {
1318 constructor(connection: VoiceConnection);
1319 private stoppedSpeaking(user: User): void;
1320
1321 public destroyed: boolean;
1322 public voiceConnection: VoiceConnection;
1323 public createOpusStream(user: UserResolvable): ReadableStream;
1324 public createPCMStream(user: UserResolvable): ReadableStream;
1325 public destroy(): void;
1326 public recreate(): void;
1327
1328 public on(event: 'opus', listener: (user: User, buffer: Buffer) => void): this;
1329 public on(event: 'pcm', listener: (user: User, buffer: Buffer) => void): this;
1330 public on(event: 'warn', listener: (reason: string, message: string) => void): this;
1331 public on(event: string, listener: Function): this;
1332
1333 public once(event: 'opus', listener: (user: User, buffer: Buffer) => void): this;
1334 public once(event: 'pcm', listener: (user: User, buffer: Buffer) => void): this;
1335 public once(event: 'warn', listener: (reason: string, message: string) => void): this;
1336 public once(event: string, listener: Function): this;
1337 }
1338
1339 export class VoiceRegion {
1340 constructor(data: object);
1341 public custom: boolean;
1342 public deprecated: boolean;
1343 public id: string;
1344 public name: string;
1345 public optimal: boolean;
1346 public sampleHostname: string;
1347 public vip: boolean;
1348 }
1349
1350 class VoiceWebsocket extends EventEmitter {
1351 constructor(voiceConnection: VoiceConnection);
1352 public attempts: number;
1353 public readonly client: Client;
1354 public voiceConnection: VoiceConnection;
1355 public ws: any;
1356 public clearHeartbeat(): void;
1357 public connect(): void;
1358 public onClose(): void;
1359 public onError(error: Error): void;
1360 public onMessage(event: any): void;
1361 public onOpen(): void;
1362 public onPacket(packet: object): void;
1363 public reset(): void;
1364 public send(data: string): Promise<string>;
1365 public sendHeartbeat(): void;
1366 public sendPacket(packet: object): Promise<string>;
1367 public setHeartbeat(interval: number): void;
1368
1369 public on(event: 'ready', listener: (packet: object) => void): this;
1370 public on(event: 'sessionDescription', listener: (encryptionMode: string, secretKey: SecretKey) => void): this;
1371 public on(event: 'speaking', listener: (data: object) => void): this;
1372 public on(event: 'unknownPacket', listener: (packet: object) => void): this;
1373 public on(event: 'warn', listener: (warn: string) => void): this;
1374 public on(event: string, listener: Function): this;
1375
1376 public once(event: 'ready', listener: (packet: object) => void): this;
1377 public once(event: 'sessionDescription', listener: (encryptionMode: string, secretKey: SecretKey) => void): this;
1378 public once(event: 'speaking', listener: (data: object) => void): this;
1379 public once(event: 'unknownPacket', listener: (packet: object) => void): this;
1380 public once(event: 'warn', listener: (warn: string) => void): this;
1381 public once(event: string, listener: Function): this;
1382 }
1383
1384 export class VolumeInterface extends EventEmitter {
1385 constructor(object?: { volume: number })
1386 public readonly volume: number;
1387 public readonly volumeDecibels: number;
1388 public readonly volumeLogarithmic: number;
1389 public setVolume(volume: number): void;
1390 public setVolumeDecibels(db: number): void;
1391 public setVolumeLogarithmic(value: number): void;
1392
1393 public on(event: 'debug', listener: (information: string) => void): this;
1394 public on(event: 'end', listener: (reason: string) => void): this;
1395 public on(event: 'error', listener: (err: Error) => void): this;
1396 public on(event: 'speaking', listener: (value: boolean) => void): this;
1397 public on(event: 'start', listener: () => void): this;
1398 public on(event: 'volumeChange', listener: (oldVolume: number, newVolume: number) => void): this;
1399 public on(event: string, listener: Function): this;
1400
1401 public once(event: 'debug', listener: (information: string) => void): this;
1402 public once(event: 'end', listener: (reason: string) => void): this;
1403 public once(event: 'error', listener: (err: Error) => void): this;
1404 public once(event: 'speaking', listener: (value: boolean) => void): this;
1405 public once(event: 'start', listener: () => void): this;
1406 public once(event: 'volumeChange', listener: (oldVolume: number, newVolume: number) => void): this;
1407 public once(event: string, listener: Function): this;
1408 }
1409
1410 export class Webhook {
1411 constructor(client: Client, dataOrID: object | string, token: string);
1412 public avatar: string;
1413 public channelID: string;
1414 public readonly client: Client;
1415 public guildID: string;
1416 public id: Snowflake;
1417 public name: string;
1418 public owner: User | object;
1419 public token: string;
1420 public delete(reason?: string): Promise<void>;
1421 public edit(name: string, avatar: BufferResolvable): Promise<Webhook>;
1422 public send(content?: StringResolvable, options?: WebhookMessageOptions | RichEmbed | Attachment): Promise<Message | Message[]>;
1423 public send(options?: WebhookMessageOptions | RichEmbed | Attachment): Promise<Message | Message[]>;
1424 public sendCode(lang: string, content: StringResolvable, options?: WebhookMessageOptions): Promise<Message | Message[]>;
1425 public sendFile(attachment: BufferResolvable, name?: string, content?: StringResolvable, options?: WebhookMessageOptions): Promise<Message>;
1426 public sendMessage(content?: StringResolvable, options?: WebhookMessageOptions): Promise<Message | Message[]>;
1427 public sendMessage(options?: WebhookMessageOptions): Promise<Message | Message[]>;
1428 public sendSlackMessage(body: object): Promise<void>;
1429 }
1430
1431 export class WebhookClient extends Webhook {
1432 constructor(id: string, token: string, options?: ClientOptions);
1433 private _intervals: Set<NodeJS.Timer>;
1434 private _timeouts: Set<NodeJS.Timer>;
1435 private resolver: ClientDataResolver;
1436 private rest: object;
1437
1438 public options: ClientOptions;
1439 public clearInterval(interval: NodeJS.Timer): void;
1440 public clearTimeout(timeout: NodeJS.Timer): void;
1441 public destroy(): void;
1442 public setInterval(fn: Function, delay: number, ...args: any[]): NodeJS.Timer;
1443 public setTimeout(fn: Function, delay: number, ...args: any[]): NodeJS.Timer;
1444 }
1445
1446//#endregion
1447
1448//#region Mixins
1449
1450 // Model the TextBasedChannel mixin system, allowing application of these fields
1451 // to the classes that use these methods without having to manually add them
1452 // to each of those classes
1453
1454 type Constructable<T> = new (...args: any[]) => T;
1455 const PartialTextBasedChannel: <T>(Base?: Constructable<T>) => Constructable<T & PartialTextBasedChannelFields>;
1456 const TextBasedChannel: <T>(Base?: Constructable<T>) => Constructable<T & TextBasedChannelFields>;
1457
1458 type PartialTextBasedChannelFields = {
1459 lastMessage: Message;
1460 acknowledge(): Promise<DMChannel | GroupDMChannel | TextChannel>;
1461 send(content?: StringResolvable, options?: MessageOptions | RichEmbed | Attachment): Promise<Message | Message[]>;
1462 send(options?: MessageOptions | RichEmbed | Attachment): Promise<Message | Message[]>;
1463 sendCode(lang: string, content: StringResolvable, options?: MessageOptions): Promise<Message | Message[]>;
1464 sendEmbed(embed: RichEmbed | RichEmbedOptions, content?: string, options?: MessageOptions): Promise<Message>;
1465 sendEmbed(embed: RichEmbed | RichEmbedOptions, options?: MessageOptions): Promise<Message>;
1466 sendFile(attachment: BufferResolvable, name?: string, content?: StringResolvable, options?: MessageOptions): Promise<Message>;
1467 sendMessage(content?: string, options?: MessageOptions): Promise<Message | Message[]>;
1468 sendMessage(options?: MessageOptions): Promise<Message | Message[]>;
1469 };
1470
1471 type TextBasedChannelFields = {
1472 typing: boolean;
1473 typingCount: number;
1474 awaitMessages(filter: CollectorFilter, options?: AwaitMessagesOptions): Promise<Collection<string, Message>>;
1475 bulkDelete(messages: Collection<string, Message> | Message[] | number, filterOld?: boolean): Promise<Collection<string, Message>>;
1476 createCollector(filter: CollectorFilter, options?: CollectorOptions): MessageCollector;
1477 createMessageCollector(filter: CollectorFilter, options?: CollectorOptions): MessageCollector;
1478 fetchMessage(messageID: string): Promise<Message>;
1479 fetchMessages(options?: ChannelLogsQueryOptions): Promise<Collection<string, Message>>;
1480 fetchPinnedMessages(): Promise<Collection<string, Message>>;
1481 search(options?: MessageSearchOptions): Promise<MessageSearchResult>;
1482 startTyping(count?: number): void;
1483 stopTyping(force?: boolean): void;
1484 } & PartialTextBasedChannelFields;
1485
1486//#endregion
1487
1488//#region Typedefs
1489
1490 type ActivityType = 'PLAYING'
1491 | 'STREAMING'
1492 | 'LISTENING'
1493 | 'WATCHING';
1494
1495 type AddGuildMemberOptions = {
1496 accessToken: String;
1497 nick?: string;
1498 roles?: Collection<string, Role> | Role[] | string[];
1499 mute?: boolean;
1500 deaf?: boolean;
1501 }
1502
1503 type AuditLogChange = {
1504 key: string;
1505 old?: any;
1506 new?: any;
1507 };
1508
1509 type AwaitMessagesOptions = MessageCollectorOptions & { errors?: string[] };
1510
1511 type AwaitReactionsOptions = ReactionCollectorOptions & { errors?: string[] };
1512
1513 type BanOptions = {
1514 days?: number;
1515 reason?: string;
1516 };
1517
1518 type Base64Resolvable = Buffer | Base64String;
1519
1520 type Base64String = string;
1521
1522 type BufferResolvable = Buffer | string;
1523
1524 type ChannelData = {
1525 name?: string;
1526 position?: number;
1527 topic?: string;
1528 bitrate?: number;
1529 userLimit?: number;
1530 };
1531
1532 type ChannelLogsQueryOptions = {
1533 limit?: number
1534 before?: Snowflake
1535 after?: Snowflake
1536 around?: Snowflake
1537 };
1538
1539 type ChannelPosition = {
1540 channel: ChannelResolvable;
1541 position: number;
1542 };
1543
1544 type ChannelResolvable = Channel | Guild | Message | Snowflake;
1545
1546 type ClientOptions = {
1547 apiRequestMethod?: string;
1548 shardId?: number;
1549 shardCount?: number;
1550 messageCacheMaxSize?: number;
1551 messageCacheLifetime?: number;
1552 messageSweepInterval?: number;
1553 fetchAllMembers?: boolean;
1554 disableEveryone?: boolean;
1555 sync?: boolean;
1556 restWsBridgeTimeout?: number;
1557 restTimeOffset?: number;
1558 disabledEvents?: WSEventType[];
1559 ws?: WebSocketOptions;
1560 http?: HTTPOptions;
1561 };
1562
1563 type CollectorHandler<K, V> = { key: K, value: V };
1564 type CollectorFilter = (...args: any[]) => boolean;
1565 type CollectorOptions = { time?: number };
1566
1567 type ColorResolvable = ('DEFAULT'
1568 | 'AQUA'
1569 | 'GREEN'
1570 | 'BLUE'
1571 | 'PURPLE'
1572 | 'GOLD'
1573 | 'ORANGE'
1574 | 'RED'
1575 | 'GREY'
1576 | 'DARKER_GREY'
1577 | 'NAVY'
1578 | 'DARK_AQUA'
1579 | 'DARK_GREEN'
1580 | 'DARK_BLUE'
1581 | 'DARK_PURPLE'
1582 | 'DARK_GOLD'
1583 | 'DARK_ORANGE'
1584 | 'DARK_RED'
1585 | 'DARK_GREY'
1586 | 'LIGHT_GREY'
1587 | 'DARK_NAVY'
1588 | 'RANDOM')
1589 | [number, number, number]
1590 | number
1591 | string;
1592
1593 type DeconstructedSnowflake = {
1594 timestamp: number;
1595 date: Date;
1596 workerID: number;
1597 processID: number;
1598 increment: number;
1599 binary: string;
1600 };
1601
1602 type EmojiEditData = {
1603 name?: string;
1604 roles?: Collection<Snowflake, Role> | Role[] | Snowflake[];
1605 };
1606
1607 type EmojiIdentifierResolvable = string | Emoji | ReactionEmoji;
1608
1609 type FileOptions = {
1610 attachment: BufferResolvable;
1611 name?: string;
1612 };
1613
1614 type GroupDMRecipientOptions = {
1615 user?: UserResolvable | Snowflake;
1616 accessToken?: string;
1617 nick?: string;
1618 };
1619
1620 type GuildAuditLogsAction = keyof GuildAuditLogsActions;
1621
1622 type GuildAuditLogsActions = {
1623 ALL?: null,
1624 GUILD_UPDATE?: number,
1625 CHANNEL_CREATE?: number,
1626 CHANNEL_UPDATE?: number,
1627 CHANNEL_DELETE?: number,
1628 CHANNEL_OVERWRITE_CREATE?: number,
1629 CHANNEL_OVERWRITE_UPDATE?: number,
1630 CHANNEL_OVERWRITE_DELETE?: number,
1631 MEMBER_KICK?: number,
1632 MEMBER_PRUNE?: number,
1633 MEMBER_BAN_ADD?: number,
1634 MEMBER_BAN_REMOVE?: number,
1635 MEMBER_UPDATE?: number,
1636 MEMBER_ROLE_UPDATE?: number,
1637 ROLE_CREATE?: number,
1638 ROLE_UPDATE?: number,
1639 ROLE_DELETE?: number,
1640 INVITE_CREATE?: number,
1641 INVITE_UPDATE?: number,
1642 INVITE_DELETE?: number,
1643 WEBHOOK_CREATE?: number,
1644 WEBHOOK_UPDATE?: number,
1645 WEBHOOK_DELETE?: number,
1646 EMOJI_CREATE?: number,
1647 EMOJI_UPDATE?: number,
1648 EMOJI_DELETE?: number,
1649 MESSAGE_DELETE?: number,
1650 };
1651
1652 type GuildAuditLogsActionType = 'CREATE'
1653 | 'DELETE'
1654 | 'UPDATE'
1655 | 'ALL';
1656
1657 type GuildAuditLogsFetchOptions = {
1658 before?: Snowflake | GuildAuditLogsEntry;
1659 after?: Snowflake | GuildAuditLogsEntry;
1660 limit?: number;
1661 user?: UserResolvable;
1662 type?: string | number;
1663 };
1664
1665 type GuildAuditLogsTarget = keyof GuildAuditLogsTargets;
1666
1667 type GuildAuditLogsTargets = {
1668 ALL?: string;
1669 GUILD?: string;
1670 CHANNEL?: string;
1671 USER?: string;
1672 ROLE?: string;
1673 INVITE?: string;
1674 WEBHOOK?: string;
1675 EMOJI?: string;
1676 MESSAGE?: string;
1677 };
1678
1679 type GuildChannelMessageNotifications = MessageNotifications
1680 & 'INHERIT';
1681
1682 type GuildEditData = {
1683 name?: string;
1684 region?: string;
1685 verificationLevel?: number;
1686 explicitContentFilter?: number;
1687 afkChannel?: ChannelResolvable;
1688 systemChannel?: ChannelResolvable;
1689 afkTimeout?: number;
1690 icon?: Base64Resolvable;
1691 owner?: GuildMemberResolvable;
1692 splash?: Base64Resolvable;
1693 };
1694
1695 type GuildMemberEditData = {
1696 nick?: string;
1697 roles?: Collection<Snowflake, Role> | Role[] | Snowflake[];
1698 mute?: boolean;
1699 deaf?: boolean;
1700 channel?: ChannelResolvable;
1701 };
1702
1703 type GuildMemberResolvable = GuildMember | User;
1704
1705 type GuildResolvable = Guild | Snowflake;
1706
1707 type HTTPOptions = {
1708 version?: number;
1709 host?: string;
1710 cdn?: string;
1711 };
1712
1713 type InviteOptions = {
1714 temporary?: boolean;
1715 maxAge?: number;
1716 maxUses?: number;
1717 unique?: boolean;
1718 };
1719
1720 type InviteResolvable = string;
1721
1722 type MessageCollectorOptions = CollectorOptions & {
1723 max?: number;
1724 maxMatches?: number;
1725 };
1726
1727 type MessageEditOptions = {
1728 embed?: RichEmbedOptions;
1729 code?: string | boolean;
1730 };
1731
1732 type MessageNotifications = 'EVERYTHING'
1733 | 'MENTIONS'
1734 | 'NOTHING';
1735
1736 type MessageOptions = {
1737 tts?: boolean;
1738 nonce?: string;
1739 embed?: RichEmbed | RichEmbedOptions,
1740 disableEveryone?: boolean;
1741 file?: FileOptions | string;
1742 files?: FileOptions[] | string[];
1743 code?: string | boolean;
1744 split?: boolean | SplitOptions;
1745 reply?: UserResolvable;
1746 };
1747
1748 type MessageSearchOptions = {
1749 content?: string;
1750 maxID?: Snowflake;
1751 minID?: Snowflake;
1752 has?: 'link'
1753 | 'embed'
1754 | 'file'
1755 | 'video'
1756 | 'image'
1757 | 'sound'
1758 | '-link'
1759 | '-embed'
1760 | '-file'
1761 | '-video'
1762 | '-image'
1763 | '-sound';
1764 channel?: ChannelResolvable;
1765 author?: UserResolvable;
1766 authorType?: 'user'
1767 | 'bot'
1768 | 'webhook'
1769 | '-user'
1770 | '-bot'
1771 | '-webhook';
1772 sortBy?: 'relevant' | 'recent';
1773 sortOrder?: 'asc' | 'desc';
1774 contextSize?: number;
1775 limit?: number;
1776 offset?: number;
1777 mentions?: UserResolvable;
1778 mentionsEveryone?: boolean;
1779 linkHostname?: string;
1780 embedProvider?: string;
1781 embedType?: 'image' | 'video' | 'url' | 'rich';
1782 attachmentFilename?: string;
1783 attachmentExtension?: string;
1784 before?: Date;
1785 after?: Date;
1786 during?: Date;
1787 nsfw?: boolean;
1788 };
1789
1790 type MessageSearchResult = {
1791 totalResults: number;
1792 messages: Message[][];
1793 }
1794
1795 type PermissionFlags = {
1796 ADMINISTRATOR?: number;
1797 CREATE_INSTANT_INVITE?: number;
1798 KICK_MEMBERS?: number;
1799 BAN_MEMBERS?: number;
1800 MANAGE_CHANNELS?: number;
1801 MANAGE_GUILD?: number;
1802 ADD_REACTIONS?: number;
1803 VIEW_AUDIT_LOG?: number;
1804 VIEW_CHANNEL?: number;
1805 READ_MESSAGES?: number;
1806 SEND_MESSAGES?: number;
1807 SEND_TTS_MESSAGES?: number;
1808 MANAGE_MESSAGES?: number;
1809 EMBED_LINKS?: number;
1810 ATTACH_FILES?: number;
1811 READ_MESSAGE_HISTORY?: number;
1812 MENTION_EVERYONE?: number;
1813 USE_EXTERNAL_EMOJIS?: number;
1814 EXTERNAL_EMOJIS?: number;
1815 CONNECT?: number;
1816 SPEAK?: number;
1817 MUTE_MEMBERS?: number;
1818 DEAFEN_MEMBERS?: number;
1819 MOVE_MEMBERS?: number;
1820 USE_VAD?: number;
1821 CHANGE_NICKNAME?: number;
1822 MANAGE_NICKNAMES?: number;
1823 MANAGE_ROLES?: number;
1824 MANAGE_ROLES_OR_PERMISSIONS?: number;
1825 MANAGE_WEBHOOKS?: number;
1826 MANAGE_EMOJIS?: number;
1827 };
1828
1829 type PermissionObject = {
1830 ADMINISTRATOR?: boolean;
1831 CREATE_INSTANT_INVITE?: boolean;
1832 KICK_MEMBERS?: boolean;
1833 BAN_MEMBERS?: boolean;
1834 MANAGE_CHANNELS?: boolean;
1835 MANAGE_GUILD?: boolean;
1836 ADD_REACTIONS?: boolean;
1837 VIEW_AUDIT_LOG?: boolean;
1838 VIEW_CHANNEL?: number;
1839 READ_MESSAGES?: boolean;
1840 SEND_MESSAGES?: boolean;
1841 SEND_TTS_MESSAGES?: boolean;
1842 MANAGE_MESSAGES?: boolean;
1843 EMBED_LINKS?: boolean;
1844 ATTACH_FILES?: boolean;
1845 READ_MESSAGE_HISTORY?: boolean;
1846 MENTION_EVERYONE?: boolean;
1847 USE_EXTERNAL_EMOJIS?: boolean;
1848 EXTERNAL_EMOJIS?: boolean;
1849 CONNECT?: boolean;
1850 SPEAK?: boolean;
1851 MUTE_MEMBERS?: boolean;
1852 DEAFEN_MEMBERS?: boolean;
1853 MOVE_MEMBERS?: boolean;
1854 USE_VAD?: boolean;
1855 CHANGE_NICKNAME?: boolean;
1856 MANAGE_NICKNAMES?: boolean;
1857 MANAGE_ROLES?: boolean;
1858 MANAGE_ROLES_OR_PERMISSIONS?: boolean;
1859 MANAGE_WEBHOOKS?: boolean;
1860 MANAGE_EMOJIS?: boolean;
1861 };
1862
1863 type PermissionString = 'ADMINISTRATOR'
1864 | 'CREATE_INSTANT_INVITE'
1865 | 'KICK_MEMBERS'
1866 | 'BAN_MEMBERS'
1867 | 'MANAGE_CHANNELS'
1868 | 'MANAGE_GUILD'
1869 | 'ADD_REACTIONS'
1870 | 'VIEW_CHANNEL'
1871 | 'READ_MESSAGES'
1872 | 'SEND_MESSAGES'
1873 | 'SEND_TTS_MESSAGES'
1874 | 'MANAGE_MESSAGES'
1875 | 'EMBED_LINKS'
1876 | 'ATTACH_FILES'
1877 | 'READ_MESSAGE_HISTORY'
1878 | 'MENTION_EVERYONE'
1879 | 'USE_EXTERNAL_EMOJIS'
1880 | 'EXTERNAL_EMOJIS'
1881 | 'CONNECT'
1882 | 'SPEAK'
1883 | 'MUTE_MEMBERS'
1884 | 'DEAFEN_MEMBERS'
1885 | 'MOVE_MEMBERS'
1886 | 'USE_VAD'
1887 | 'CHANGE_NICKNAME'
1888 | 'MANAGE_NICKNAMES'
1889 | 'MANAGE_ROLES'
1890 | 'MANAGE_ROLES_OR_PERMISSIONS'
1891 | 'MANAGE_WEBHOOKS'
1892 | 'MANAGE_EMOJIS';
1893
1894 type PermissionOverwriteOptions = PermissionObject;
1895
1896 type PermissionResolvable = PermissionString | number;
1897
1898 type PresenceData = {
1899 status?: PresenceStatus;
1900 afk?: boolean;
1901 game?: {
1902 name?: string;
1903 url?: string;
1904 }
1905 }
1906
1907 type PresenceStatus = 'online' | 'idle' | 'invisible' | 'dnd';
1908
1909 type ReactionCollectorOptions = CollectorOptions & {
1910 max?: number;
1911 maxEmojis?: number;
1912 maxUsers?: number;
1913 };
1914
1915 type RichEmbedOptions = {
1916 title?: string;
1917 description?: string;
1918 url?: string;
1919 timestamp?: Date;
1920 color?: number | string;
1921 fields?: { name: string; value: string; inline?: boolean; }[];
1922 file?: Attachment| string | FileOptions;
1923 author?: { name: string; url?: string; icon_url?: string; };
1924 thumbnail?: { url: string; height?: number; width?: number; };
1925 image?: { url: string; proxy_url?: string; height?: number; width?: number; };
1926 video?: { url: string; height: number; width: number; };
1927 footer?: { text?: string; icon_url?: string; };
1928 };
1929
1930 type RoleData = {
1931 name?: string;
1932 color?: ColorResolvable;
1933 hoist?: boolean;
1934 position?: number;
1935 permissions?: PermissionString[];
1936 mentionable?: boolean;
1937 };
1938
1939 type RoleResolvable = Role | string;
1940
1941 type Snowflake = string;
1942
1943 type SplitOptions = {
1944 maxLength?: number;
1945 char?: string;
1946 prepend?: string;
1947 append?: string;
1948 };
1949
1950 type Status = number;
1951
1952 type StreamOptions = {
1953 seek?: number;
1954 volume?: number;
1955 passes?: number;
1956 bitrate?: number | 'auto';
1957 };
1958
1959 type StringResolvable = string | string[] | any;
1960
1961 type UserResolvable = User | Snowflake | Message | Guild | GuildMember;
1962
1963 type VoiceStatus = number;
1964
1965 type WebhookMessageOptions = {
1966 username?: string;
1967 avatarURL?: string;
1968 tts?: boolean;
1969 nonce?: string;
1970 embeds?: (RichEmbed | object)[];
1971 disableEveryone?: boolean;
1972 file?: FileOptions | BufferResolvable | Attachment;
1973 files?: (FileOptions | BufferResolvable | Attachment)[];
1974 code?: string | boolean;
1975 split?: boolean | SplitOptions;
1976 };
1977
1978 type WebSocketOptions = {
1979 large_threshold?: number;
1980 compress?: boolean;
1981 };
1982
1983 type WSEventType = 'READY'
1984 | 'RESUMED'
1985 | 'GUILD_SYNC'
1986 | 'GUILD_CREATE'
1987 | 'GUILD_DELETE'
1988 | 'GUILD_UPDATE'
1989 | 'GUILD_MEMBER_ADD'
1990 | 'GUILD_MEMBER_REMOVE'
1991 | 'GUILD_MEMBER_UPDATE'
1992 | 'GUILD_MEMBERS_CHUNK'
1993 | 'GUILD_ROLE_CREATE'
1994 | 'GUILD_ROLE_DELETE'
1995 | 'GUILD_ROLE_UPDATE'
1996 | 'GUILD_BAN_ADD'
1997 | 'GUILD_BAN_REMOVE'
1998 | 'CHANNEL_CREATE'
1999 | 'CHANNEL_DELETE'
2000 | 'CHANNEL_UPDATE'
2001 | 'CHANNEL_PINS_UPDATE'
2002 | 'MESSAGE_CREATE'
2003 | 'MESSAGE_DELETE'
2004 | 'MESSAGE_UPDATE'
2005 | 'MESSAGE_DELETE_BULK'
2006 | 'MESSAGE_REACTION_ADD'
2007 | 'MESSAGE_REACTION_REMOVE'
2008 | 'MESSAGE_REACTION_REMOVE_ALL'
2009 | 'USER_UPDATE'
2010 | 'USER_NOTE_UPDATE'
2011 | 'USER_SETTINGS_UPDATE'
2012 | 'USER_GUILD_SETTINGS_UPDATE'
2013 | 'PRESENCE_UPDATE'
2014 | 'VOICE_STATE_UPDATE'
2015 | 'TYPING_START'
2016 | 'VOICE_SERVER_UPDATE'
2017 | 'RELATIONSHIP_ADD'
2018 | 'RELATIONSHIP_REMOVE';
2019
2020//#endregion
2021}