index.d.ts (108967B)
1 declare enum ChannelType { 2 text = 0, 3 dm = 1, 4 voice = 2, 5 group = 3, 6 category = 4, 7 news = 5, 8 store = 6, 9 unknown = 7, 10 } 11 12 declare module 'discord.js' { 13 import BaseCollection from '@discordjs/collection'; 14 import { ChildProcess } from 'child_process'; 15 import { EventEmitter } from 'events'; 16 import { PathLike } from 'fs'; 17 import { Readable, Stream, Writable } from 'stream'; 18 import * as WebSocket from 'ws'; 19 20 export const version: string; 21 22 //#region Classes 23 24 export class Activity { 25 constructor(presence: Presence, data?: object); 26 public applicationID: Snowflake | null; 27 public assets: RichPresenceAssets | null; 28 public readonly createdAt: Date; 29 public createdTimestamp: number; 30 public details: string | null; 31 public emoji: Emoji | null; 32 public name: string; 33 public party: { 34 id: string | null; 35 size: [number, number]; 36 } | null; 37 public state: string | null; 38 public timestamps: { 39 start: Date | null; 40 end: Date | null; 41 } | null; 42 public type: ActivityType; 43 public url: string | null; 44 public equals(activity: Activity): boolean; 45 } 46 47 export class ActivityFlags extends BitField<ActivityFlagsString> { 48 public static FLAGS: Record<ActivityFlagsString, number>; 49 public static resolve(bit?: BitFieldResolvable<ActivityFlagsString>): number; 50 } 51 52 export class APIMessage { 53 constructor(target: MessageTarget, options: MessageOptions | WebhookMessageOptions); 54 public data: object | null; 55 public readonly isUser: boolean; 56 public readonly isWebhook: boolean; 57 public files: object[] | null; 58 public options: MessageOptions | WebhookMessageOptions; 59 public target: MessageTarget; 60 61 public static create( 62 target: MessageTarget, 63 content?: StringResolvable, 64 options?: MessageOptions | WebhookMessageOptions | MessageAdditions, 65 extra?: MessageOptions | WebhookMessageOptions, 66 ): APIMessage; 67 public static partitionMessageAdditions( 68 items: (MessageEmbed | MessageAttachment)[], 69 ): [MessageEmbed[], MessageAttachment[]]; 70 public static resolveFile(fileLike: BufferResolvable | Stream | FileOptions | MessageAttachment): Promise<object>; 71 public static transformOptions( 72 content: StringResolvable, 73 options: MessageOptions | WebhookMessageOptions | MessageAdditions, 74 extra?: MessageOptions | WebhookMessageOptions, 75 isWebhook?: boolean, 76 ): MessageOptions | WebhookMessageOptions; 77 78 public makeContent(): string | string[] | undefined; 79 public resolve(): Promise<this>; 80 public resolveData(): this; 81 public resolveFiles(): Promise<this>; 82 public split(): APIMessage[]; 83 } 84 85 export class Base { 86 constructor(client: Client); 87 public readonly client: Client; 88 public toJSON(...props: { [key: string]: boolean | string }[]): object; 89 public valueOf(): string; 90 } 91 92 export class BaseClient extends EventEmitter { 93 constructor(options?: ClientOptions); 94 private _timeouts: Set<NodeJS.Timer>; 95 private _intervals: Set<NodeJS.Timer>; 96 private _immediates: Set<NodeJS.Immediate>; 97 private readonly api: object; 98 private rest: object; 99 100 public options: ClientOptions; 101 public clearInterval(interval: NodeJS.Timer): void; 102 public clearTimeout(timeout: NodeJS.Timer): void; 103 public clearImmediate(timeout: NodeJS.Immediate): void; 104 public destroy(): void; 105 public setInterval(fn: (...args: any[]) => void, delay: number, ...args: any[]): NodeJS.Timer; 106 public setTimeout(fn: (...args: any[]) => void, delay: number, ...args: any[]): NodeJS.Timer; 107 public setImmediate(fn: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate; 108 public toJSON(...props: { [key: string]: boolean | string }[]): object; 109 } 110 111 export class BaseGuildEmoji extends Emoji { 112 constructor(client: Client, data: object, guild: Guild); 113 private _roles: string[]; 114 115 public available: boolean; 116 public readonly createdAt: Date; 117 public readonly createdTimestamp: number; 118 public guild: Guild | GuildPreview; 119 public id: Snowflake; 120 public managed: boolean; 121 public requiresColons: boolean; 122 } 123 124 class BroadcastDispatcher extends VolumeMixin(StreamDispatcher) { 125 public broadcast: VoiceBroadcast; 126 } 127 128 export class BitField<S extends string> { 129 constructor(bits?: BitFieldResolvable<S>); 130 public bitfield: number; 131 public add(...bits: BitFieldResolvable<S>[]): BitField<S>; 132 public any(bit: BitFieldResolvable<S>): boolean; 133 public equals(bit: BitFieldResolvable<S>): boolean; 134 public freeze(): Readonly<BitField<S>>; 135 public has(bit: BitFieldResolvable<S>): boolean; 136 public missing(bits: BitFieldResolvable<S>, ...hasParam: readonly unknown[]): S[]; 137 public remove(...bits: BitFieldResolvable<S>[]): BitField<S>; 138 public serialize(...hasParam: readonly unknown[]): Record<S, boolean>; 139 public toArray(...hasParam: readonly unknown[]): S[]; 140 public toJSON(): number; 141 public valueOf(): number; 142 public [Symbol.iterator](): IterableIterator<S>; 143 public static FLAGS: object; 144 public static resolve(bit?: BitFieldResolvable<any>): number; 145 } 146 147 export class CategoryChannel extends GuildChannel { 148 public readonly children: Collection<Snowflake, GuildChannel>; 149 public type: 'category'; 150 } 151 152 export class Channel extends Base { 153 constructor(client: Client, data?: object); 154 public readonly createdAt: Date; 155 public readonly createdTimestamp: number; 156 public deleted: boolean; 157 public id: Snowflake; 158 public type: keyof typeof ChannelType; 159 public delete(reason?: string): Promise<this>; 160 public fetch(): Promise<this>; 161 public toString(): string; 162 } 163 164 export class Client extends BaseClient { 165 constructor(options?: ClientOptions); 166 private actions: object; 167 private _eval(script: string): any; 168 private _validateOptions(options?: ClientOptions): void; 169 170 public channels: ChannelManager; 171 public readonly emojis: GuildEmojiManager; 172 public guilds: GuildManager; 173 public readyAt: Date | null; 174 public readonly readyTimestamp: number | null; 175 public shard: ShardClientUtil | null; 176 public token: string | null; 177 public readonly uptime: number | null; 178 public user: ClientUser | null; 179 public users: UserManager; 180 public voice: ClientVoiceManager | null; 181 public ws: WebSocketManager; 182 public destroy(): void; 183 public fetchApplication(): Promise<ClientApplication>; 184 public fetchGuildPreview(guild: GuildResolvable): Promise<GuildPreview>; 185 public fetchInvite(invite: InviteResolvable): Promise<Invite>; 186 public fetchVoiceRegions(): Promise<Collection<string, VoiceRegion>>; 187 public fetchWebhook(id: Snowflake, token?: string): Promise<Webhook>; 188 public generateInvite(permissions?: PermissionResolvable): Promise<string>; 189 public login(token?: string): Promise<string>; 190 public sweepMessages(lifetime?: number): number; 191 public toJSON(): object; 192 193 public on<K extends keyof ClientEvents>(event: K, listener: (...args: ClientEvents[K]) => void): this; 194 195 public once<K extends keyof ClientEvents>(event: K, listener: (...args: ClientEvents[K]) => void): this; 196 197 public emit<K extends keyof ClientEvents>(event: K, ...args: ClientEvents[K]): boolean; 198 } 199 200 export class ClientApplication extends Base { 201 constructor(client: Client, data: object); 202 public botPublic: boolean | null; 203 public botRequireCodeGrant: boolean | null; 204 public cover: string | null; 205 public readonly createdAt: Date; 206 public readonly createdTimestamp: number; 207 public description: string; 208 public icon: string; 209 public id: Snowflake; 210 public name: string; 211 public owner: User | Team | null; 212 public rpcOrigins: string[]; 213 public coverImage(options?: ImageURLOptions): string; 214 public fetchAssets(): Promise<ClientApplicationAsset[]>; 215 public iconURL(options?: ImageURLOptions): string; 216 public toJSON(): object; 217 public toString(): string; 218 } 219 220 export class ClientUser extends User { 221 public mfaEnabled: boolean; 222 public verified: boolean; 223 public setActivity(options?: ActivityOptions): Promise<Presence>; 224 public setActivity(name: string, options?: ActivityOptions): Promise<Presence>; 225 public setAFK(afk: boolean): Promise<Presence>; 226 public setAvatar(avatar: BufferResolvable | Base64Resolvable): Promise<ClientUser>; 227 public setPresence(data: PresenceData): Promise<Presence>; 228 public setStatus(status: PresenceStatusData, shardID?: number | number[]): Promise<Presence>; 229 public setUsername(username: string): Promise<ClientUser>; 230 } 231 232 export class ClientVoiceManager { 233 constructor(client: Client); 234 public readonly client: Client; 235 public connections: Collection<Snowflake, VoiceConnection>; 236 public broadcasts: VoiceBroadcast[]; 237 238 private joinChannel(channel: VoiceChannel): Promise<VoiceConnection>; 239 240 public createBroadcast(): VoiceBroadcast; 241 } 242 243 export abstract class Collector<K, V> extends EventEmitter { 244 constructor(client: Client, filter: CollectorFilter, options?: CollectorOptions); 245 private _timeout: NodeJS.Timer | null; 246 private _idletimeout: NodeJS.Timer | null; 247 248 public readonly client: Client; 249 public collected: Collection<K, V>; 250 public ended: boolean; 251 public filter: CollectorFilter; 252 public readonly next: Promise<V>; 253 public options: CollectorOptions; 254 public checkEnd(): void; 255 public handleCollect(...args: any[]): void; 256 public handleDispose(...args: any[]): void; 257 public stop(reason?: string): void; 258 public resetTimer(options?: { time?: number; idle?: number }): void; 259 public [Symbol.asyncIterator](): AsyncIterableIterator<V>; 260 public toJSON(): object; 261 262 protected listener: (...args: any[]) => void; 263 public abstract collect(...args: any[]): K; 264 public abstract dispose(...args: any[]): K; 265 public abstract endReason(): void; 266 267 public on(event: 'collect' | 'dispose', listener: (...args: any[]) => void): this; 268 public on(event: 'end', listener: (collected: Collection<K, V>, reason: string) => void): this; 269 270 public once(event: 'collect' | 'dispose', listener: (...args: any[]) => void): this; 271 public once(event: 'end', listener: (collected: Collection<K, V>, reason: string) => void): this; 272 } 273 274 type AllowedImageFormat = 'webp' | 'png' | 'jpg' | 'jpeg' | 'gif'; 275 276 export const Constants: { 277 Package: { 278 name: string; 279 version: string; 280 description: string; 281 author: string; 282 license: string; 283 main: PathLike; 284 types: PathLike; 285 homepage: string; 286 keywords: string[]; 287 bugs: { url: string }; 288 repository: { type: string; url: string }; 289 browser: { [key: string]: boolean }; 290 scripts: { [key: string]: string }; 291 engines: { [key: string]: string }; 292 dependencies: { [key: string]: string }; 293 peerDependencies: { [key: string]: string }; 294 devDependencies: { [key: string]: string }; 295 [key: string]: any; 296 }; 297 browser: boolean; 298 DefaultOptions: ClientOptions; 299 UserAgent: string | null; 300 Endpoints: { 301 botGateway: string; 302 invite: (root: string, code: string) => string; 303 CDN: ( 304 root: string, 305 ) => { 306 Asset: (name: string) => string; 307 DefaultAvatar: (id: string | number) => string; 308 Emoji: (emojiID: string, format: 'png' | 'gif') => string; 309 Avatar: (userID: string | number, hash: string, format: 'default' | AllowedImageFormat, size: number) => string; 310 Banner: (guildID: string | number, hash: string, format: AllowedImageFormat, size: number) => string; 311 Icon: (userID: string | number, hash: string, format: 'default' | AllowedImageFormat, size: number) => string; 312 AppIcon: (userID: string | number, hash: string, format: AllowedImageFormat, size: number) => string; 313 AppAsset: (userID: string | number, hash: string, format: AllowedImageFormat, size: number) => string; 314 GDMIcon: (userID: string | number, hash: string, format: AllowedImageFormat, size: number) => string; 315 Splash: (guildID: string | number, hash: string, format: AllowedImageFormat, size: number) => string; 316 DiscoverySplash: (guildID: string | number, hash: string, format: AllowedImageFormat, size: number) => string; 317 TeamIcon: (teamID: string | number, hash: string, format: AllowedImageFormat, size: number) => string; 318 }; 319 }; 320 WSCodes: { 321 1000: 'WS_CLOSE_REQUESTED'; 322 4004: 'TOKEN_INVALID'; 323 4010: 'SHARDING_INVALID'; 324 4011: 'SHARDING_REQUIRED'; 325 }; 326 Events: { 327 RATE_LIMIT: 'rateLimit'; 328 CLIENT_READY: 'ready'; 329 RESUMED: 'resumed'; 330 GUILD_CREATE: 'guildCreate'; 331 GUILD_DELETE: 'guildDelete'; 332 GUILD_UPDATE: 'guildUpdate'; 333 INVITE_CREATE: 'inviteCreate'; 334 INVITE_DELETE: 'inviteDelete'; 335 GUILD_UNAVAILABLE: 'guildUnavailable'; 336 GUILD_MEMBER_ADD: 'guildMemberAdd'; 337 GUILD_MEMBER_REMOVE: 'guildMemberRemove'; 338 GUILD_MEMBER_UPDATE: 'guildMemberUpdate'; 339 GUILD_MEMBER_AVAILABLE: 'guildMemberAvailable'; 340 GUILD_MEMBER_SPEAKING: 'guildMemberSpeaking'; 341 GUILD_MEMBERS_CHUNK: 'guildMembersChunk'; 342 GUILD_INTEGRATIONS_UPDATE: 'guildIntegrationsUpdate'; 343 GUILD_ROLE_CREATE: 'roleCreate'; 344 GUILD_ROLE_DELETE: 'roleDelete'; 345 GUILD_ROLE_UPDATE: 'roleUpdate'; 346 GUILD_EMOJI_CREATE: 'emojiCreate'; 347 GUILD_EMOJI_DELETE: 'emojiDelete'; 348 GUILD_EMOJI_UPDATE: 'emojiUpdate'; 349 GUILD_BAN_ADD: 'guildBanAdd'; 350 GUILD_BAN_REMOVE: 'guildBanRemove'; 351 CHANNEL_CREATE: 'channelCreate'; 352 CHANNEL_DELETE: 'channelDelete'; 353 CHANNEL_UPDATE: 'channelUpdate'; 354 CHANNEL_PINS_UPDATE: 'channelPinsUpdate'; 355 MESSAGE_CREATE: 'message'; 356 MESSAGE_DELETE: 'messageDelete'; 357 MESSAGE_UPDATE: 'messageUpdate'; 358 MESSAGE_BULK_DELETE: 'messageDeleteBulk'; 359 MESSAGE_REACTION_ADD: 'messageReactionAdd'; 360 MESSAGE_REACTION_REMOVE: 'messageReactionRemove'; 361 MESSAGE_REACTION_REMOVE_ALL: 'messageReactionRemoveAll'; 362 USER_UPDATE: 'userUpdate'; 363 PRESENCE_UPDATE: 'presenceUpdate'; 364 VOICE_STATE_UPDATE: 'voiceStateUpdate'; 365 VOICE_BROADCAST_SUBSCRIBE: 'subscribe'; 366 VOICE_BROADCAST_UNSUBSCRIBE: 'unsubscribe'; 367 TYPING_START: 'typingStart'; 368 WEBHOOKS_UPDATE: 'webhookUpdate'; 369 DISCONNECT: 'disconnect'; 370 RECONNECTING: 'reconnecting'; 371 ERROR: 'error'; 372 WARN: 'warn'; 373 DEBUG: 'debug'; 374 SHARD_DISCONNECT: 'shardDisconnect'; 375 SHARD_ERROR: 'shardError'; 376 SHARD_RECONNECTING: 'shardReconnecting'; 377 SHARD_READY: 'shardReady'; 378 SHARD_RESUME: 'shardResume'; 379 INVALIDATED: 'invalidated'; 380 RAW: 'raw'; 381 }; 382 ShardEvents: { 383 CLOSE: 'close'; 384 DESTROYED: 'destroyed'; 385 INVALID_SESSION: 'invalidSession'; 386 READY: 'ready'; 387 RESUMED: 'resumed'; 388 }; 389 PartialTypes: { 390 [K in PartialTypes]: K; 391 }; 392 WSEvents: { 393 [K in WSEventType]: K; 394 }; 395 Colors: { 396 DEFAULT: 0x000000; 397 WHITE: 0xffffff; 398 AQUA: 0x1abc9c; 399 GREEN: 0x2ecc71; 400 BLUE: 0x3498db; 401 YELLOW: 0xffff00; 402 PURPLE: 0x9b59b6; 403 LUMINOUS_VIVID_PINK: 0xe91e63; 404 GOLD: 0xf1c40f; 405 ORANGE: 0xe67e22; 406 RED: 0xe74c3c; 407 GREY: 0x95a5a6; 408 NAVY: 0x34495e; 409 DARK_AQUA: 0x11806a; 410 DARK_GREEN: 0x1f8b4c; 411 DARK_BLUE: 0x206694; 412 DARK_PURPLE: 0x71368a; 413 DARK_VIVID_PINK: 0xad1457; 414 DARK_GOLD: 0xc27c0e; 415 DARK_ORANGE: 0xa84300; 416 DARK_RED: 0x992d22; 417 DARK_GREY: 0x979c9f; 418 DARKER_GREY: 0x7f8c8d; 419 LIGHT_GREY: 0xbcc0c0; 420 DARK_NAVY: 0x2c3e50; 421 BLURPLE: 0x7289da; 422 GREYPLE: 0x99aab5; 423 DARK_BUT_NOT_BLACK: 0x2c2f33; 424 NOT_QUITE_BLACK: 0x23272a; 425 }; 426 Status: { 427 READY: 0; 428 CONNECTING: 1; 429 RECONNECTING: 2; 430 IDLE: 3; 431 NEARLY: 4; 432 DISCONNECTED: 5; 433 }; 434 OPCodes: { 435 DISPATCH: 0; 436 HEARTBEAT: 1; 437 IDENTIFY: 2; 438 STATUS_UPDATE: 3; 439 VOICE_STATE_UPDATE: 4; 440 VOICE_GUILD_PING: 5; 441 RESUME: 6; 442 RECONNECT: 7; 443 REQUEST_GUILD_MEMBERS: 8; 444 INVALID_SESSION: 9; 445 HELLO: 10; 446 HEARTBEAT_ACK: 11; 447 }; 448 APIErrors: { 449 UNKNOWN_ACCOUNT: 10001; 450 UNKNOWN_APPLICATION: 10002; 451 UNKNOWN_CHANNEL: 10003; 452 UNKNOWN_GUILD: 10004; 453 UNKNOWN_INTEGRATION: 10005; 454 UNKNOWN_INVITE: 10006; 455 UNKNOWN_MEMBER: 10007; 456 UNKNOWN_MESSAGE: 10008; 457 UNKNOWN_OVERWRITE: 10009; 458 UNKNOWN_PROVIDER: 10010; 459 UNKNOWN_ROLE: 10011; 460 UNKNOWN_TOKEN: 10012; 461 UNKNOWN_USER: 10013; 462 UNKNOWN_EMOJI: 10014; 463 UNKNOWN_WEBHOOK: 10015; 464 BOT_PROHIBITED_ENDPOINT: 20001; 465 BOT_ONLY_ENDPOINT: 20002; 466 MAXIMUM_GUILDS: 30001; 467 MAXIMUM_FRIENDS: 30002; 468 MAXIMUM_PINS: 30003; 469 MAXIMUM_ROLES: 30005; 470 MAXIMUM_REACTIONS: 30010; 471 MAXIMUM_CHANNELS: 30013; 472 MAXIMUM_INVITES: 30016; 473 UNAUTHORIZED: 40001; 474 USER_BANNED: 40007; 475 MISSING_ACCESS: 50001; 476 INVALID_ACCOUNT_TYPE: 50002; 477 CANNOT_EXECUTE_ON_DM: 50003; 478 EMBED_DISABLED: 50004; 479 CANNOT_EDIT_MESSAGE_BY_OTHER: 50005; 480 CANNOT_SEND_EMPTY_MESSAGE: 50006; 481 CANNOT_MESSAGE_USER: 50007; 482 CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL: 50008; 483 CHANNEL_VERIFICATION_LEVEL_TOO_HIGH: 50009; 484 OAUTH2_APPLICATION_BOT_ABSENT: 50010; 485 MAXIMUM_OAUTH2_APPLICATIONS: 50011; 486 INVALID_OAUTH_STATE: 50012; 487 MISSING_PERMISSIONS: 50013; 488 INVALID_AUTHENTICATION_TOKEN: 50014; 489 NOTE_TOO_LONG: 50015; 490 INVALID_BULK_DELETE_QUANTITY: 50016; 491 CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL: 50019; 492 CANNOT_EXECUTE_ON_SYSTEM_MESSAGE: 50021; 493 INVALID_OAUTH_TOKEN: 50025; 494 BULK_DELETE_MESSAGE_TOO_OLD: 50034; 495 INVALID_FORM_BODY: 50035; 496 INVITE_ACCEPTED_TO_GUILD_NOT_CONTAINING_BOT: 50036; 497 INVALID_API_VERSION: 50041; 498 REACTION_BLOCKED: 90001; 499 RESOURCE_OVERLOADED: 130000; 500 }; 501 VoiceStatus: { 502 CONNECTED: 0; 503 CONNECTING: 1; 504 AUTHENTICATING: 2; 505 RECONNECTING: 3; 506 DISCONNECTED: 4; 507 }; 508 VoiceOPCodes: { 509 IDENTIFY: 0; 510 SELECT_PROTOCOL: 1; 511 READY: 2; 512 HEARTBEAT: 3; 513 SESSION_DESCRIPTION: 4; 514 SPEAKING: 5; 515 HELLO: 8; 516 CLIENT_CONNECT: 12; 517 CLIENT_DISCONNECT: 13; 518 }; 519 ChannelTypes: { 520 TEXT: 0; 521 DM: 1; 522 VOICE: 2; 523 GROUP: 3; 524 CATEGORY: 4; 525 NEWS: 5; 526 STORE: 6; 527 }; 528 ClientApplicationAssetTypes: { 529 SMALL: 1; 530 BIG: 2; 531 }; 532 MessageTypes: MessageType[]; 533 ActivityTypes: ActivityType[]; 534 ExplicitContentFilterLevels: ExplicitContentFilterLevel[]; 535 DefaultMessageNotifications: DefaultMessageNotifications[]; 536 VerificationLevels: VerificationLevel[]; 537 MembershipStates: 'INVITED' | 'ACCEPTED'; 538 }; 539 540 export class DataResolver { 541 public static resolveBase64(data: Base64Resolvable): string; 542 public static resolveFile(resource: BufferResolvable | Stream): Promise<Buffer | Stream>; 543 public static resolveFileAsBuffer(resource: BufferResolvable | Stream): Promise<Buffer>; 544 public static resolveImage(resource: BufferResolvable | Base64Resolvable): Promise<string>; 545 public static resolveInviteCode(data: InviteResolvable): string; 546 } 547 548 export class DiscordAPIError extends Error { 549 constructor(path: string, error: object, method: string, httpStatus: number); 550 private static flattenErrors(obj: object, key: string): string[]; 551 552 public code: number; 553 public method: string; 554 public path: string; 555 public httpStatus: number; 556 } 557 558 export class DMChannel extends TextBasedChannel(Channel) { 559 constructor(client: Client, data?: object); 560 public messages: MessageManager; 561 public recipient: User; 562 public readonly partial: false; 563 public type: 'dm'; 564 public fetch(): Promise<this>; 565 } 566 567 export class Emoji extends Base { 568 constructor(client: Client, emoji: object); 569 public animated: boolean; 570 public readonly createdAt: Date | null; 571 public readonly createdTimestamp: number | null; 572 public deleted: boolean; 573 public id: Snowflake | null; 574 public name: string; 575 public readonly identifier: string; 576 public readonly url: string | null; 577 public toJSON(): object; 578 public toString(): string; 579 } 580 581 export class Guild extends Base { 582 constructor(client: Client, data: object); 583 private _sortedRoles(): Collection<Snowflake, Role>; 584 private _sortedChannels(channel: Channel): Collection<Snowflake, GuildChannel>; 585 private _memberSpeakUpdate(user: Snowflake, speaking: boolean): void; 586 587 public readonly afkChannel: VoiceChannel | null; 588 public afkChannelID: Snowflake | null; 589 public afkTimeout: number; 590 public applicationID: Snowflake | null; 591 public available: boolean; 592 public banner: string | null; 593 public channels: GuildChannelManager; 594 public readonly createdAt: Date; 595 public readonly createdTimestamp: number; 596 public defaultMessageNotifications: DefaultMessageNotifications | number; 597 public deleted: boolean; 598 public description: string | null; 599 public embedChannel: GuildChannel | null; 600 public embedChannelID: Snowflake | null; 601 public embedEnabled: boolean; 602 public emojis: GuildEmojiManager; 603 public explicitContentFilter: ExplicitContentFilterLevel; 604 public features: GuildFeatures[]; 605 public icon: string | null; 606 public id: Snowflake; 607 public readonly joinedAt: Date; 608 public joinedTimestamp: number; 609 public large: boolean; 610 public maximumMembers: number | null; 611 public maximumPresences: number | null; 612 public readonly me: GuildMember | null; 613 public memberCount: number; 614 public members: GuildMemberManager; 615 public mfaLevel: number; 616 public name: string; 617 public readonly nameAcronym: string; 618 public readonly owner: GuildMember | null; 619 public ownerID: Snowflake; 620 public readonly partnered: boolean; 621 public premiumSubscriptionCount: number | null; 622 public premiumTier: PremiumTier; 623 public presences: PresenceManager; 624 public readonly publicUpdatesChannel: TextChannel | null; 625 public publicUpdatesChannelID: Snowflake | null; 626 public region: string; 627 public roles: RoleManager; 628 public readonly rulesChannel: TextChannel | null; 629 public rulesChannelID: Snowflake | null; 630 public readonly shard: WebSocketShard; 631 public shardID: number; 632 public splash: string | null; 633 public readonly systemChannel: TextChannel | null; 634 public systemChannelFlags: Readonly<SystemChannelFlags>; 635 public systemChannelID: Snowflake | null; 636 public vanityURLCode: string | null; 637 public verificationLevel: VerificationLevel; 638 public readonly verified: boolean; 639 public readonly voice: VoiceState | null; 640 public readonly voiceStates: VoiceStateManager; 641 public readonly widgetChannel: TextChannel | null; 642 public widgetChannelID: Snowflake | null; 643 public widgetEnabled: boolean | null; 644 public addMember(user: UserResolvable, options: AddGuildMemberOptions): Promise<GuildMember>; 645 public bannerURL(options?: ImageURLOptions): string | null; 646 public createIntegration(data: IntegrationData, reason?: string): Promise<Guild>; 647 public delete(): Promise<Guild>; 648 public edit(data: GuildEditData, reason?: string): Promise<Guild>; 649 public equals(guild: Guild): boolean; 650 public fetch(): Promise<Guild>; 651 public fetchAuditLogs(options?: GuildAuditLogsFetchOptions): Promise<GuildAuditLogs>; 652 public fetchBan(user: UserResolvable): Promise<{ user: User; reason: string }>; 653 public fetchBans(): Promise<Collection<Snowflake, { user: User; reason: string }>>; 654 public fetchEmbed(): Promise<GuildEmbedData>; 655 public fetchIntegrations(): Promise<Collection<string, Integration>>; 656 public fetchInvites(): Promise<Collection<string, Invite>>; 657 public fetchPreview(): Promise<GuildPreview>; 658 public fetchVanityCode(): Promise<string>; 659 public fetchVoiceRegions(): Promise<Collection<string, VoiceRegion>>; 660 public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>; 661 public iconURL(options?: ImageURLOptions & { dynamic?: boolean }): string | null; 662 public leave(): Promise<Guild>; 663 public member(user: UserResolvable): GuildMember | null; 664 public setAFKChannel(afkChannel: ChannelResolvable | null, reason?: string): Promise<Guild>; 665 public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>; 666 public setBanner(banner: Base64Resolvable | null, reason?: string): Promise<Guild>; 667 public setChannelPositions(channelPositions: ChannelPosition[]): Promise<Guild>; 668 public setDefaultMessageNotifications( 669 defaultMessageNotifications: DefaultMessageNotifications | number, 670 reason?: string, 671 ): Promise<Guild>; 672 public setEmbed(embed: GuildEmbedData, reason?: string): Promise<Guild>; 673 public setExplicitContentFilter(explicitContentFilter: ExplicitContentFilterLevel, reason?: string): Promise<Guild>; 674 public setIcon(icon: Base64Resolvable | null, reason?: string): Promise<Guild>; 675 public setName(name: string, reason?: string): Promise<Guild>; 676 public setOwner(owner: GuildMemberResolvable, reason?: string): Promise<Guild>; 677 public setRegion(region: string, reason?: string): Promise<Guild>; 678 public setRolePositions(rolePositions: RolePosition[]): Promise<Guild>; 679 public setSplash(splash: Base64Resolvable | null, reason?: string): Promise<Guild>; 680 public setSystemChannel(systemChannel: ChannelResolvable | null, reason?: string): Promise<Guild>; 681 public setSystemChannelFlags(systemChannelFlags: SystemChannelFlagsResolvable, reason?: string): Promise<Guild>; 682 public setVerificationLevel(verificationLevel: VerificationLevel, reason?: string): Promise<Guild>; 683 public splashURL(options?: ImageURLOptions): string | null; 684 public toJSON(): object; 685 public toString(): string; 686 } 687 688 export class GuildAuditLogs { 689 constructor(guild: Guild, data: object); 690 private webhooks: Collection<Snowflake, Webhook>; 691 private integrations: Collection<Snowflake, Integration>; 692 693 public entries: Collection<Snowflake, GuildAuditLogsEntry>; 694 695 public static Actions: GuildAuditLogsActions; 696 public static Targets: GuildAuditLogsTargets; 697 public static Entry: typeof GuildAuditLogsEntry; 698 public static actionType(action: number): GuildAuditLogsActionType; 699 public static build(...args: any[]): Promise<GuildAuditLogs>; 700 public static targetType(target: number): GuildAuditLogsTarget; 701 public toJSON(): object; 702 } 703 704 class GuildAuditLogsEntry { 705 constructor(logs: GuildAuditLogs, guild: Guild, data: object); 706 public action: GuildAuditLogsAction; 707 public actionType: GuildAuditLogsActionType; 708 public changes: AuditLogChange[] | null; 709 public readonly createdAt: Date; 710 public readonly createdTimestamp: number; 711 public executor: User; 712 public extra: object | Role | GuildMember | null; 713 public id: Snowflake; 714 public reason: string | null; 715 public target: Guild | User | Role | GuildEmoji | Invite | Webhook | Integration | null; 716 public targetType: GuildAuditLogsTarget; 717 public toJSON(): object; 718 } 719 720 export class GuildChannel extends Channel { 721 constructor(guild: Guild, data?: object); 722 private memberPermissions(member: GuildMember): Readonly<Permissions>; 723 private rolePermissions(role: Role): Readonly<Permissions>; 724 725 public readonly calculatedPosition: number; 726 public readonly deletable: boolean; 727 public guild: Guild; 728 public readonly manageable: boolean; 729 public readonly members: Collection<Snowflake, GuildMember>; 730 public name: string; 731 public readonly parent: CategoryChannel | null; 732 public parentID: Snowflake | null; 733 public permissionOverwrites: Collection<Snowflake, PermissionOverwrites>; 734 public readonly permissionsLocked: boolean | null; 735 public readonly position: number; 736 public rawPosition: number; 737 public type: Exclude<keyof typeof ChannelType, 'dm' | 'group' | 'unknown'>; 738 public readonly viewable: boolean; 739 public clone(options?: GuildChannelCloneOptions): Promise<this>; 740 public createInvite(options?: InviteOptions): Promise<Invite>; 741 public createOverwrite( 742 userOrRole: RoleResolvable | UserResolvable, 743 options: PermissionOverwriteOption, 744 reason?: string, 745 ): Promise<this>; 746 public edit(data: ChannelData, reason?: string): Promise<this>; 747 public equals(channel: GuildChannel): boolean; 748 public fetchInvites(): Promise<Collection<string, Invite>>; 749 public lockPermissions(): Promise<this>; 750 public overwritePermissions( 751 overwrites: OverwriteResolvable[] | Collection<Snowflake, OverwriteResolvable>, 752 reason?: string, 753 ): Promise<this>; 754 public permissionsFor(memberOrRole: GuildMemberResolvable | RoleResolvable): Readonly<Permissions> | null; 755 public setName(name: string, reason?: string): Promise<this>; 756 public setParent( 757 channel: CategoryChannel | Snowflake, 758 options?: { lockPermissions?: boolean; reason?: string }, 759 ): Promise<this>; 760 public setPosition(position: number, options?: { relative?: boolean; reason?: string }): Promise<this>; 761 public setTopic(topic: string, reason?: string): Promise<this>; 762 public updateOverwrite( 763 userOrRole: RoleResolvable | UserResolvable, 764 options: PermissionOverwriteOption, 765 reason?: string, 766 ): Promise<this>; 767 } 768 769 export class GuildEmoji extends BaseGuildEmoji { 770 public readonly deletable: boolean; 771 public guild: Guild; 772 public readonly roles: GuildEmojiRoleManager; 773 public readonly url: string; 774 public delete(reason?: string): Promise<GuildEmoji>; 775 public edit(data: GuildEmojiEditData, reason?: string): Promise<GuildEmoji>; 776 public equals(other: GuildEmoji | object): boolean; 777 public fetchAuthor(): Promise<User>; 778 public setName(name: string, reason?: string): Promise<GuildEmoji>; 779 } 780 781 export class GuildMember extends PartialTextBasedChannel(Base) { 782 constructor(client: Client, data: object, guild: Guild); 783 public readonly bannable: boolean; 784 public deleted: boolean; 785 public readonly displayColor: number; 786 public readonly displayHexColor: string; 787 public readonly displayName: string; 788 public guild: Guild; 789 public readonly id: Snowflake; 790 public readonly joinedAt: Date | null; 791 public joinedTimestamp: number | null; 792 public readonly kickable: boolean; 793 public lastMessageChannelID: Snowflake | null; 794 public readonly manageable: boolean; 795 public nickname: string | null; 796 public readonly partial: false; 797 public readonly permissions: Readonly<Permissions>; 798 public readonly premiumSince: Date | null; 799 public premiumSinceTimestamp: number | null; 800 public readonly presence: Presence; 801 public readonly roles: GuildMemberRoleManager; 802 public user: User; 803 public readonly voice: VoiceState; 804 public ban(options?: BanOptions): Promise<GuildMember>; 805 public fetch(): Promise<GuildMember>; 806 public createDM(): Promise<DMChannel>; 807 public deleteDM(): Promise<DMChannel>; 808 public edit(data: GuildMemberEditData, reason?: string): Promise<GuildMember>; 809 public hasPermission( 810 permission: PermissionResolvable, 811 options?: { checkAdmin?: boolean; checkOwner?: boolean }, 812 ): boolean; 813 public kick(reason?: string): Promise<GuildMember>; 814 public permissionsIn(channel: ChannelResolvable): Readonly<Permissions>; 815 public setNickname(nickname: string, reason?: string): Promise<GuildMember>; 816 public toJSON(): object; 817 public toString(): string; 818 public valueOf(): string; 819 } 820 821 export class GuildPreview extends Base { 822 constructor(client: Client, data: object); 823 public approximateMemberCount: number; 824 public approximatePresenceCount: number; 825 public description?: string; 826 public discoverySplash: string | null; 827 public emojis: Collection<Snowflake, GuildPreviewEmoji>; 828 public features: GuildFeatures[]; 829 public icon: string | null; 830 public id: string; 831 public name: string; 832 public splash: string | null; 833 public discoverySplashURL(options?: ImageURLOptions): string | null; 834 public iconURL(options?: ImageURLOptions & { dynamic?: boolean }): string | null; 835 public splashURL(options?: ImageURLOptions): string | null; 836 public fetch(): Promise<GuildPreview>; 837 public toJSON(): object; 838 public toString(): string; 839 } 840 841 export class GuildPreviewEmoji extends BaseGuildEmoji { 842 constructor(client: Client, data: object, guild: GuildPreview); 843 public guild: GuildPreview; 844 public readonly roles: Set<Snowflake>; 845 } 846 847 export class HTTPError extends Error { 848 constructor(message: string, name: string, code: number, method: string, path: string); 849 public code: number; 850 public method: string; 851 public name: string; 852 public path: string; 853 } 854 855 export class Integration extends Base { 856 constructor(client: Client, data: object, guild: Guild); 857 public account: IntegrationAccount; 858 public enabled: boolean; 859 public expireBehavior: number; 860 public expireGracePeriod: number; 861 public guild: Guild; 862 public id: Snowflake; 863 public name: string; 864 public role: Role; 865 public syncedAt: number; 866 public syncing: boolean; 867 public type: string; 868 public user: User; 869 public delete(reason?: string): Promise<Integration>; 870 public edit(data: IntegrationEditData, reason?: string): Promise<Integration>; 871 public sync(): Promise<Integration>; 872 } 873 874 export class Intents extends BitField<IntentsString> { 875 public static FLAGS: Record<IntentsString, number>; 876 public static PRIVILEGED: number; 877 public static ALL: number; 878 public static NON_PRIVILEGED: number; 879 public static resolve(bit?: BitFieldResolvable<IntentsString>): number; 880 } 881 882 export class Invite extends Base { 883 constructor(client: Client, data: object); 884 public channel: GuildChannel | PartialGroupDMChannel; 885 public code: string; 886 public readonly deletable: boolean; 887 public readonly createdAt: Date | null; 888 public createdTimestamp: number | null; 889 public readonly expiresAt: Date | null; 890 public readonly expiresTimestamp: number | null; 891 public guild: Guild | null; 892 public inviter: User | null; 893 public maxAge: number | null; 894 public maxUses: number | null; 895 public memberCount: number; 896 public presenceCount: number; 897 public targetUser: User | null; 898 public targetUserType: TargetUser | null; 899 public temporary: boolean | null; 900 public readonly url: string; 901 public uses: number | null; 902 public delete(reason?: string): Promise<Invite>; 903 public toJSON(): object; 904 public toString(): string; 905 } 906 907 export class Message extends Base { 908 constructor(client: Client, data: object, channel: TextChannel | DMChannel); 909 private _edits: Message[]; 910 private patch(data: object): void; 911 912 public activity: MessageActivity | null; 913 public application: ClientApplication | null; 914 public attachments: Collection<Snowflake, MessageAttachment>; 915 public author: User; 916 public channel: TextChannel | DMChannel | NewsChannel; 917 public readonly cleanContent: string; 918 public content: string; 919 public readonly createdAt: Date; 920 public createdTimestamp: number; 921 public readonly deletable: boolean; 922 public deleted: boolean; 923 public readonly editable: boolean; 924 public readonly editedAt: Date | null; 925 public editedTimestamp: number | null; 926 public readonly edits: Message[]; 927 public embeds: MessageEmbed[]; 928 public readonly guild: Guild | null; 929 public id: Snowflake; 930 public readonly member: GuildMember | null; 931 public mentions: MessageMentions; 932 public nonce: string | null; 933 public readonly partial: false; 934 public readonly pinnable: boolean; 935 public pinned: boolean; 936 public reactions: ReactionManager; 937 public system: boolean; 938 public tts: boolean; 939 public type: MessageType; 940 public readonly url: string; 941 public webhookID: Snowflake | null; 942 public flags: Readonly<MessageFlags>; 943 public reference: MessageReference | null; 944 public awaitReactions( 945 filter: CollectorFilter, 946 options?: AwaitReactionsOptions, 947 ): Promise<Collection<Snowflake, MessageReaction>>; 948 public createReactionCollector(filter: CollectorFilter, options?: ReactionCollectorOptions): ReactionCollector; 949 public delete(options?: { timeout?: number; reason?: string }): Promise<Message>; 950 public edit(content: StringResolvable, options?: MessageEditOptions | MessageEmbed): Promise<Message>; 951 public edit(options: MessageEditOptions | MessageEmbed | APIMessage): Promise<Message>; 952 public equals(message: Message, rawData: object): boolean; 953 public fetchWebhook(): Promise<Webhook>; 954 public fetch(): Promise<Message>; 955 public pin(): Promise<Message>; 956 public react(emoji: EmojiIdentifierResolvable): Promise<MessageReaction>; 957 public reply( 958 content?: StringResolvable, 959 options?: MessageOptions | MessageAdditions | (MessageOptions & { split?: false }) | MessageAdditions, 960 ): Promise<Message>; 961 public reply( 962 content?: StringResolvable, 963 options?: (MessageOptions & { split: true | SplitOptions }) | MessageAdditions, 964 ): Promise<Message[]>; 965 public reply( 966 options?: 967 | MessageOptions 968 | MessageAdditions 969 | APIMessage 970 | (MessageOptions & { split?: false }) 971 | MessageAdditions 972 | APIMessage, 973 ): Promise<Message>; 974 public reply( 975 options?: (MessageOptions & { split: true | SplitOptions }) | MessageAdditions | APIMessage, 976 ): Promise<Message[]>; 977 public suppressEmbeds(suppress?: boolean): Promise<Message>; 978 public toJSON(): object; 979 public toString(): string; 980 public unpin(): Promise<Message>; 981 } 982 983 export class MessageAttachment { 984 constructor(attachment: BufferResolvable | Stream, name?: string, data?: object); 985 986 public attachment: BufferResolvable | Stream; 987 public height: number | null; 988 public id: Snowflake; 989 public name?: string; 990 public proxyURL: string; 991 public size: number; 992 public readonly spoiler: boolean; 993 public url: string; 994 public width: number | null; 995 public setFile(attachment: BufferResolvable | Stream, name?: string): this; 996 public setName(name: string): this; 997 public toJSON(): object; 998 } 999 1000 export class MessageCollector extends Collector<Snowflake, Message> { 1001 constructor(channel: TextChannel | DMChannel, filter: CollectorFilter, options?: MessageCollectorOptions); 1002 private _handleChannelDeletion(channel: GuildChannel): void; 1003 private _handleGuildDeletion(guild: Guild): void; 1004 1005 public channel: Channel; 1006 public options: MessageCollectorOptions; 1007 public received: number; 1008 1009 public collect(message: Message): Snowflake; 1010 public dispose(message: Message): Snowflake; 1011 public endReason(): string; 1012 } 1013 1014 export class MessageEmbed { 1015 constructor(data?: MessageEmbed | MessageEmbedOptions); 1016 public author: MessageEmbedAuthor | null; 1017 public color?: number; 1018 public readonly createdAt: Date | null; 1019 public description?: string; 1020 public fields: EmbedField[]; 1021 public files: (MessageAttachment | string | FileOptions)[]; 1022 public footer: MessageEmbedFooter | null; 1023 public readonly hexColor: string | null; 1024 public image: MessageEmbedImage | null; 1025 public readonly length: number; 1026 public provider: MessageEmbedProvider | null; 1027 public thumbnail: MessageEmbedThumbnail | null; 1028 public timestamp: number | null; 1029 public title?: string; 1030 public type: string; 1031 public url?: string; 1032 public readonly video: MessageEmbedVideo | null; 1033 public addField(name: StringResolvable, value: StringResolvable, inline?: boolean): this; 1034 public addFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this; 1035 public attachFiles(file: (MessageAttachment | FileOptions | string)[]): this; 1036 public setAuthor(name: StringResolvable, iconURL?: string, url?: string): this; 1037 public setColor(color: ColorResolvable): this; 1038 public setDescription(description: StringResolvable): this; 1039 public setFooter(text: StringResolvable, iconURL?: string): this; 1040 public setImage(url: string): this; 1041 public setThumbnail(url: string): this; 1042 public setTimestamp(timestamp?: Date | number): this; 1043 public setTitle(title: StringResolvable): this; 1044 public setURL(url: string): this; 1045 public spliceFields(index: number, deleteCount: number, ...fields: EmbedFieldData[] | EmbedFieldData[][]): this; 1046 public toJSON(): object; 1047 1048 public static normalizeField( 1049 name: StringResolvable, 1050 value: StringResolvable, 1051 inline?: boolean, 1052 ): Required<EmbedFieldData>; 1053 public static normalizeFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): Required<EmbedFieldData>[]; 1054 } 1055 1056 export class MessageFlags extends BitField<MessageFlagsString> { 1057 public static FLAGS: Record<MessageFlagsString, number>; 1058 public static resolve(bit?: BitFieldResolvable<MessageFlagsString>): number; 1059 } 1060 1061 export class MessageMentions { 1062 constructor( 1063 message: Message, 1064 users: object[] | Collection<Snowflake, User>, 1065 roles: Snowflake[] | Collection<Snowflake, Role>, 1066 everyone: boolean, 1067 ); 1068 private _channels: Collection<Snowflake, GuildChannel> | null; 1069 private readonly _content: Message; 1070 private _members: Collection<Snowflake, GuildMember> | null; 1071 1072 public readonly channels: Collection<Snowflake, TextChannel>; 1073 public readonly client: Client; 1074 public everyone: boolean; 1075 public readonly guild: Guild; 1076 public has( 1077 data: User | GuildMember | Role | GuildChannel, 1078 options?: { 1079 ignoreDirect?: boolean; 1080 ignoreRoles?: boolean; 1081 ignoreEveryone?: boolean; 1082 }, 1083 ): boolean; 1084 public readonly members: Collection<Snowflake, GuildMember> | null; 1085 public roles: Collection<Snowflake, Role>; 1086 public users: Collection<Snowflake, User>; 1087 public crosspostedChannels: Collection<Snowflake, CrosspostedChannel>; 1088 public toJSON(): object; 1089 1090 public static CHANNELS_PATTERN: RegExp; 1091 public static EVERYONE_PATTERN: RegExp; 1092 public static ROLES_PATTERN: RegExp; 1093 public static USERS_PATTERN: RegExp; 1094 } 1095 1096 export class MessageReaction { 1097 constructor(client: Client, data: object, message: Message); 1098 private _emoji: GuildEmoji | ReactionEmoji; 1099 1100 public count: number | null; 1101 public readonly emoji: GuildEmoji | ReactionEmoji; 1102 public me: boolean; 1103 public message: Message; 1104 public readonly partial: boolean; 1105 public users: ReactionUserManager; 1106 public remove(): Promise<MessageReaction>; 1107 public fetch(): Promise<MessageReaction>; 1108 public toJSON(): object; 1109 } 1110 1111 export class NewsChannel extends TextBasedChannel(GuildChannel) { 1112 constructor(guild: Guild, data?: object); 1113 public messages: MessageManager; 1114 public nsfw: boolean; 1115 public topic: string | null; 1116 public type: 'news'; 1117 public createWebhook( 1118 name: string, 1119 options?: { avatar?: BufferResolvable | Base64Resolvable; reason?: string }, 1120 ): Promise<Webhook>; 1121 public setNSFW(nsfw: boolean, reason?: string): Promise<NewsChannel>; 1122 public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>; 1123 } 1124 1125 export class PartialGroupDMChannel extends Channel { 1126 constructor(client: Client, data: object); 1127 public name: string; 1128 public icon: string | null; 1129 public iconURL(options?: ImageURLOptions): string | null; 1130 } 1131 1132 export class PermissionOverwrites { 1133 constructor(guildChannel: GuildChannel, data?: object); 1134 public allow: Readonly<Permissions>; 1135 public readonly channel: GuildChannel; 1136 public deny: Readonly<Permissions>; 1137 public id: Snowflake; 1138 public type: OverwriteType; 1139 public update(options: PermissionOverwriteOption, reason?: string): Promise<PermissionOverwrites>; 1140 public delete(reason?: string): Promise<PermissionOverwrites>; 1141 public toJSON(): object; 1142 public static resolveOverwriteOptions( 1143 options: ResolvedOverwriteOptions, 1144 initialPermissions: { allow?: PermissionResolvable; deny?: PermissionResolvable }, 1145 ): ResolvedOverwriteOptions; 1146 public static resolve(overwrite: OverwriteResolvable, guild: Guild): RawOverwriteData; 1147 } 1148 1149 export class Permissions extends BitField<PermissionString> { 1150 public any(permission: PermissionResolvable, checkAdmin?: boolean): boolean; 1151 public has(permission: PermissionResolvable, checkAdmin?: boolean): boolean; 1152 public missing(bits: BitFieldResolvable<PermissionString>, checkAdmin?: boolean): PermissionString[]; 1153 public serialize(checkAdmin?: boolean): Record<PermissionString, boolean>; 1154 public toArray(checkAdmin?: boolean): PermissionString[]; 1155 1156 public static ALL: number; 1157 public static DEFAULT: number; 1158 public static FLAGS: PermissionFlags; 1159 public static resolve(permission?: PermissionResolvable): number; 1160 } 1161 1162 export class Presence { 1163 constructor(client: Client, data?: object); 1164 public activities: Activity[]; 1165 public clientStatus: ClientPresenceStatusData | null; 1166 public flags: Readonly<ActivityFlags>; 1167 public guild: Guild | null; 1168 public readonly member: GuildMember | null; 1169 public status: PresenceStatus; 1170 public readonly user: User | null; 1171 public userID: Snowflake; 1172 public equals(presence: Presence): boolean; 1173 } 1174 1175 export class ReactionCollector extends Collector<Snowflake, MessageReaction> { 1176 constructor(message: Message, filter: CollectorFilter, options?: ReactionCollectorOptions); 1177 private _handleChannelDeletion(channel: GuildChannel): void; 1178 private _handleGuildDeletion(guild: Guild): void; 1179 private _handleMessageDeletion(message: Message): void; 1180 1181 public message: Message; 1182 public options: ReactionCollectorOptions; 1183 public total: number; 1184 public users: Collection<Snowflake, User>; 1185 1186 public static key(reaction: MessageReaction): Snowflake | string; 1187 1188 public collect(reaction: MessageReaction): Snowflake | string; 1189 public dispose(reaction: MessageReaction, user: User): Snowflake | string; 1190 public empty(): void; 1191 public endReason(): string | null; 1192 1193 public on(event: 'collect' | 'dispose' | 'remove', listener: (reaction: MessageReaction, user: User) => void): this; 1194 public on( 1195 event: 'end', 1196 listener: (collected: Collection<Snowflake, MessageReaction>, reason: string) => void, 1197 ): this; 1198 public on(event: string, listener: (...args: any[]) => void): this; 1199 1200 public once( 1201 event: 'collect' | 'dispose' | 'remove', 1202 listener: (reaction: MessageReaction, user: User) => void, 1203 ): this; 1204 public once( 1205 event: 'end', 1206 listener: (collected: Collection<Snowflake, MessageReaction>, reason: string) => void, 1207 ): this; 1208 public once(event: string, listener: (...args: any[]) => void): this; 1209 } 1210 1211 export class ReactionEmoji extends Emoji { 1212 constructor(reaction: MessageReaction, emoji: object); 1213 public reaction: MessageReaction; 1214 public toJSON(): object; 1215 } 1216 1217 export class RichPresenceAssets { 1218 constructor(activity: Activity, assets: object); 1219 public largeImage: Snowflake | null; 1220 public largeText: string | null; 1221 public smallImage: Snowflake | null; 1222 public smallText: string | null; 1223 public largeImageURL(options?: ImageURLOptions): string | null; 1224 public smallImageURL(options?: ImageURLOptions): string | null; 1225 } 1226 1227 export class Role extends Base { 1228 constructor(client: Client, data: object, guild: Guild); 1229 public color: number; 1230 public readonly createdAt: Date; 1231 public readonly createdTimestamp: number; 1232 public deleted: boolean; 1233 public readonly editable: boolean; 1234 public guild: Guild; 1235 public readonly hexColor: string; 1236 public hoist: boolean; 1237 public id: Snowflake; 1238 public managed: boolean; 1239 public readonly members: Collection<Snowflake, GuildMember>; 1240 public mentionable: boolean; 1241 public name: string; 1242 public permissions: Readonly<Permissions>; 1243 public readonly position: number; 1244 public rawPosition: number; 1245 public comparePositionTo(role: Role): number; 1246 public delete(reason?: string): Promise<Role>; 1247 public edit(data: RoleData, reason?: string): Promise<Role>; 1248 public equals(role: Role): boolean; 1249 public permissionsIn(channel: ChannelResolvable): Readonly<Permissions>; 1250 public setColor(color: ColorResolvable, reason?: string): Promise<Role>; 1251 public setHoist(hoist: boolean, reason?: string): Promise<Role>; 1252 public setMentionable(mentionable: boolean, reason?: string): Promise<Role>; 1253 public setName(name: string, reason?: string): Promise<Role>; 1254 public setPermissions(permissions: PermissionResolvable, reason?: string): Promise<Role>; 1255 public setPosition(position: number, options?: { relative?: boolean; reason?: string }): Promise<Role>; 1256 public toJSON(): object; 1257 public toString(): string; 1258 1259 public static comparePositions(role1: Role, role2: Role): number; 1260 } 1261 1262 export class Shard extends EventEmitter { 1263 constructor(manager: ShardingManager, id: number); 1264 private _evals: Map<string, Promise<any>>; 1265 private _exitListener: (...args: any[]) => void; 1266 private _fetches: Map<string, Promise<any>>; 1267 private _handleExit(respawn?: boolean): void; 1268 private _handleMessage(message: any): void; 1269 1270 public args: string[]; 1271 public execArgv: string[]; 1272 public env: object; 1273 public id: number; 1274 public manager: ShardingManager; 1275 public process: ChildProcess | null; 1276 public ready: boolean; 1277 public worker: any | null; 1278 public eval(script: string): Promise<any>; 1279 public eval<T>(fn: (client: Client) => T): Promise<T[]>; 1280 public fetchClientValue(prop: string): Promise<any>; 1281 public kill(): void; 1282 public respawn(delay?: number, spawnTimeout?: number): Promise<ChildProcess>; 1283 public send(message: any): Promise<Shard>; 1284 public spawn(spawnTimeout?: number): Promise<ChildProcess>; 1285 1286 public on(event: 'spawn' | 'death', listener: (child: ChildProcess) => void): this; 1287 public on(event: 'disconnect' | 'ready' | 'reconnecting', listener: () => void): this; 1288 public on(event: 'error', listener: (error: Error) => void): this; 1289 public on(event: 'message', listener: (message: any) => void): this; 1290 public on(event: string, listener: (...args: any[]) => void): this; 1291 1292 public once(event: 'spawn' | 'death', listener: (child: ChildProcess) => void): this; 1293 public once(event: 'disconnect' | 'ready' | 'reconnecting', listener: () => void): this; 1294 public once(event: 'error', listener: (error: Error) => void): this; 1295 public once(event: 'message', listener: (message: any) => void): this; 1296 public once(event: string, listener: (...args: any[]) => void): this; 1297 } 1298 1299 export class ShardClientUtil { 1300 constructor(client: Client, mode: ShardingManagerMode); 1301 private _handleMessage(message: any): void; 1302 private _respond(type: string, message: any): void; 1303 1304 public client: Client; 1305 public readonly count: number; 1306 public readonly ids: number[]; 1307 public mode: ShardingManagerMode; 1308 public parentPort: any | null; 1309 public broadcastEval(script: string): Promise<any[]>; 1310 public broadcastEval<T>(fn: (client: Client) => T): Promise<T[]>; 1311 public fetchClientValues(prop: string): Promise<any[]>; 1312 public respawnAll(shardDelay?: number, respawnDelay?: number, spawnTimeout?: number): Promise<void>; 1313 public send(message: any): Promise<void>; 1314 1315 public static singleton(client: Client, mode: ShardingManagerMode): ShardClientUtil; 1316 } 1317 1318 export class ShardingManager extends EventEmitter { 1319 constructor( 1320 file: string, 1321 options?: { 1322 totalShards?: number | 'auto'; 1323 shardList?: number[] | 'auto'; 1324 mode?: ShardingManagerMode; 1325 respawn?: boolean; 1326 shardArgs?: string[]; 1327 token?: string; 1328 execArgv?: string[]; 1329 }, 1330 ); 1331 1332 public file: string; 1333 public respawn: boolean; 1334 public shardArgs: string[]; 1335 public shards: Collection<number, Shard>; 1336 public token: string | null; 1337 public totalShards: number | 'auto'; 1338 public broadcast(message: any): Promise<Shard[]>; 1339 public broadcastEval(script: string): Promise<any[]>; 1340 public createShard(id: number): Shard; 1341 public fetchClientValues(prop: string): Promise<any[]>; 1342 public respawnAll( 1343 shardDelay?: number, 1344 respawnDelay?: number, 1345 spawnTimeout?: number, 1346 ): Promise<Collection<number, Shard>>; 1347 public spawn(amount?: number | 'auto', delay?: number, spawnTimeout?: number): Promise<Collection<number, Shard>>; 1348 1349 public on(event: 'shardCreate', listener: (shard: Shard) => void): this; 1350 1351 public once(event: 'shardCreate', listener: (shard: Shard) => void): this; 1352 } 1353 1354 export class SnowflakeUtil { 1355 public static deconstruct(snowflake: Snowflake): DeconstructedSnowflake; 1356 public static generate(timestamp?: number | Date): Snowflake; 1357 } 1358 1359 export class Speaking extends BitField<SpeakingString> { 1360 public static FLAGS: Record<SpeakingString, number>; 1361 public static resolve(bit?: BitFieldResolvable<SpeakingString>): number; 1362 } 1363 1364 export class StoreChannel extends GuildChannel { 1365 constructor(guild: Guild, data?: object); 1366 public nsfw: boolean; 1367 public type: 'store'; 1368 } 1369 1370 class StreamDispatcher extends VolumeMixin(Writable) { 1371 constructor(player: object, options?: StreamOptions, streams?: object); 1372 public readonly bitrateEditable: boolean; 1373 public broadcast: VoiceBroadcast | null; 1374 public readonly paused: boolean; 1375 public pausedSince: number | null; 1376 public readonly pausedTime: number; 1377 public player: object; 1378 public readonly streamTime: number; 1379 public readonly totalStreamTime: number; 1380 1381 public pause(silence?: boolean): void; 1382 public resume(): void; 1383 public setBitrate(value: number | 'auto'): boolean; 1384 public setFEC(enabled: boolean): boolean; 1385 public setPLP(value: number): boolean; 1386 1387 public on(event: 'close' | 'drain' | 'finish' | 'start', listener: () => void): this; 1388 public on(event: 'debug', listener: (info: string) => void): this; 1389 public on(event: 'error', listener: (err: Error) => void): this; 1390 public on(event: 'pipe' | 'unpipe', listener: (src: Readable) => void): this; 1391 public on(event: 'speaking', listener: (speaking: boolean) => void): this; 1392 public on(event: 'volumeChange', listener: (oldVolume: number, newVolume: number) => void): this; 1393 public on(event: string, listener: (...args: any[]) => void): this; 1394 1395 public once(event: 'close' | 'drain' | 'finish' | 'start', listener: () => void): this; 1396 public once(event: 'debug', listener: (info: string) => void): this; 1397 public once(event: 'error', listener: (err: Error) => void): this; 1398 public once(event: 'pipe' | 'unpipe', listener: (src: Readable) => void): this; 1399 public once(event: 'speaking', listener: (speaking: boolean) => void): this; 1400 public once(event: 'volumeChange', listener: (oldVolume: number, newVolume: number) => void): this; 1401 public once(event: string, listener: (...args: any[]) => void): this; 1402 } 1403 1404 export class Structures { 1405 public static get<K extends keyof Extendable>(structure: K): Extendable[K]; 1406 public static get(structure: string): (...args: any[]) => void; 1407 public static extend<K extends keyof Extendable, T extends Extendable[K]>( 1408 structure: K, 1409 extender: (baseClass: Extendable[K]) => T, 1410 ): T; 1411 public static extend<T extends (...args: any[]) => void>( 1412 structure: string, 1413 extender: (baseClass: typeof Function) => T, 1414 ): T; 1415 } 1416 1417 export class SystemChannelFlags extends BitField<SystemChannelFlagsString> { 1418 public static FLAGS: Record<SystemChannelFlagsString, number>; 1419 public static resolve(bit?: BitFieldResolvable<SystemChannelFlagsString>): number; 1420 } 1421 1422 export class Team extends Base { 1423 constructor(client: Client, data: object); 1424 public id: Snowflake; 1425 public name: string; 1426 public icon: string | null; 1427 public ownerID: Snowflake | null; 1428 public members: Collection<Snowflake, TeamMember>; 1429 1430 public readonly owner: TeamMember; 1431 public readonly createdAt: Date; 1432 public readonly createdTimestamp: number; 1433 1434 public iconURL(options?: ImageURLOptions): string; 1435 public toJSON(): object; 1436 public toString(): string; 1437 } 1438 1439 export class TeamMember extends Base { 1440 constructor(team: Team, data: object); 1441 public team: Team; 1442 public readonly id: Snowflake; 1443 public permissions: string[]; 1444 public membershipState: MembershipStates; 1445 public user: User; 1446 1447 public toString(): string; 1448 } 1449 1450 export class TextChannel extends TextBasedChannel(GuildChannel) { 1451 constructor(guild: Guild, data?: object); 1452 public messages: MessageManager; 1453 public nsfw: boolean; 1454 public type: 'text'; 1455 public rateLimitPerUser: number; 1456 public topic: string | null; 1457 public createWebhook( 1458 name: string, 1459 options?: { avatar?: BufferResolvable | Base64Resolvable; reason?: string }, 1460 ): Promise<Webhook>; 1461 public setNSFW(nsfw: boolean, reason?: string): Promise<TextChannel>; 1462 public setRateLimitPerUser(rateLimitPerUser: number, reason?: string): Promise<TextChannel>; 1463 public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>; 1464 } 1465 1466 export class User extends PartialTextBasedChannel(Base) { 1467 constructor(client: Client, data: object); 1468 public avatar: string | null; 1469 public bot: boolean; 1470 public readonly createdAt: Date; 1471 public readonly createdTimestamp: number; 1472 public discriminator: string; 1473 public readonly defaultAvatarURL: string; 1474 public readonly dmChannel: DMChannel; 1475 public flags: Readonly<UserFlags>; 1476 public id: Snowflake; 1477 public lastMessageID: Snowflake | null; 1478 public locale: string; 1479 public readonly partial: false; 1480 public readonly presence: Presence; 1481 public system?: boolean; 1482 public readonly tag: string; 1483 public username: string; 1484 public avatarURL(options?: ImageURLOptions & { dynamic?: boolean }): string | null; 1485 public createDM(): Promise<DMChannel>; 1486 public deleteDM(): Promise<DMChannel>; 1487 public displayAvatarURL(options?: ImageURLOptions & { dynamic?: boolean }): string; 1488 public equals(user: User): boolean; 1489 public fetch(): Promise<User>; 1490 public toString(): string; 1491 public typingDurationIn(channel: ChannelResolvable): number; 1492 public typingIn(channel: ChannelResolvable): boolean; 1493 public typingSinceIn(channel: ChannelResolvable): Date; 1494 } 1495 1496 export class UserFlags extends BitField<UserFlagsString> { 1497 public static FLAGS: Record<UserFlagsString, number>; 1498 public static resolve(bit?: BitFieldResolvable<UserFlagsString>): number; 1499 } 1500 1501 export class Util { 1502 public static basename(path: string, ext?: string): string; 1503 public static binaryToID(num: string): Snowflake; 1504 public static cleanContent(str: string, message: Message): string; 1505 public static removeMentions(str: string): string; 1506 public static cloneObject(obj: object): object; 1507 public static convertToBuffer(ab: ArrayBuffer | string): Buffer; 1508 public static delayFor(ms: number): Promise<void>; 1509 public static discordSort<K, V extends { rawPosition: number; id: string }>( 1510 collection: Collection<K, V>, 1511 ): Collection<K, V>; 1512 public static escapeMarkdown(text: string, options?: EscapeMarkdownOptions): string; 1513 public static escapeCodeBlock(text: string): string; 1514 public static escapeInlineCode(text: string): string; 1515 public static escapeBold(text: string): string; 1516 public static escapeItalic(text: string): string; 1517 public static escapeUnderline(text: string): string; 1518 public static escapeStrikethrough(text: string): string; 1519 public static escapeSpoiler(text: string): string; 1520 public static cleanCodeBlockContent(text: string): string; 1521 public static fetchRecommendedShards(token: string, guildsPerShard?: number): Promise<number>; 1522 public static flatten(obj: object, ...props: { [key: string]: boolean | string }[]): object; 1523 public static idToBinary(num: Snowflake): string; 1524 public static makeError(obj: { name: string; message: string; stack: string }): Error; 1525 public static makePlainError(err: Error): { name: string; message: string; stack: string }; 1526 public static mergeDefault(def: object, given: object): object; 1527 public static moveElementInArray(array: any[], element: any, newIndex: number, offset?: boolean): number; 1528 public static parseEmoji(text: string): { animated: boolean; name: string; id: string | null } | null; 1529 public static resolveColor(color: ColorResolvable): number; 1530 public static resolveString(data: StringResolvable): string; 1531 public static setPosition<T extends Channel | Role>( 1532 item: T, 1533 position: number, 1534 relative: boolean, 1535 sorted: Collection<Snowflake, T>, 1536 route: object, 1537 reason?: string, 1538 ): Promise<{ id: Snowflake; position: number }[]>; 1539 public static splitMessage(text: StringResolvable, options?: SplitOptions): string[]; 1540 public static str2ab(str: string): ArrayBuffer; 1541 } 1542 1543 class VoiceBroadcast extends EventEmitter { 1544 constructor(client: Client); 1545 public client: Client; 1546 public subscribers: StreamDispatcher[]; 1547 public readonly dispatcher?: BroadcastDispatcher; 1548 public play(input: string | Readable, options?: StreamOptions): BroadcastDispatcher; 1549 public end(): void; 1550 1551 public on(event: 'end', listener: () => void): this; 1552 public on(event: 'subscribe' | 'unsubscribe', listener: (dispatcher: StreamDispatcher) => void): this; 1553 public on(event: string, listener: (...args: any[]) => void): this; 1554 1555 public once(event: 'end', listener: () => void): this; 1556 public once(event: 'subscribe' | 'unsubscribe', listener: (dispatcher: StreamDispatcher) => void): this; 1557 public once(event: string, listener: (...args: any[]) => void): this; 1558 } 1559 1560 export class VoiceChannel extends GuildChannel { 1561 constructor(guild: Guild, data?: object); 1562 public bitrate: number; 1563 public readonly editable: boolean; 1564 public readonly full: boolean; 1565 public readonly joinable: boolean; 1566 public readonly speakable: boolean; 1567 public type: 'voice'; 1568 public userLimit: number; 1569 public join(): Promise<VoiceConnection>; 1570 public leave(): void; 1571 public setBitrate(bitrate: number, reason?: string): Promise<VoiceChannel>; 1572 public setUserLimit(userLimit: number, reason?: string): Promise<VoiceChannel>; 1573 } 1574 1575 class VoiceConnection extends EventEmitter { 1576 constructor(voiceManager: ClientVoiceManager, channel: VoiceChannel); 1577 private authentication: object; 1578 private sockets: object; 1579 private ssrcMap: Map<number, boolean>; 1580 private _speaking: Map<Snowflake, Readonly<Speaking>>; 1581 private _disconnect(): void; 1582 private authenticate(): void; 1583 private authenticateFailed(reason: string): void; 1584 private checkAuthenticated(): void; 1585 private cleanup(): void; 1586 private connect(): void; 1587 private onReady(data: object): void; 1588 private onSessionDescription(mode: string, secret: string): void; 1589 private onSpeaking(data: object): void; 1590 private reconnect(token: string, endpoint: string): void; 1591 private sendVoiceStateUpdate(options: object): Promise<Shard>; 1592 private setSessionID(sessionID: string): void; 1593 private setSpeaking(value: BitFieldResolvable<SpeakingString>): void; 1594 private setTokenAndEndpoint(token: string, endpoint: string): void; 1595 private updateChannel(channel: VoiceChannel): void; 1596 1597 public channel: VoiceChannel; 1598 public readonly client: Client; 1599 public readonly dispatcher: StreamDispatcher; 1600 public player: object; 1601 public receiver: VoiceReceiver; 1602 public speaking: Readonly<Speaking>; 1603 public status: VoiceStatus; 1604 public readonly voice: VoiceState; 1605 public voiceManager: ClientVoiceManager; 1606 public disconnect(): void; 1607 public play(input: VoiceBroadcast | Readable | string, options?: StreamOptions): StreamDispatcher; 1608 1609 public on(event: 'authenticated' | 'closing' | 'newSession' | 'ready' | 'reconnecting', listener: () => void): this; 1610 public on(event: 'debug', listener: (message: string) => void): this; 1611 public on(event: 'error' | 'failed' | 'disconnect', listener: (error: Error) => void): this; 1612 public on(event: 'speaking', listener: (user: User, speaking: Readonly<Speaking>) => void): this; 1613 public on(event: 'warn', listener: (warning: string | Error) => void): this; 1614 public on(event: string, listener: (...args: any[]) => void): this; 1615 1616 public once( 1617 event: 'authenticated' | 'closing' | 'newSession' | 'ready' | 'reconnecting', 1618 listener: () => void, 1619 ): this; 1620 public once(event: 'debug', listener: (message: string) => void): this; 1621 public once(event: 'error' | 'failed' | 'disconnect', listener: (error: Error) => void): this; 1622 public once(event: 'speaking', listener: (user: User, speaking: Readonly<Speaking>) => void): this; 1623 public once(event: 'warn', listener: (warning: string | Error) => void): this; 1624 public once(event: string, listener: (...args: any[]) => void): this; 1625 } 1626 1627 class VoiceReceiver extends EventEmitter { 1628 constructor(connection: VoiceConnection); 1629 public createStream( 1630 user: UserResolvable, 1631 options?: { mode?: 'opus' | 'pcm'; end?: 'silence' | 'manual' }, 1632 ): Readable; 1633 1634 public on(event: 'debug', listener: (error: Error | string) => void): this; 1635 public on(event: string, listener: (...args: any[]) => void): this; 1636 1637 public once(event: 'debug', listener: (error: Error | string) => void): this; 1638 public once(event: string, listener: (...args: any[]) => void): this; 1639 } 1640 1641 export class VoiceRegion { 1642 constructor(data: object); 1643 public custom: boolean; 1644 public deprecated: boolean; 1645 public id: string; 1646 public name: string; 1647 public optimal: boolean; 1648 public vip: boolean; 1649 public toJSON(): object; 1650 } 1651 1652 export class VoiceState extends Base { 1653 constructor(guild: Guild, data: object); 1654 public readonly channel: VoiceChannel | null; 1655 public channelID?: Snowflake; 1656 public readonly connection: VoiceConnection | null; 1657 public readonly deaf?: boolean; 1658 public guild: Guild; 1659 public id: Snowflake; 1660 public readonly member: GuildMember | null; 1661 public readonly mute?: boolean; 1662 public selfDeaf?: boolean; 1663 public selfMute?: boolean; 1664 public serverDeaf?: boolean; 1665 public serverMute?: boolean; 1666 public sessionID?: string; 1667 public streaming: boolean; 1668 public readonly speaking: boolean | null; 1669 1670 public setDeaf(deaf: boolean, reason?: string): Promise<GuildMember>; 1671 public setMute(mute: boolean, reason?: string): Promise<GuildMember>; 1672 public kick(reason?: string): Promise<GuildMember>; 1673 public setChannel(channel: ChannelResolvable | null, reason?: string): Promise<GuildMember>; 1674 public setSelfDeaf(deaf: boolean): Promise<boolean>; 1675 public setSelfMute(mute: boolean): Promise<boolean>; 1676 } 1677 1678 class VolumeInterface extends EventEmitter { 1679 constructor(options?: { volume?: number }); 1680 public readonly volume: number; 1681 public readonly volumeDecibels: number; 1682 public readonly volumeEditable: boolean; 1683 public readonly volumeLogarithmic: number; 1684 public setVolume(volume: number): void; 1685 public setVolumeDecibels(db: number): void; 1686 public setVolumeLogarithmic(value: number): void; 1687 1688 public on(event: 'volumeChange', listener: (oldVolume: number, newVolume: number) => void): this; 1689 1690 public once(event: 'volumeChange', listener: (oldVolume: number, newVolume: number) => void): this; 1691 } 1692 1693 export class Webhook extends WebhookMixin() { 1694 constructor(client: Client, data?: object); 1695 public avatar: string; 1696 public avatarURL(options?: ImageURLOptions): string | null; 1697 public channelID: Snowflake; 1698 public client: Client; 1699 public guildID: Snowflake; 1700 public name: string; 1701 public owner: User | object | null; 1702 public token: string | null; 1703 public type: WebhookTypes; 1704 } 1705 1706 export class WebhookClient extends WebhookMixin(BaseClient) { 1707 constructor(id: string, token: string, options?: ClientOptions); 1708 public client: this; 1709 public token: string; 1710 } 1711 1712 export class WebSocketManager extends EventEmitter { 1713 constructor(client: Client); 1714 private totalShards: number | string; 1715 private shardQueue: Set<WebSocketShard>; 1716 private packetQueue: object[]; 1717 private destroyed: boolean; 1718 private reconnecting: boolean; 1719 private sessionStartLimit?: { total: number; remaining: number; reset_after: number }; 1720 1721 public readonly client: Client; 1722 public gateway?: string; 1723 public shards: Collection<number, WebSocketShard>; 1724 public status: Status; 1725 public readonly ping: number; 1726 1727 public on(event: WSEventType, listener: (data: any, shardID: number) => void): this; 1728 public once(event: WSEventType, listener: (data: any, shardID: number) => void): this; 1729 1730 private debug(message: string, shard?: WebSocketShard): void; 1731 private connect(): Promise<void>; 1732 private createShards(): Promise<void>; 1733 private reconnect(): Promise<void>; 1734 private broadcast(packet: object): void; 1735 private destroy(): void; 1736 private _handleSessionLimit(remaining?: number, resetAfter?: number): Promise<void>; 1737 private handlePacket(packet?: object, shard?: WebSocketShard): boolean; 1738 private checkShardsReady(): Promise<void>; 1739 private triggerClientReady(): void; 1740 } 1741 1742 export class WebSocketShard extends EventEmitter { 1743 constructor(manager: WebSocketManager, id: number); 1744 private sequence: number; 1745 private closeSequence: number; 1746 private sessionID?: string; 1747 private lastPingTimestamp: number; 1748 private lastHeartbeatAcked: boolean; 1749 private ratelimit: { queue: object[]; total: number; remaining: number; time: 60e3; timer: NodeJS.Timeout | null }; 1750 private connection: WebSocket | null; 1751 private helloTimeout: NodeJS.Timeout | undefined; 1752 private eventsAttached: boolean; 1753 private expectedGuilds: Set<Snowflake> | undefined; 1754 private readyTimeout: NodeJS.Timeout | undefined; 1755 1756 public manager: WebSocketManager; 1757 public id: number; 1758 public status: Status; 1759 public ping: number; 1760 1761 private debug(message: string): void; 1762 private connect(): Promise<void>; 1763 private onOpen(): void; 1764 private onMessage(event: MessageEvent): void; 1765 private onError(error: ErrorEvent | object): void; 1766 private onClose(event: CloseEvent): void; 1767 private onPacket(packet: object): void; 1768 private checkReady(): void; 1769 private setHelloTimeout(time?: number): void; 1770 private setHeartbeatTimer(time: number): void; 1771 private sendHeartbeat(): void; 1772 private ackHeartbeat(): void; 1773 private identify(): void; 1774 private identifyNew(): void; 1775 private identifyResume(): void; 1776 private _send(data: object): void; 1777 private processQueue(): void; 1778 private destroy(destroyOptions?: { closeCode?: number; reset?: boolean; emit?: boolean; log?: boolean }): void; 1779 private _cleanupConnection(): void; 1780 private _emitDestroyed(): void; 1781 1782 public send(data: object): void; 1783 public on(event: 'ready' | 'resumed' | 'invalidSession', listener: () => void): this; 1784 public on(event: 'close', listener: (event: CloseEvent) => void): this; 1785 public on(event: 'allReady', listener: (unavailableGuilds?: Set<Snowflake>) => void): this; 1786 public on(event: string, listener: (...args: any[]) => void): this; 1787 1788 public once(event: 'ready' | 'resumed' | 'invalidSession', listener: () => void): this; 1789 public once(event: 'close', listener: (event: CloseEvent) => void): this; 1790 public once(event: 'allReady', listener: (unavailableGuilds?: Set<Snowflake>) => void): this; 1791 public once(event: string, listener: (...args: any[]) => void): this; 1792 } 1793 1794 //#endregion 1795 1796 //#region Collections 1797 1798 export class Collection<K, V> extends BaseCollection<K, V> { 1799 public flatMap<T>( 1800 fn: (value: V, key: K, collection: this) => Collection<K, T>, 1801 thisArg?: unknown, 1802 ): Collection<K, T>; 1803 public flatMap<T, This>( 1804 fn: (this: This, value: V, key: K, collection: this) => Collection<K, T>, 1805 thisArg: This, 1806 ): Collection<K, T>; 1807 public mapValues<T>(fn: (value: V, key: K, collection: this) => T, thisArg?: unknown): Collection<K, T>; 1808 public mapValues<This, T>( 1809 fn: (this: This, value: V, key: K, collection: this) => T, 1810 thisArg: This, 1811 ): Collection<K, T>; 1812 public toJSON(): object; 1813 } 1814 1815 //#endregion 1816 1817 //#region Managers 1818 1819 export class ChannelManager extends BaseManager<Snowflake, Channel, ChannelResolvable> { 1820 constructor(client: Client, iterable: Iterable<any>); 1821 public fetch(id: Snowflake, cache?: boolean): Promise<Channel>; 1822 } 1823 1824 export abstract class BaseManager<K, Holds, R> { 1825 constructor(client: Client, iterable: Iterable<any>, holds: Constructable<Holds>, cacheType: Collection<K, Holds>); 1826 public holds: Constructable<Holds>; 1827 public cache: Collection<K, Holds>; 1828 public cacheType: Collection<K, Holds>; 1829 public readonly client: Client; 1830 public add(data: any, cache?: boolean, { id, extras }?: { id: K; extras: any[] }): Holds; 1831 public resolve(resolvable: R): Holds | null; 1832 public resolveID(resolvable: R): K | null; 1833 } 1834 1835 export class GuildChannelManager extends BaseManager<Snowflake, GuildChannel, GuildChannelResolvable> { 1836 constructor(guild: Guild, iterable?: Iterable<any>); 1837 public guild: Guild; 1838 public create(name: string, options: GuildCreateChannelOptions & { type: 'voice' }): Promise<VoiceChannel>; 1839 public create(name: string, options: GuildCreateChannelOptions & { type: 'category' }): Promise<CategoryChannel>; 1840 public create(name: string, options?: GuildCreateChannelOptions & { type?: 'text' }): Promise<TextChannel>; 1841 public create( 1842 name: string, 1843 options: GuildCreateChannelOptions, 1844 ): Promise<TextChannel | VoiceChannel | CategoryChannel>; 1845 } 1846 1847 export class GuildEmojiManager extends BaseManager<Snowflake, GuildEmoji, EmojiResolvable> { 1848 constructor(guild: Guild, iterable?: Iterable<any>); 1849 public guild: Guild; 1850 public create( 1851 attachment: BufferResolvable | Base64Resolvable, 1852 name: string, 1853 options?: GuildEmojiCreateOptions, 1854 ): Promise<GuildEmoji>; 1855 public resolveIdentifier(emoji: EmojiIdentifierResolvable): string | null; 1856 } 1857 1858 export class GuildEmojiRoleManager { 1859 constructor(emoji: GuildEmoji); 1860 public emoji: GuildEmoji; 1861 public guild: Guild; 1862 public cache: Collection<Snowflake, Role>; 1863 public add(roleOrRoles: RoleResolvable | RoleResolvable[] | Collection<Snowflake, Role>): Promise<GuildEmoji>; 1864 public set(roles: RoleResolvable[] | Collection<Snowflake, Role>): Promise<GuildEmoji>; 1865 public remove(roleOrRoles: RoleResolvable | RoleResolvable[] | Collection<Snowflake, Role>): Promise<GuildEmoji>; 1866 } 1867 1868 export class GuildManager extends BaseManager<Snowflake, Guild, GuildResolvable> { 1869 constructor(client: Client, iterable?: Iterable<any>); 1870 public create( 1871 name: string, 1872 options?: { region?: string; icon: BufferResolvable | Base64Resolvable | null }, 1873 ): Promise<Guild>; 1874 } 1875 1876 export class GuildMemberManager extends BaseManager<Snowflake, GuildMember, GuildMemberResolvable> { 1877 constructor(guild: Guild, iterable?: Iterable<any>); 1878 public guild: Guild; 1879 public ban(user: UserResolvable, options?: BanOptions): Promise<GuildMember | User | Snowflake>; 1880 public fetch( 1881 options: UserResolvable | FetchMemberOptions | (FetchMembersOptions & { user: UserResolvable }), 1882 ): Promise<GuildMember>; 1883 public fetch(options?: FetchMembersOptions): Promise<Collection<Snowflake, GuildMember>>; 1884 public prune(options: GuildPruneMembersOptions & { dry?: false; count: false }): Promise<null>; 1885 public prune(options?: GuildPruneMembersOptions): Promise<number>; 1886 public unban(user: UserResolvable, reason?: string): Promise<User>; 1887 } 1888 1889 export class GuildMemberRoleManager extends OverridableManager<Snowflake, Role, RoleResolvable> { 1890 constructor(member: GuildMember); 1891 public readonly hoist: Role | null; 1892 public readonly color: Role | null; 1893 public readonly highest: Role; 1894 public member: GuildMember; 1895 public guild: Guild; 1896 1897 public add( 1898 roleOrRoles: RoleResolvable | RoleResolvable[] | Collection<Snowflake, Role>, 1899 reason?: string, 1900 ): Promise<GuildMember>; 1901 public set(roles: RoleResolvable[] | Collection<Snowflake, Role>, reason?: string): Promise<GuildMember>; 1902 public remove( 1903 roleOrRoles: RoleResolvable | RoleResolvable[] | Collection<Snowflake, Role>, 1904 reason?: string, 1905 ): Promise<GuildMember>; 1906 } 1907 1908 export class MessageManager extends BaseManager<Snowflake, Message, MessageResolvable> { 1909 constructor(channel: TextChannel | DMChannel, iterable?: Iterable<any>); 1910 public channel: TextBasedChannelFields; 1911 public cache: Collection<Snowflake, Message>; 1912 public fetch(message: Snowflake, cache?: boolean): Promise<Message>; 1913 public fetch(options?: ChannelLogsQueryOptions, cache?: boolean): Promise<Collection<Snowflake, Message>>; 1914 public fetchPinned(cache?: boolean): Promise<Collection<Snowflake, Message>>; 1915 public delete(message: MessageResolvable, reason?: string): Promise<void>; 1916 } 1917 1918 // Hacky workaround because changing the signature of an overridden method errors 1919 class OverridableManager<V, K, R = any> extends BaseManager<V, K, R> { 1920 public add(data: any, cache: any): any; 1921 public set(key: any): any; 1922 } 1923 1924 export class PresenceManager extends BaseManager<Snowflake, Presence, PresenceResolvable> { 1925 constructor(client: Client, iterable?: Iterable<any>); 1926 } 1927 1928 export class ReactionManager extends BaseManager<Snowflake, MessageReaction, MessageReactionResolvable> { 1929 constructor(message: Message, iterable?: Iterable<any>); 1930 public message: Message; 1931 public removeAll(): Promise<Message>; 1932 } 1933 1934 export class ReactionUserManager extends BaseManager<Snowflake, User, UserResolvable> { 1935 constructor(client: Client, iterable: Iterable<any> | undefined, reaction: MessageReaction); 1936 public reaction: MessageReaction; 1937 public fetch(options?: { 1938 limit?: number; 1939 after?: Snowflake; 1940 before?: Snowflake; 1941 }): Promise<Collection<Snowflake, User>>; 1942 public remove(user?: UserResolvable): Promise<MessageReaction>; 1943 } 1944 1945 export class RoleManager extends BaseManager<Snowflake, Role, RoleResolvable> { 1946 constructor(guild: Guild, iterable?: Iterable<any>); 1947 public readonly everyone: Role; 1948 public readonly highest: Role; 1949 public guild: Guild; 1950 1951 public create(options?: { data?: RoleData; reason?: string }): Promise<Role>; 1952 public fetch(id: Snowflake, cache?: boolean): Promise<Role | null>; 1953 public fetch(id?: Snowflake, cache?: boolean): Promise<this>; 1954 } 1955 1956 export class UserManager extends BaseManager<Snowflake, User, UserResolvable> { 1957 constructor(client: Client, iterable?: Iterable<any>); 1958 public fetch(id: Snowflake, cache?: boolean): Promise<User>; 1959 } 1960 1961 export class VoiceStateManager extends BaseManager<Snowflake, VoiceState, typeof VoiceState> { 1962 constructor(guild: Guild, iterable?: Iterable<any>); 1963 public guild: Guild; 1964 } 1965 1966 //#endregion 1967 1968 //#region Mixins 1969 1970 // Model the TextBasedChannel mixin system, allowing application of these fields 1971 // to the classes that use these methods without having to manually add them 1972 // to each of those classes 1973 1974 type Constructable<T> = new (...args: any[]) => T; 1975 function PartialTextBasedChannel<T>(Base?: Constructable<T>): Constructable<T & PartialTextBasedChannelFields>; 1976 function TextBasedChannel<T>(Base?: Constructable<T>): Constructable<T & TextBasedChannelFields>; 1977 1978 interface PartialTextBasedChannelFields { 1979 lastMessageID: Snowflake | null; 1980 readonly lastMessage: Message | null; 1981 send( 1982 options: MessageOptions | (MessageOptions & { split?: false }) | MessageAdditions | APIMessage, 1983 ): Promise<Message>; 1984 send( 1985 options: (MessageOptions & { split: true | SplitOptions; content: StringResolvable }) | APIMessage, 1986 ): Promise<Message[]>; 1987 send( 1988 content: StringResolvable, 1989 options?: MessageOptions | (MessageOptions & { split?: false }) | MessageAdditions, 1990 ): Promise<Message>; 1991 send(content: StringResolvable, options?: MessageOptions & { split: true | SplitOptions }): Promise<Message[]>; 1992 } 1993 1994 interface TextBasedChannelFields extends PartialTextBasedChannelFields { 1995 _typing: Map<string, TypingData>; 1996 lastPinTimestamp: number | null; 1997 readonly lastPinAt: Date; 1998 typing: boolean; 1999 typingCount: number; 2000 awaitMessages(filter: CollectorFilter, options?: AwaitMessagesOptions): Promise<Collection<Snowflake, Message>>; 2001 bulkDelete( 2002 messages: Collection<Snowflake, Message> | Message[] | Snowflake[] | number, 2003 filterOld?: boolean, 2004 ): Promise<Collection<Snowflake, Message>>; 2005 createMessageCollector(filter: CollectorFilter, options?: MessageCollectorOptions): MessageCollector; 2006 startTyping(count?: number): Promise<void>; 2007 stopTyping(force?: boolean): void; 2008 } 2009 2010 function WebhookMixin<T>(Base?: Constructable<T>): Constructable<T & WebhookFields>; 2011 2012 function VolumeMixin<T>(base: Constructable<T>): Constructable<T & VolumeInterface>; 2013 2014 interface WebhookFields { 2015 id: Snowflake; 2016 readonly createdAt: Date; 2017 readonly createdTimestamp: number; 2018 readonly url: string; 2019 delete(reason?: string): Promise<void>; 2020 edit(options: WebhookEditData): Promise<Webhook>; 2021 send( 2022 content?: StringResolvable, 2023 options?: (WebhookMessageOptions & { split?: false }) | MessageAdditions, 2024 ): Promise<Message>; 2025 send( 2026 content?: StringResolvable, 2027 options?: (WebhookMessageOptions & { split: true | SplitOptions }) | MessageAdditions, 2028 ): Promise<Message[]>; 2029 send(options?: (WebhookMessageOptions & { split?: false }) | MessageAdditions | APIMessage): Promise<Message>; 2030 send( 2031 options?: (WebhookMessageOptions & { split: true | SplitOptions }) | MessageAdditions | APIMessage, 2032 ): Promise<Message[]>; 2033 sendSlackMessage(body: object): Promise<boolean>; 2034 } 2035 2036 //#endregion 2037 2038 //#region Typedefs 2039 2040 type ActivityFlagsString = 'INSTANCE' | 'JOIN' | 'SPECTATE' | 'JOIN_REQUEST' | 'SYNC' | 'PLAY'; 2041 2042 interface ActivityOptions { 2043 name?: string; 2044 url?: string; 2045 type?: ActivityType | number; 2046 shardID?: number | number[]; 2047 } 2048 2049 type ActivityType = 'PLAYING' | 'STREAMING' | 'LISTENING' | 'WATCHING' | 'CUSTOM_STATUS'; 2050 2051 interface AddGuildMemberOptions { 2052 accessToken: string; 2053 nick?: string; 2054 roles?: Collection<Snowflake, Role> | RoleResolvable[]; 2055 mute?: boolean; 2056 deaf?: boolean; 2057 } 2058 2059 interface APIErrror { 2060 UNKNOWN_ACCOUNT: number; 2061 UNKNOWN_APPLICATION: number; 2062 UNKNOWN_CHANNEL: number; 2063 UNKNOWN_GUILD: number; 2064 UNKNOWN_INTEGRATION: number; 2065 UNKNOWN_INVITE: number; 2066 UNKNOWN_MEMBER: number; 2067 UNKNOWN_MESSAGE: number; 2068 UNKNOWN_OVERWRITE: number; 2069 UNKNOWN_PROVIDER: number; 2070 UNKNOWN_ROLE: number; 2071 UNKNOWN_TOKEN: number; 2072 UNKNOWN_USER: number; 2073 UNKNOWN_EMOJI: number; 2074 UNKNOWN_WEBHOOK: number; 2075 BOT_PROHIBITED_ENDPOINT: number; 2076 BOT_ONLY_ENDPOINT: number; 2077 MAXIMUM_GUILDS: number; 2078 MAXIMUM_FRIENDS: number; 2079 MAXIMUM_PINS: number; 2080 MAXIMUM_ROLES: number; 2081 MAXIMUM_REACTIONS: number; 2082 UNAUTHORIZED: number; 2083 MISSING_ACCESS: number; 2084 INVALID_ACCOUNT_TYPE: number; 2085 CANNOT_EXECUTE_ON_DM: number; 2086 EMBED_DISABLED: number; 2087 CANNOT_EDIT_MESSAGE_BY_OTHER: number; 2088 CANNOT_SEND_EMPTY_MESSAGE: number; 2089 CANNOT_MESSAGE_USER: number; 2090 CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL: number; 2091 CHANNEL_VERIFICATION_LEVEL_TOO_HIGH: number; 2092 OAUTH2_APPLICATION_BOT_ABSENT: number; 2093 MAXIMUM_OAUTH2_APPLICATIONS: number; 2094 INVALID_OAUTH_STATE: number; 2095 MISSING_PERMISSIONS: number; 2096 INVALID_AUTHENTICATION_TOKEN: number; 2097 NOTE_TOO_LONG: number; 2098 INVALID_BULK_DELETE_QUANTITY: number; 2099 CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL: number; 2100 CANNOT_EXECUTE_ON_SYSTEM_MESSAGE: number; 2101 BULK_DELETE_MESSAGE_TOO_OLD: number; 2102 INVITE_ACCEPTED_TO_GUILD_NOT_CONTAINING_BOT: number; 2103 REACTION_BLOCKED: number; 2104 } 2105 2106 interface AuditLogChange { 2107 key: string; 2108 old?: any; 2109 new?: any; 2110 } 2111 2112 interface AwaitMessagesOptions extends MessageCollectorOptions { 2113 errors?: string[]; 2114 } 2115 2116 interface AwaitReactionsOptions extends ReactionCollectorOptions { 2117 errors?: string[]; 2118 } 2119 2120 interface BanOptions { 2121 days?: number; 2122 reason?: string; 2123 } 2124 2125 type Base64Resolvable = Buffer | Base64String; 2126 2127 type Base64String = string; 2128 2129 type BitFieldResolvable<T extends string> = 2130 | RecursiveArray<T | number | Readonly<BitField<T>>> 2131 | T 2132 | number 2133 | Readonly<BitField<T>>; 2134 2135 type BufferResolvable = Buffer | string; 2136 2137 interface ChannelCreationOverwrites { 2138 allow?: PermissionResolvable | number; 2139 deny?: PermissionResolvable | number; 2140 id: RoleResolvable | UserResolvable; 2141 } 2142 2143 interface ChannelData { 2144 name?: string; 2145 position?: number; 2146 topic?: string; 2147 nsfw?: boolean; 2148 bitrate?: number; 2149 userLimit?: number; 2150 parentID?: Snowflake; 2151 rateLimitPerUser?: number; 2152 lockPermissions?: boolean; 2153 permissionOverwrites?: OverwriteResolvable[] | Collection<Snowflake, OverwriteResolvable>; 2154 } 2155 2156 interface ChannelLogsQueryOptions { 2157 limit?: number; 2158 before?: Snowflake; 2159 after?: Snowflake; 2160 around?: Snowflake; 2161 } 2162 2163 interface ChannelPosition { 2164 channel: ChannelResolvable; 2165 position: number; 2166 } 2167 2168 type ChannelResolvable = Channel | Snowflake; 2169 2170 interface ClientApplicationAsset { 2171 name: string; 2172 id: Snowflake; 2173 type: 'BIG' | 'SMALL'; 2174 } 2175 2176 interface ClientEvents { 2177 channelCreate: [Channel]; 2178 channelDelete: [Channel | PartialDMChannel]; 2179 channelPinsUpdate: [Channel | PartialDMChannel, Date]; 2180 channelUpdate: [Channel, Channel]; 2181 debug: [string]; 2182 warn: [string]; 2183 disconnect: [any, number]; 2184 emojiCreate: [GuildEmoji]; 2185 emojiDelete: [GuildEmoji]; 2186 emojiUpdate: [GuildEmoji, GuildEmoji]; 2187 error: [Error]; 2188 guildBanAdd: [Guild, User | PartialUser]; 2189 guildBanRemove: [Guild, User | PartialUser]; 2190 guildCreate: [Guild]; 2191 guildDelete: [Guild]; 2192 guildUnavailable: [Guild]; 2193 guildIntegrationsUpdate: [Guild]; 2194 guildMemberAdd: [GuildMember | PartialGuildMember]; 2195 guildMemberAvailable: [GuildMember | PartialGuildMember]; 2196 guildMemberRemove: [GuildMember | PartialGuildMember]; 2197 guildMembersChunk: [Collection<Snowflake, GuildMember | PartialGuildMember>, Guild]; 2198 guildMemberSpeaking: [GuildMember | PartialGuildMember, Readonly<Speaking>]; 2199 guildMemberUpdate: [GuildMember | PartialGuildMember, GuildMember | PartialGuildMember]; 2200 guildUpdate: [Guild, Guild]; 2201 inviteCreate: [Invite]; 2202 inviteDelete: [Invite]; 2203 message: [Message]; 2204 messageDelete: [Message | PartialMessage]; 2205 messageReactionRemoveAll: [Message | PartialMessage]; 2206 messageReactionRemoveEmoji: [MessageReaction]; 2207 messageDeleteBulk: [Collection<Snowflake, Message | PartialMessage>]; 2208 messageReactionAdd: [MessageReaction, User | PartialUser]; 2209 messageReactionRemove: [MessageReaction, User | PartialUser]; 2210 messageUpdate: [Message | PartialMessage, Message | PartialMessage]; 2211 presenceUpdate: [Presence | undefined, Presence]; 2212 rateLimit: [RateLimitData]; 2213 ready: []; 2214 invalidated: []; 2215 roleCreate: [Role]; 2216 roleDelete: [Role]; 2217 roleUpdate: [Role, Role]; 2218 typingStart: [Channel | PartialDMChannel, User | PartialUser]; 2219 userUpdate: [User | PartialUser, User | PartialUser]; 2220 voiceStateUpdate: [VoiceState, VoiceState]; 2221 webhookUpdate: [TextChannel]; 2222 shardDisconnect: [CloseEvent, number]; 2223 shardError: [Error, number]; 2224 shardReady: [number]; 2225 shardReconnecting: [number]; 2226 shardResume: [number, number]; 2227 } 2228 2229 interface ClientOptions { 2230 shards?: number | number[] | 'auto'; 2231 shardCount?: number; 2232 messageCacheMaxSize?: number; 2233 messageCacheLifetime?: number; 2234 messageSweepInterval?: number; 2235 fetchAllMembers?: boolean; 2236 disableMentions?: 'none' | 'all' | 'everyone'; 2237 allowedMentions?: MessageMentionOptions; 2238 partials?: PartialTypes[]; 2239 restWsBridgeTimeout?: number; 2240 restTimeOffset?: number; 2241 restRequestTimeout?: number; 2242 restSweepInterval?: number; 2243 retryLimit?: number; 2244 presence?: PresenceData; 2245 ws?: WebSocketOptions; 2246 http?: HTTPOptions; 2247 } 2248 2249 type ClientPresenceStatus = 'online' | 'idle' | 'dnd'; 2250 2251 interface ClientPresenceStatusData { 2252 web?: ClientPresenceStatus; 2253 mobile?: ClientPresenceStatus; 2254 desktop?: ClientPresenceStatus; 2255 } 2256 2257 interface CloseEvent { 2258 wasClean: boolean; 2259 code: number; 2260 reason: string; 2261 target: WebSocket; 2262 } 2263 2264 type CollectorFilter = (...args: any[]) => boolean; 2265 2266 interface CollectorOptions { 2267 time?: number; 2268 idle?: number; 2269 dispose?: boolean; 2270 } 2271 2272 type ColorResolvable = 2273 | 'DEFAULT' 2274 | 'WHITE' 2275 | 'AQUA' 2276 | 'GREEN' 2277 | 'BLUE' 2278 | 'YELLOW' 2279 | 'PURPLE' 2280 | 'LUMINOUS_VIVID_PINK' 2281 | 'GOLD' 2282 | 'ORANGE' 2283 | 'RED' 2284 | 'GREY' 2285 | 'DARKER_GREY' 2286 | 'NAVY' 2287 | 'DARK_AQUA' 2288 | 'DARK_GREEN' 2289 | 'DARK_BLUE' 2290 | 'DARK_PURPLE' 2291 | 'DARK_VIVID_PINK' 2292 | 'DARK_GOLD' 2293 | 'DARK_ORANGE' 2294 | 'DARK_RED' 2295 | 'DARK_GREY' 2296 | 'LIGHT_GREY' 2297 | 'DARK_NAVY' 2298 | 'RANDOM' 2299 | [number, number, number] 2300 | number 2301 | string; 2302 2303 interface CrosspostedChannel { 2304 channelID: Snowflake; 2305 guildID: Snowflake; 2306 type: keyof typeof ChannelType; 2307 name: string; 2308 } 2309 2310 interface DeconstructedSnowflake { 2311 timestamp: number; 2312 readonly date: Date; 2313 workerID: number; 2314 processID: number; 2315 increment: number; 2316 binary: string; 2317 } 2318 2319 type DefaultMessageNotifications = 'ALL' | 'MENTIONS'; 2320 2321 interface EmbedField { 2322 name: string; 2323 value: string; 2324 inline: boolean; 2325 } 2326 2327 interface EmbedFieldData { 2328 name: StringResolvable; 2329 value: StringResolvable; 2330 inline?: boolean; 2331 } 2332 2333 type EmojiIdentifierResolvable = string | EmojiResolvable; 2334 2335 type EmojiResolvable = Snowflake | GuildEmoji | ReactionEmoji; 2336 2337 interface ErrorEvent { 2338 error: any; 2339 message: string; 2340 type: string; 2341 target: WebSocket; 2342 } 2343 2344 interface EscapeMarkdownOptions { 2345 codeBlock?: boolean; 2346 inlineCode?: boolean; 2347 bold?: boolean; 2348 italic?: boolean; 2349 underline?: boolean; 2350 strikethrough?: boolean; 2351 spoiler?: boolean; 2352 inlineCodeContent?: boolean; 2353 codeBlockContent?: boolean; 2354 } 2355 2356 type ExplicitContentFilterLevel = 'DISABLED' | 'MEMBERS_WITHOUT_ROLES' | 'ALL_MEMBERS'; 2357 2358 interface Extendable { 2359 GuildEmoji: typeof GuildEmoji; 2360 DMChannel: typeof DMChannel; 2361 TextChannel: typeof TextChannel; 2362 VoiceChannel: typeof VoiceChannel; 2363 CategoryChannel: typeof CategoryChannel; 2364 NewsChannel: typeof NewsChannel; 2365 StoreChannel: typeof StoreChannel; 2366 GuildMember: typeof GuildMember; 2367 Guild: typeof Guild; 2368 Message: typeof Message; 2369 MessageReaction: typeof MessageReaction; 2370 Presence: typeof Presence; 2371 VoiceState: typeof VoiceState; 2372 Role: typeof Role; 2373 User: typeof User; 2374 } 2375 2376 interface FetchMemberOptions { 2377 user: UserResolvable; 2378 cache?: boolean; 2379 } 2380 2381 interface FetchMembersOptions { 2382 user?: UserResolvable | UserResolvable[]; 2383 query?: string; 2384 limit?: number; 2385 withPresences?: boolean; 2386 time?: number; 2387 } 2388 2389 interface FileOptions { 2390 attachment: BufferResolvable | Stream; 2391 name?: string; 2392 } 2393 2394 type GuildAuditLogsAction = keyof GuildAuditLogsActions; 2395 2396 interface GuildAuditLogsActions { 2397 ALL?: null; 2398 GUILD_UPDATE?: number; 2399 CHANNEL_CREATE?: number; 2400 CHANNEL_UPDATE?: number; 2401 CHANNEL_DELETE?: number; 2402 CHANNEL_OVERWRITE_CREATE?: number; 2403 CHANNEL_OVERWRITE_UPDATE?: number; 2404 CHANNEL_OVERWRITE_DELETE?: number; 2405 MEMBER_KICK?: number; 2406 MEMBER_PRUNE?: number; 2407 MEMBER_BAN_ADD?: number; 2408 MEMBER_BAN_REMOVE?: number; 2409 MEMBER_UPDATE?: number; 2410 MEMBER_ROLE_UPDATE?: number; 2411 MEMBER_MOVE?: number; 2412 MEMBER_DISCONNECT?: number; 2413 BOT_ADD?: number; 2414 ROLE_CREATE?: number; 2415 ROLE_UPDATE?: number; 2416 ROLE_DELETE?: number; 2417 INVITE_CREATE?: number; 2418 INVITE_UPDATE?: number; 2419 INVITE_DELETE?: number; 2420 WEBHOOK_CREATE?: number; 2421 WEBHOOK_UPDATE?: number; 2422 WEBHOOK_DELETE?: number; 2423 EMOJI_CREATE?: number; 2424 EMOJI_UPDATE?: number; 2425 EMOJI_DELETE?: number; 2426 MESSAGE_DELETE?: number; 2427 MESSAGE_BULK_DELETE?: number; 2428 MESSAGE_PIN?: number; 2429 MESSAGE_UNPIN?: number; 2430 INTEGRATION_CREATE?: number; 2431 INTEGRATION_UPDATE?: number; 2432 INTEGRATION_DELETE?: number; 2433 } 2434 2435 type GuildAuditLogsActionType = 'CREATE' | 'DELETE' | 'UPDATE' | 'ALL'; 2436 2437 interface GuildAuditLogsFetchOptions { 2438 before?: Snowflake | GuildAuditLogsEntry; 2439 limit?: number; 2440 user?: UserResolvable; 2441 type?: GuildAuditLogsAction | number; 2442 } 2443 2444 type GuildAuditLogsTarget = keyof GuildAuditLogsTargets; 2445 2446 interface GuildAuditLogsTargets { 2447 ALL?: string; 2448 GUILD?: string; 2449 CHANNEL?: string; 2450 USER?: string; 2451 ROLE?: string; 2452 INVITE?: string; 2453 WEBHOOK?: string; 2454 EMOJI?: string; 2455 MESSAGE?: string; 2456 INTEGRATION?: string; 2457 UNKNOWN?: string; 2458 } 2459 2460 type GuildChannelResolvable = Snowflake | GuildChannel; 2461 2462 interface GuildCreateChannelOptions { 2463 permissionOverwrites?: OverwriteResolvable[] | Collection<Snowflake, OverwriteResolvable>; 2464 topic?: string; 2465 type?: Exclude< 2466 keyof typeof ChannelType | ChannelType, 2467 'dm' | 'group' | 'unknown' | ChannelType.dm | ChannelType.group | ChannelType.unknown 2468 >; 2469 nsfw?: boolean; 2470 parent?: ChannelResolvable; 2471 bitrate?: number; 2472 userLimit?: number; 2473 rateLimitPerUser?: number; 2474 position?: number; 2475 reason?: string; 2476 } 2477 2478 interface GuildChannelCloneOptions extends GuildCreateChannelOptions { 2479 name?: string; 2480 } 2481 2482 interface GuildEditData { 2483 name?: string; 2484 region?: string; 2485 verificationLevel?: VerificationLevel; 2486 explicitContentFilter?: ExplicitContentFilterLevel; 2487 defaultMessageNotifications?: DefaultMessageNotifications | number; 2488 afkChannel?: ChannelResolvable; 2489 systemChannel?: ChannelResolvable; 2490 systemChannelFlags?: SystemChannelFlagsResolvable; 2491 afkTimeout?: number; 2492 icon?: Base64Resolvable; 2493 owner?: GuildMemberResolvable; 2494 splash?: Base64Resolvable; 2495 banner?: Base64Resolvable; 2496 } 2497 2498 interface GuildEmbedData { 2499 enabled: boolean; 2500 channel: GuildChannelResolvable | null; 2501 } 2502 2503 interface GuildEmojiCreateOptions { 2504 roles?: Collection<Snowflake, Role> | RoleResolvable[]; 2505 reason?: string; 2506 } 2507 2508 interface GuildEmojiEditData { 2509 name?: string; 2510 roles?: Collection<Snowflake, Role> | RoleResolvable[]; 2511 } 2512 2513 type GuildFeatures = 2514 | 'ANIMATED_ICON' 2515 | 'BANNER' 2516 | 'COMMERCE' 2517 | 'DISCOVERABLE' 2518 | 'FEATURABLE' 2519 | 'INVITE_SPLASH' 2520 | 'NEWS' 2521 | 'PARTNERED' 2522 | 'PUBLIC' 2523 | 'PUBLIC_DISABLED' 2524 | 'VANITY_URL' 2525 | 'VERIFIED' 2526 | 'VIP_REGIONS' 2527 | 'WELCOME_SCREEN_ENABLED'; 2528 2529 interface GuildMemberEditData { 2530 nick?: string; 2531 roles?: Collection<Snowflake, Role> | RoleResolvable[]; 2532 mute?: boolean; 2533 deaf?: boolean; 2534 channel?: ChannelResolvable | null; 2535 } 2536 2537 type GuildMemberResolvable = GuildMember | UserResolvable; 2538 2539 type GuildResolvable = Guild | GuildChannel | GuildMember | GuildEmoji | Invite | Role | Snowflake; 2540 2541 interface GuildPruneMembersOptions { 2542 count?: boolean; 2543 days?: number; 2544 dry?: boolean; 2545 reason?: string; 2546 } 2547 2548 interface HTTPOptions { 2549 api?: string; 2550 version?: number; 2551 host?: string; 2552 cdn?: string; 2553 invite?: string; 2554 } 2555 2556 type ImageSize = 16 | 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096; 2557 2558 interface ImageURLOptions { 2559 format?: AllowedImageFormat; 2560 size?: ImageSize; 2561 } 2562 2563 interface IntegrationData { 2564 id: string; 2565 type: string; 2566 } 2567 2568 interface IntegrationEditData { 2569 expireBehavior?: number; 2570 expireGracePeriod?: number; 2571 } 2572 2573 interface IntegrationAccount { 2574 id: string; 2575 name: string; 2576 } 2577 2578 type IntentsString = 2579 | 'GUILDS' 2580 | 'GUILD_MEMBERS' 2581 | 'GUILD_BANS' 2582 | 'GUILD_EMOJIS' 2583 | 'GUILD_INTEGRATIONS' 2584 | 'GUILD_WEBHOOKS' 2585 | 'GUILD_INVITES' 2586 | 'GUILD_VOICE_STATES' 2587 | 'GUILD_PRESENCES' 2588 | 'GUILD_MESSAGES' 2589 | 'GUILD_MESSAGE_REACTIONS' 2590 | 'GUILD_MESSAGE_TYPING' 2591 | 'DIRECT_MESSAGES' 2592 | 'DIRECT_MESSAGE_REACTIONS' 2593 | 'DIRECT_MESSAGE_TYPING'; 2594 2595 interface InviteOptions { 2596 temporary?: boolean; 2597 maxAge?: number; 2598 maxUses?: number; 2599 unique?: boolean; 2600 reason?: string; 2601 } 2602 2603 type InviteResolvable = string; 2604 2605 type MembershipStates = 'INVITED' | 'ACCEPTED'; 2606 2607 type MessageAdditions = MessageEmbed | MessageAttachment | (MessageEmbed | MessageAttachment)[]; 2608 2609 interface MessageActivity { 2610 partyID: string; 2611 type: number; 2612 } 2613 2614 interface MessageCollectorOptions extends CollectorOptions { 2615 max?: number; 2616 maxProcessed?: number; 2617 } 2618 2619 interface MessageEditOptions { 2620 content?: string; 2621 embed?: MessageEmbedOptions | null; 2622 code?: string | boolean; 2623 flags?: BitFieldResolvable<MessageFlagsString>; 2624 allowedMentions?: MessageMentionOptions; 2625 } 2626 2627 interface MessageEmbedAuthor { 2628 name?: string; 2629 url?: string; 2630 iconURL?: string; 2631 proxyIconURL?: string; 2632 } 2633 2634 interface MessageEmbedFooter { 2635 text?: string; 2636 iconURL?: string; 2637 proxyIconURL?: string; 2638 } 2639 2640 interface MessageEmbedImage { 2641 url: string; 2642 proxyURL?: string; 2643 height?: number; 2644 width?: number; 2645 } 2646 2647 interface MessageEmbedOptions { 2648 title?: string; 2649 description?: string; 2650 url?: string; 2651 timestamp?: Date | number; 2652 color?: ColorResolvable; 2653 fields?: EmbedFieldData[]; 2654 files?: (MessageAttachment | string | FileOptions)[]; 2655 author?: Partial<MessageEmbedAuthor> & { icon_url?: string; proxy_icon_url?: string }; 2656 thumbnail?: Partial<MessageEmbedThumbnail> & { proxy_url?: string }; 2657 image?: Partial<MessageEmbedImage> & { proxy_url?: string }; 2658 video?: Partial<MessageEmbedVideo> & { proxy_url?: string }; 2659 footer?: Partial<MessageEmbedFooter> & { icon_url?: string; proxy_icon_url?: string }; 2660 } 2661 2662 interface MessageEmbedProvider { 2663 name: string; 2664 url: string; 2665 } 2666 2667 interface MessageEmbedThumbnail { 2668 url: string; 2669 proxyURL?: string; 2670 height?: number; 2671 width?: number; 2672 } 2673 2674 interface MessageEmbedVideo { 2675 url?: string; 2676 proxyURL?: string; 2677 height?: number; 2678 width?: number; 2679 } 2680 2681 interface MessageEvent { 2682 data: WebSocket.Data; 2683 type: string; 2684 target: WebSocket; 2685 } 2686 2687 type MessageFlagsString = 'CROSSPOSTED' | 'IS_CROSSPOST' | 'SUPPRESS_EMBEDS' | 'SOURCE_MESSAGE_DELETED' | 'URGENT'; 2688 2689 interface MessageMentionOptions { 2690 parse?: MessageMentionTypes[]; 2691 roles?: Snowflake[]; 2692 users?: Snowflake[]; 2693 } 2694 2695 type MessageMentionTypes = 'roles' | 'users' | 'everyone'; 2696 2697 interface MessageOptions { 2698 tts?: boolean; 2699 nonce?: string; 2700 content?: string; 2701 embed?: MessageEmbed | MessageEmbedOptions; 2702 disableMentions?: 'none' | 'all' | 'everyone'; 2703 allowedMentions?: MessageMentionOptions; 2704 files?: (FileOptions | BufferResolvable | Stream | MessageAttachment)[]; 2705 code?: string | boolean; 2706 split?: boolean | SplitOptions; 2707 reply?: UserResolvable; 2708 } 2709 2710 type MessageReactionResolvable = MessageReaction | Snowflake; 2711 2712 interface MessageReference { 2713 channelID: string; 2714 guildID: string; 2715 messageID: string | null; 2716 } 2717 2718 type MessageResolvable = Message | Snowflake; 2719 2720 type MessageTarget = TextChannel | DMChannel | User | GuildMember | Webhook | WebhookClient; 2721 2722 type MessageType = 2723 | 'DEFAULT' 2724 | 'RECIPIENT_ADD' 2725 | 'RECIPIENT_REMOVE' 2726 | 'CALL' 2727 | 'CHANNEL_NAME_CHANGE' 2728 | 'CHANNEL_ICON_CHANGE' 2729 | 'PINS_ADD' 2730 | 'GUILD_MEMBER_JOIN' 2731 | 'USER_PREMIUM_GUILD_SUBSCRIPTION' 2732 | 'USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1' 2733 | 'USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2' 2734 | 'USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3' 2735 | 'CHANNEL_FOLLOW_ADD' 2736 | 'GUILD_DISCOVERY_DISQUALIFIED' 2737 | 'GUILD_DISCOVERY_REQUALIFIED'; 2738 2739 interface OverwriteData { 2740 allow?: PermissionResolvable; 2741 deny?: PermissionResolvable; 2742 id: GuildMemberResolvable | RoleResolvable; 2743 type?: OverwriteType; 2744 } 2745 2746 type OverwriteResolvable = PermissionOverwrites | OverwriteData; 2747 2748 type OverwriteType = 'member' | 'role'; 2749 2750 interface PermissionFlags extends Record<PermissionString, number> {} 2751 2752 interface PermissionObject extends Record<PermissionString, boolean> {} 2753 2754 interface PermissionOverwriteOption extends Partial<Record<PermissionString, boolean | null>> {} 2755 2756 type PermissionResolvable = BitFieldResolvable<PermissionString>; 2757 2758 type PermissionString = 2759 | 'CREATE_INSTANT_INVITE' 2760 | 'KICK_MEMBERS' 2761 | 'BAN_MEMBERS' 2762 | 'ADMINISTRATOR' 2763 | 'MANAGE_CHANNELS' 2764 | 'MANAGE_GUILD' 2765 | 'ADD_REACTIONS' 2766 | 'VIEW_AUDIT_LOG' 2767 | 'PRIORITY_SPEAKER' 2768 | 'STREAM' 2769 | 'VIEW_CHANNEL' 2770 | 'SEND_MESSAGES' 2771 | 'SEND_TTS_MESSAGES' 2772 | 'MANAGE_MESSAGES' 2773 | 'EMBED_LINKS' 2774 | 'ATTACH_FILES' 2775 | 'READ_MESSAGE_HISTORY' 2776 | 'MENTION_EVERYONE' 2777 | 'USE_EXTERNAL_EMOJIS' 2778 | 'VIEW_GUILD_INSIGHTS' 2779 | 'CONNECT' 2780 | 'SPEAK' 2781 | 'MUTE_MEMBERS' 2782 | 'DEAFEN_MEMBERS' 2783 | 'MOVE_MEMBERS' 2784 | 'USE_VAD' 2785 | 'CHANGE_NICKNAME' 2786 | 'MANAGE_NICKNAMES' 2787 | 'MANAGE_ROLES' 2788 | 'MANAGE_WEBHOOKS' 2789 | 'MANAGE_EMOJIS'; 2790 2791 interface RecursiveArray<T> extends Array<T | RecursiveArray<T>> {} 2792 2793 interface PermissionOverwriteOptions { 2794 allow: PermissionResolvable; 2795 deny: PermissionResolvable; 2796 id: UserResolvable | RoleResolvable; 2797 } 2798 2799 type PremiumTier = number; 2800 2801 interface PresenceData { 2802 status?: PresenceStatusData; 2803 afk?: boolean; 2804 activity?: { 2805 name?: string; 2806 type?: ActivityType | number; 2807 url?: string; 2808 }; 2809 shardID?: number | number[]; 2810 } 2811 2812 type PresenceResolvable = Presence | UserResolvable | Snowflake; 2813 2814 type Partialize<T, O extends string> = { 2815 readonly client: Client; 2816 readonly createdAt: Date; 2817 readonly createdTimestamp: number; 2818 deleted: boolean; 2819 id: string; 2820 partial: true; 2821 fetch(): Promise<T>; 2822 } & { 2823 [K in keyof Omit< 2824 T, 2825 'client' | 'createdAt' | 'createdTimestamp' | 'id' | 'partial' | 'fetch' | O 2826 >]: T[K] extends Function ? T[K] : T[K] | null; // tslint:disable-line:ban-types 2827 }; 2828 2829 interface PartialDMChannel 2830 extends Partialize< 2831 DMChannel, 2832 'lastMessage' | 'lastMessageID' | 'messages' | 'recipient' | 'type' | 'typing' | 'typingCount' 2833 > { 2834 lastMessage: null; 2835 lastMessageID: undefined; 2836 messages: MessageManager; 2837 recipient: User | PartialUser; 2838 type: 'dm'; 2839 readonly typing: boolean; 2840 readonly typingCount: number; 2841 } 2842 2843 interface PartialChannelData { 2844 id?: number; 2845 name: string; 2846 topic?: string; 2847 type?: ChannelType; 2848 parentID?: number; 2849 permissionOverwrites?: { 2850 id: number | Snowflake; 2851 type?: OverwriteType; 2852 allow?: PermissionResolvable; 2853 deny?: PermissionResolvable; 2854 }[]; 2855 } 2856 2857 interface PartialGuildMember 2858 extends Partialize< 2859 GuildMember, 2860 'bannable' | 'displayColor' | 'displayHexColor' | 'displayName' | 'guild' | 'kickable' | 'permissions' | 'roles' 2861 > { 2862 readonly bannable: boolean; 2863 readonly displayColor: number; 2864 readonly displayHexColor: string; 2865 readonly displayName: string; 2866 guild: Guild; 2867 joinedAt: null; 2868 joinedTimestamp: null; 2869 readonly kickable: boolean; 2870 readonly permissions: GuildMember['permissions']; 2871 readonly roles: GuildMember['roles']; 2872 } 2873 2874 interface PartialMessage 2875 extends Partialize< 2876 Message, 2877 'attachments' | 'channel' | 'deletable' | 'editable' | 'mentions' | 'pinnable' | 'system' | 'url' 2878 > { 2879 attachments: Message['attachments']; 2880 channel: Message['channel']; 2881 readonly deletable: boolean; 2882 readonly editable: boolean; 2883 mentions: Message['mentions']; 2884 readonly pinnable: boolean; 2885 reactions: Message['reactions']; 2886 system: boolean; 2887 readonly url: string; 2888 } 2889 2890 interface PartialRoleData extends RoleData { 2891 id?: number; 2892 } 2893 2894 type PartialTypes = 'USER' | 'CHANNEL' | 'GUILD_MEMBER' | 'MESSAGE' | 'REACTION'; 2895 2896 interface PartialUser extends Partialize<User, 'discriminator' | 'username' | 'tag'> { 2897 discriminator: undefined; 2898 username: undefined; 2899 readonly tag: null; 2900 } 2901 2902 type PresenceStatus = ClientPresenceStatus | 'offline'; 2903 2904 type PresenceStatusData = ClientPresenceStatus | 'invisible'; 2905 2906 interface RateLimitData { 2907 timeout: number; 2908 limit: number; 2909 timeDifference: number; 2910 method: string; 2911 path: string; 2912 route: string; 2913 } 2914 2915 interface RawOverwriteData { 2916 id: Snowflake; 2917 allow: number; 2918 deny: number; 2919 type: OverwriteType; 2920 } 2921 2922 interface ReactionCollectorOptions extends CollectorOptions { 2923 max?: number; 2924 maxEmojis?: number; 2925 maxUsers?: number; 2926 } 2927 2928 interface ResolvedOverwriteOptions { 2929 allow: Permissions; 2930 deny: Permissions; 2931 } 2932 2933 interface RoleData { 2934 name?: string; 2935 color?: ColorResolvable; 2936 hoist?: boolean; 2937 position?: number; 2938 permissions?: PermissionResolvable; 2939 mentionable?: boolean; 2940 } 2941 2942 interface RolePosition { 2943 role: RoleResolvable; 2944 position: number; 2945 } 2946 2947 type RoleResolvable = Role | string; 2948 2949 type ShardingManagerMode = 'process' | 'worker'; 2950 2951 type Snowflake = string; 2952 2953 interface SplitOptions { 2954 maxLength?: number; 2955 char?: string; 2956 prepend?: string; 2957 append?: string; 2958 } 2959 2960 type Status = number; 2961 2962 interface StreamOptions { 2963 type?: StreamType; 2964 seek?: number; 2965 volume?: number | boolean; 2966 plp?: number; 2967 fec?: boolean; 2968 bitrate?: number | 'auto'; 2969 highWaterMark?: number; 2970 } 2971 2972 type SpeakingString = 'SPEAKING' | 'SOUNDSHARE' | 'PRIORITY_SPEAKING'; 2973 2974 type StreamType = 'unknown' | 'converted' | 'opus' | 'ogg/opus' | 'webm/opus'; 2975 2976 type StringResolvable = string | string[] | any; 2977 2978 type SystemChannelFlagsString = 'WELCOME_MESSAGE_DISABLED' | 'BOOST_MESSAGE_DISABLED'; 2979 2980 type SystemChannelFlagsResolvable = BitFieldResolvable<SystemChannelFlagsString>; 2981 2982 type TargetUser = number; 2983 2984 interface TypingData { 2985 user: User | PartialUser; 2986 since: Date; 2987 lastTimestamp: Date; 2988 elapsedTime: number; 2989 timeout: NodeJS.Timeout; 2990 } 2991 2992 type UserFlagsString = 2993 | 'DISCORD_EMPLOYEE' 2994 | 'DISCORD_PARTNER' 2995 | 'HYPESQUAD_EVENTS' 2996 | 'BUGHUNTER_LEVEL_1' 2997 | 'HOUSE_BRAVERY' 2998 | 'HOUSE_BRILLIANCE' 2999 | 'HOUSE_BALANCE' 3000 | 'EARLY_SUPPORTER' 3001 | 'TEAM_USER' 3002 | 'SYSTEM' 3003 | 'BUGHUNTER_LEVEL_2' 3004 | 'VERIFIED_BOT' 3005 | 'VERIFIED_DEVELOPER'; 3006 3007 type UserResolvable = User | Snowflake | Message | GuildMember; 3008 3009 type VerificationLevel = 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH' | 'VERY_HIGH'; 3010 3011 type VoiceStatus = number; 3012 3013 interface WebhookEditData { 3014 name?: string; 3015 avatar?: BufferResolvable; 3016 channel?: ChannelResolvable; 3017 reason?: string; 3018 } 3019 3020 interface WebhookMessageOptions { 3021 username?: string; 3022 avatarURL?: string; 3023 tts?: boolean; 3024 nonce?: string; 3025 embeds?: (MessageEmbed | object)[]; 3026 disableMentions?: 'none' | 'all' | 'everyone'; 3027 allowedMentions?: MessageMentionOptions; 3028 files?: (FileOptions | BufferResolvable | Stream | MessageAttachment)[]; 3029 code?: string | boolean; 3030 split?: boolean | SplitOptions; 3031 } 3032 3033 type WebhookTypes = 'Incoming' | 'Channel Follower'; 3034 3035 interface WebSocketOptions { 3036 large_threshold?: number; 3037 compress?: boolean; 3038 intents?: BitFieldResolvable<IntentsString> | number; 3039 } 3040 3041 type WSEventType = 3042 | 'READY' 3043 | 'RESUMED' 3044 | 'GUILD_CREATE' 3045 | 'GUILD_DELETE' 3046 | 'GUILD_UPDATE' 3047 | 'INVITE_CREATE' 3048 | 'INVITE_DELETE' 3049 | 'GUILD_MEMBER_ADD' 3050 | 'GUILD_MEMBER_REMOVE' 3051 | 'GUILD_MEMBER_UPDATE' 3052 | 'GUILD_MEMBERS_CHUNK' 3053 | 'GUILD_ROLE_CREATE' 3054 | 'GUILD_ROLE_DELETE' 3055 | 'GUILD_ROLE_UPDATE' 3056 | 'GUILD_BAN_ADD' 3057 | 'GUILD_BAN_REMOVE' 3058 | 'GUILD_EMOJIS_UPDATE' 3059 | 'GUILD_INTEGRATIONS_UPDATE' 3060 | 'CHANNEL_CREATE' 3061 | 'CHANNEL_DELETE' 3062 | 'CHANNEL_UPDATE' 3063 | 'CHANNEL_PINS_UPDATE' 3064 | 'MESSAGE_CREATE' 3065 | 'MESSAGE_DELETE' 3066 | 'MESSAGE_UPDATE' 3067 | 'MESSAGE_DELETE_BULK' 3068 | 'MESSAGE_REACTION_ADD' 3069 | 'MESSAGE_REACTION_REMOVE' 3070 | 'MESSAGE_REACTION_REMOVE_ALL' 3071 | 'MESSAGE_REACTION_REMOVE_EMOJI' 3072 | 'USER_UPDATE' 3073 | 'PRESENCE_UPDATE' 3074 | 'TYPING_START' 3075 | 'VOICE_STATE_UPDATE' 3076 | 'VOICE_SERVER_UPDATE' 3077 | 'WEBHOOKS_UPDATE'; 3078 3079 //#endregion 3080 }