mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
refactor: add some more consistency (#3842)
* cleanup(StreamDispatcher): remove old 'end' event * fix(StreamDispatcher): only listen to finish event once * refactor(VoiceWebSocket): use `connection.client` in favour of `connection.voiceManager.client` * fix(VoiceWebSocket): use `client.clearInterval` in favour of `clearInterval` * refactor: destructure EventEmitter * refactor: destructure EventEmitter from events * refactor: use EventEmitter.off in favour of EventEmitter.removeListener * style: order typings alphabetically * oops * fix indent * style: alphabetically organize imports * style: remove extra line * Revert "style: remove extra line" This reverts commit96e182ed69. * Revert "style: alphabetically organize imports" This reverts commit02aee9b06d. * Revert "refactor: destructure EventEmitter from events" This reverts commit9953b4d267. * Revert "refactor: destructure EventEmitter" This reverts commit930d7751ab. * Revert "fix(StreamDispatcher): only listen to finish event once" This reverts commit485a6430a8. * refactor: use .removeListener instead of .off
This commit is contained in:
@@ -35,7 +35,7 @@ class VoiceWebSocket extends EventEmitter {
|
||||
* @readonly
|
||||
*/
|
||||
get client() {
|
||||
return this.connection.voiceManager.client;
|
||||
return this.connection.client;
|
||||
}
|
||||
|
||||
shutdown() {
|
||||
@@ -232,7 +232,7 @@ class VoiceWebSocket extends EventEmitter {
|
||||
* @event VoiceWebSocket#warn
|
||||
*/
|
||||
this.emit('warn', 'A voice heartbeat interval is being overwritten');
|
||||
clearInterval(this.heartbeatInterval);
|
||||
this.client.clearInterval(this.heartbeatInterval);
|
||||
}
|
||||
this.heartbeatInterval = this.client.setInterval(this.sendHeartbeat.bind(this), interval);
|
||||
}
|
||||
@@ -245,7 +245,7 @@ class VoiceWebSocket extends EventEmitter {
|
||||
this.emit('warn', 'Tried to clear a heartbeat interval that does not exist');
|
||||
return;
|
||||
}
|
||||
clearInterval(this.heartbeatInterval);
|
||||
this.client.clearInterval(this.heartbeatInterval);
|
||||
this.heartbeatInterval = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -175,11 +175,11 @@ class WebSocketShard extends EventEmitter {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const cleanup = () => {
|
||||
this.off(ShardEvents.CLOSE, onClose);
|
||||
this.off(ShardEvents.READY, onReady);
|
||||
this.off(ShardEvents.RESUMED, onResumed);
|
||||
this.off(ShardEvents.INVALID_SESSION, onInvalidOrDestroyed);
|
||||
this.off(ShardEvents.DESTROYED, onInvalidOrDestroyed);
|
||||
this.removeListener(ShardEvents.CLOSE, onClose);
|
||||
this.removeListener(ShardEvents.READY, onReady);
|
||||
this.removeListener(ShardEvents.RESUMED, onResumed);
|
||||
this.removeListener(ShardEvents.INVALID_SESSION, onInvalidOrDestroyed);
|
||||
this.removeListener(ShardEvents.DESTROYED, onInvalidOrDestroyed);
|
||||
};
|
||||
|
||||
const onReady = () => {
|
||||
|
||||
@@ -230,8 +230,8 @@ class Collector extends EventEmitter {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await new Promise(resolve => {
|
||||
const tick = () => {
|
||||
this.off('collect', tick);
|
||||
this.off('end', tick);
|
||||
this.removeListener('collect', tick);
|
||||
this.removeListener('end', tick);
|
||||
return resolve();
|
||||
};
|
||||
this.on('collect', tick);
|
||||
@@ -240,7 +240,7 @@ class Collector extends EventEmitter {
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
this.off('collect', onCollect);
|
||||
this.removeListener('collect', onCollect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
464
typings/index.d.ts
vendored
464
typings/index.d.ts
vendored
@@ -244,17 +244,6 @@ declare module 'discord.js' {
|
||||
public once(event: string, listener: (...args: any[]) => void): this;
|
||||
}
|
||||
|
||||
export class ClientVoiceManager {
|
||||
constructor(client: Client);
|
||||
public readonly client: Client;
|
||||
public connections: Collection<Snowflake, VoiceConnection>;
|
||||
public broadcasts: VoiceBroadcast[];
|
||||
|
||||
private joinChannel(channel: VoiceChannel): Promise<VoiceConnection>;
|
||||
|
||||
public createBroadcast(): VoiceBroadcast;
|
||||
}
|
||||
|
||||
export class ClientApplication extends Base {
|
||||
constructor(client: Client, data: object);
|
||||
public botPublic: boolean | null;
|
||||
@@ -275,34 +264,6 @@ declare module 'discord.js' {
|
||||
public toString(): string;
|
||||
}
|
||||
|
||||
export class Team extends Base {
|
||||
constructor(client: Client, data: object);
|
||||
public id: Snowflake;
|
||||
public name: string;
|
||||
public icon: string | null;
|
||||
public ownerID: Snowflake | null;
|
||||
public members: Collection<Snowflake, TeamMember>;
|
||||
|
||||
public readonly owner: TeamMember;
|
||||
public readonly createdAt: Date;
|
||||
public readonly createdTimestamp: number;
|
||||
|
||||
public iconURL(options?: ImageURLOptions): string;
|
||||
public toJSON(): object;
|
||||
public toString(): string;
|
||||
}
|
||||
|
||||
export class TeamMember extends Base {
|
||||
constructor(team: Team, data: object);
|
||||
public team: Team;
|
||||
public readonly id: Snowflake;
|
||||
public permissions: string[];
|
||||
public membershipState: MembershipStates;
|
||||
public user: User;
|
||||
|
||||
public toString(): string;
|
||||
}
|
||||
|
||||
export class ClientUser extends User {
|
||||
public mfaEnabled: boolean;
|
||||
public verified: boolean;
|
||||
@@ -315,6 +276,17 @@ declare module 'discord.js' {
|
||||
public setUsername(username: string): Promise<ClientUser>;
|
||||
}
|
||||
|
||||
export class ClientVoiceManager {
|
||||
constructor(client: Client);
|
||||
public readonly client: Client;
|
||||
public connections: Collection<Snowflake, VoiceConnection>;
|
||||
public broadcasts: VoiceBroadcast[];
|
||||
|
||||
private joinChannel(channel: VoiceChannel): Promise<VoiceConnection>;
|
||||
|
||||
public createBroadcast(): VoiceBroadcast;
|
||||
}
|
||||
|
||||
export abstract class Collector<K, V> extends EventEmitter {
|
||||
constructor(client: Client, filter: CollectorFilter, options?: CollectorOptions);
|
||||
private _timeout: NodeJS.Timer | null;
|
||||
@@ -822,18 +794,6 @@ declare module 'discord.js' {
|
||||
public updateOverwrite(userOrRole: RoleResolvable | UserResolvable, options: PermissionOverwriteOption, reason?: string): Promise<this>;
|
||||
}
|
||||
|
||||
export class StoreChannel extends GuildChannel {
|
||||
constructor(guild: Guild, data?: object);
|
||||
public nsfw: boolean;
|
||||
}
|
||||
|
||||
export class PartialGroupDMChannel extends Channel {
|
||||
constructor(client: Client, data: object);
|
||||
public name: string;
|
||||
public icon: string | null;
|
||||
public iconURL(options?: ImageURLOptions): string | null;
|
||||
}
|
||||
|
||||
export class GuildEmoji extends Emoji {
|
||||
constructor(client: Client, data: object, guild: Guild);
|
||||
private _roles: string[];
|
||||
@@ -889,6 +849,14 @@ declare module 'discord.js' {
|
||||
public valueOf(): string;
|
||||
}
|
||||
|
||||
export class HTTPError extends Error {
|
||||
constructor(message: string, name: string, code: number, method: string, path: string);
|
||||
public code: number;
|
||||
public method: string;
|
||||
public name: string;
|
||||
public path: string;
|
||||
}
|
||||
|
||||
export class Integration extends Base {
|
||||
constructor(client: Client, data: object, guild: Guild);
|
||||
public account: IntegrationAccount;
|
||||
@@ -908,14 +876,6 @@ declare module 'discord.js' {
|
||||
public sync(): Promise<Integration>;
|
||||
}
|
||||
|
||||
export class HTTPError extends Error {
|
||||
constructor(message: string, name: string, code: number, method: string, path: string);
|
||||
public code: number;
|
||||
public method: string;
|
||||
public name: string;
|
||||
public path: string;
|
||||
}
|
||||
|
||||
export class Invite extends Base {
|
||||
constructor(client: Client, data: object);
|
||||
public channel: GuildChannel | PartialGroupDMChannel;
|
||||
@@ -941,11 +901,6 @@ declare module 'discord.js' {
|
||||
public toString(): string;
|
||||
}
|
||||
|
||||
export class MessageFlags extends BitField<MessageFlagsString> {
|
||||
public static FLAGS: Record<MessageFlagsString, number>;
|
||||
public static resolve(bit?: BitFieldResolvable<MessageFlagsString>): number;
|
||||
}
|
||||
|
||||
export class Message extends Base {
|
||||
constructor(client: Client, data: object, channel: TextChannel | DMChannel);
|
||||
private _edits: Message[];
|
||||
@@ -1072,6 +1027,11 @@ declare module 'discord.js' {
|
||||
public static normalizeFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): Required<EmbedFieldData>[];
|
||||
}
|
||||
|
||||
export class MessageFlags extends BitField<MessageFlagsString> {
|
||||
public static FLAGS: Record<MessageFlagsString, number>;
|
||||
public static resolve(bit?: BitFieldResolvable<MessageFlagsString>): number;
|
||||
}
|
||||
|
||||
export class MessageMentions {
|
||||
constructor(message: Message, users: object[] | Collection<Snowflake, User>, roles: Snowflake[] | Collection<Snowflake, Role>, everyone: boolean);
|
||||
private _channels: Collection<Snowflake, GuildChannel> | null;
|
||||
@@ -1114,6 +1074,23 @@ declare module 'discord.js' {
|
||||
public toJSON(): object;
|
||||
}
|
||||
|
||||
export class NewsChannel extends TextBasedChannel(GuildChannel) {
|
||||
constructor(guild: Guild, data?: object);
|
||||
public messages: MessageManager;
|
||||
public nsfw: boolean;
|
||||
public topic: string | null;
|
||||
public createWebhook(name: string, options?: { avatar?: BufferResolvable | Base64Resolvable; reason?: string; }): Promise<Webhook>;
|
||||
public setNSFW(nsfw: boolean, reason?: string): Promise<NewsChannel>;
|
||||
public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
|
||||
}
|
||||
|
||||
export class PartialGroupDMChannel extends Channel {
|
||||
constructor(client: Client, data: object);
|
||||
public name: string;
|
||||
public icon: string | null;
|
||||
public iconURL(options?: ImageURLOptions): string | null;
|
||||
}
|
||||
|
||||
export class PermissionOverwrites {
|
||||
constructor(guildChannel: GuildChannel, data?: object);
|
||||
public allow: Readonly<Permissions>;
|
||||
@@ -1321,7 +1298,15 @@ declare module 'discord.js' {
|
||||
public static generate(timestamp?: number | Date): Snowflake;
|
||||
}
|
||||
|
||||
function VolumeMixin<T>(base: Constructable<T>): Constructable<T & VolumeInterface>;
|
||||
export class Speaking extends BitField<SpeakingString> {
|
||||
public static FLAGS: Record<SpeakingString, number>;
|
||||
public static resolve(bit?: BitFieldResolvable<SpeakingString>): number;
|
||||
}
|
||||
|
||||
export class StoreChannel extends GuildChannel {
|
||||
constructor(guild: Guild, data?: object);
|
||||
public nsfw: boolean;
|
||||
}
|
||||
|
||||
class StreamDispatcher extends VolumeMixin(Writable) {
|
||||
constructor(player: object, options?: StreamOptions, streams?: object);
|
||||
@@ -1357,11 +1342,6 @@ declare module 'discord.js' {
|
||||
public once(event: string, listener: (...args: any[]) => void): this;
|
||||
}
|
||||
|
||||
export class Speaking extends BitField<SpeakingString> {
|
||||
public static FLAGS: Record<SpeakingString, number>;
|
||||
public static resolve(bit?: BitFieldResolvable<SpeakingString>): number;
|
||||
}
|
||||
|
||||
export class Structures {
|
||||
public static get<K extends keyof Extendable>(structure: K): Extendable[K];
|
||||
public static get(structure: string): (...args: any[]) => void;
|
||||
@@ -1374,6 +1354,34 @@ declare module 'discord.js' {
|
||||
public static resolve(bit?: BitFieldResolvable<SystemChannelFlagsString>): number;
|
||||
}
|
||||
|
||||
export class Team extends Base {
|
||||
constructor(client: Client, data: object);
|
||||
public id: Snowflake;
|
||||
public name: string;
|
||||
public icon: string | null;
|
||||
public ownerID: Snowflake | null;
|
||||
public members: Collection<Snowflake, TeamMember>;
|
||||
|
||||
public readonly owner: TeamMember;
|
||||
public readonly createdAt: Date;
|
||||
public readonly createdTimestamp: number;
|
||||
|
||||
public iconURL(options?: ImageURLOptions): string;
|
||||
public toJSON(): object;
|
||||
public toString(): string;
|
||||
}
|
||||
|
||||
export class TeamMember extends Base {
|
||||
constructor(team: Team, data: object);
|
||||
public team: Team;
|
||||
public readonly id: Snowflake;
|
||||
public permissions: string[];
|
||||
public membershipState: MembershipStates;
|
||||
public user: User;
|
||||
|
||||
public toString(): string;
|
||||
}
|
||||
|
||||
export class TextChannel extends TextBasedChannel(GuildChannel) {
|
||||
constructor(guild: Guild, data?: object);
|
||||
public messages: MessageManager;
|
||||
@@ -1386,16 +1394,6 @@ declare module 'discord.js' {
|
||||
public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
|
||||
}
|
||||
|
||||
export class NewsChannel extends TextBasedChannel(GuildChannel) {
|
||||
constructor(guild: Guild, data?: object);
|
||||
public messages: MessageManager;
|
||||
public nsfw: boolean;
|
||||
public topic: string | null;
|
||||
public createWebhook(name: string, options?: { avatar?: BufferResolvable | Base64Resolvable; reason?: string; }): Promise<Webhook>;
|
||||
public setNSFW(nsfw: boolean, reason?: string): Promise<NewsChannel>;
|
||||
public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
|
||||
}
|
||||
|
||||
export class User extends PartialTextBasedChannel(Base) {
|
||||
constructor(client: Client, data: object);
|
||||
public avatar: string | null;
|
||||
@@ -1749,6 +1747,22 @@ declare module 'discord.js' {
|
||||
public resolveID(resolvable: R): K | null;
|
||||
}
|
||||
|
||||
export class GuildChannelManager extends BaseManager<Snowflake, GuildChannel, GuildChannelResolvable> {
|
||||
constructor(guild: Guild, iterable?: Iterable<any>);
|
||||
public guild: Guild;
|
||||
public create(name: string, options: GuildCreateChannelOptions & { type: 'voice'; }): Promise<VoiceChannel>;
|
||||
public create(name: string, options: GuildCreateChannelOptions & { type: 'category'; }): Promise<CategoryChannel>;
|
||||
public create(name: string, options?: GuildCreateChannelOptions & { type?: 'text'; }): Promise<TextChannel>;
|
||||
public create(name: string, options: GuildCreateChannelOptions): Promise<TextChannel | VoiceChannel | CategoryChannel>;
|
||||
}
|
||||
|
||||
export class GuildEmojiManager extends BaseManager<Snowflake, GuildEmoji, EmojiResolvable> {
|
||||
constructor(guild: Guild, iterable?: Iterable<any>);
|
||||
public guild: Guild;
|
||||
public create(attachment: BufferResolvable | Base64Resolvable, name: string, options?: GuildEmojiCreateOptions): Promise<GuildEmoji>;
|
||||
public resolveIdentifier(emoji: EmojiIdentifierResolvable): string | null;
|
||||
}
|
||||
|
||||
export class GuildEmojiRoleManager {
|
||||
constructor(emoji: GuildEmoji);
|
||||
public emoji: GuildEmoji;
|
||||
@@ -1759,26 +1773,20 @@ declare module 'discord.js' {
|
||||
public remove(roleOrRoles: RoleResolvable | RoleResolvable[] | Collection<Snowflake, Role>): Promise<GuildEmoji>;
|
||||
}
|
||||
|
||||
export class GuildEmojiManager extends BaseManager<Snowflake, GuildEmoji, EmojiResolvable> {
|
||||
constructor(guild: Guild, iterable?: Iterable<any>);
|
||||
public guild: Guild;
|
||||
public create(attachment: BufferResolvable | Base64Resolvable, name: string, options?: GuildEmojiCreateOptions): Promise<GuildEmoji>;
|
||||
public resolveIdentifier(emoji: EmojiIdentifierResolvable): string | null;
|
||||
export class GuildManager extends BaseManager<Snowflake, Guild, GuildResolvable> {
|
||||
constructor(client: Client, iterable?: Iterable<any>);
|
||||
public create(name: string, options?: { region?: string; icon: BufferResolvable | Base64Resolvable | null; }): Promise<Guild>;
|
||||
}
|
||||
|
||||
export class GuildChannelManager extends BaseManager<Snowflake, GuildChannel, GuildChannelResolvable> {
|
||||
export class GuildMemberManager extends BaseManager<Snowflake, GuildMember, GuildMemberResolvable> {
|
||||
constructor(guild: Guild, iterable?: Iterable<any>);
|
||||
public guild: Guild;
|
||||
public create(name: string, options: GuildCreateChannelOptions & { type: 'voice'; }): Promise<VoiceChannel>;
|
||||
public create(name: string, options: GuildCreateChannelOptions & { type: 'category'; }): Promise<CategoryChannel>;
|
||||
public create(name: string, options?: GuildCreateChannelOptions & { type?: 'text'; }): Promise<TextChannel>;
|
||||
public create(name: string, options: GuildCreateChannelOptions): Promise<TextChannel | VoiceChannel | CategoryChannel>;
|
||||
}
|
||||
|
||||
// Hacky workaround because changing the signature of an overridden method errors
|
||||
class OverridableManager<V, K, R = any> extends BaseManager<V, K, R> {
|
||||
public add(data: any, cache: any): any;
|
||||
public set(key: any): any;
|
||||
public ban(user: UserResolvable, options?: BanOptions): Promise<GuildMember | User | Snowflake>;
|
||||
public fetch(options: UserResolvable | FetchMemberOptions): Promise<GuildMember>;
|
||||
public fetch(options?: FetchMembersOptions): Promise<Collection<Snowflake, GuildMember>>;
|
||||
public prune(options: GuildPruneMembersOptions & { dry?: false; count: false; }): Promise<null>;
|
||||
public prune(options?: GuildPruneMembersOptions): Promise<number>;
|
||||
public unban(user: UserResolvable, reason?: string): Promise<User>;
|
||||
}
|
||||
|
||||
export class GuildMemberRoleManager extends OverridableManager<Snowflake, Role, RoleResolvable> {
|
||||
@@ -1794,22 +1802,6 @@ declare module 'discord.js' {
|
||||
public remove(roleOrRoles: RoleResolvable | RoleResolvable[] | Collection<Snowflake, Role>, reason?: string): Promise<GuildMember>;
|
||||
}
|
||||
|
||||
export class GuildMemberManager extends BaseManager<Snowflake, GuildMember, GuildMemberResolvable> {
|
||||
constructor(guild: Guild, iterable?: Iterable<any>);
|
||||
public guild: Guild;
|
||||
public ban(user: UserResolvable, options?: BanOptions): Promise<GuildMember | User | Snowflake>;
|
||||
public fetch(options: UserResolvable | FetchMemberOptions): Promise<GuildMember>;
|
||||
public fetch(options?: FetchMembersOptions): Promise<Collection<Snowflake, GuildMember>>;
|
||||
public prune(options: GuildPruneMembersOptions & { dry?: false; count: false; }): Promise<null>;
|
||||
public prune(options?: GuildPruneMembersOptions): Promise<number>;
|
||||
public unban(user: UserResolvable, reason?: string): Promise<User>;
|
||||
}
|
||||
|
||||
export class GuildManager extends BaseManager<Snowflake, Guild, GuildResolvable> {
|
||||
constructor(client: Client, iterable?: Iterable<any>);
|
||||
public create(name: string, options?: { region?: string; icon: BufferResolvable | Base64Resolvable | null; }): Promise<Guild>;
|
||||
}
|
||||
|
||||
export class MessageManager extends BaseManager<Snowflake, Message, MessageResolvable> {
|
||||
constructor(channel: TextChannel | DMChannel, iterable?: Iterable<any>);
|
||||
public channel: TextBasedChannelFields;
|
||||
@@ -1820,6 +1812,12 @@ declare module 'discord.js' {
|
||||
public delete(message: MessageResolvable, reason?: string): Promise<void>;
|
||||
}
|
||||
|
||||
// Hacky workaround because changing the signature of an overridden method errors
|
||||
class OverridableManager<V, K, R = any> extends BaseManager<V, K, R> {
|
||||
public add(data: any, cache: any): any;
|
||||
public set(key: any): any;
|
||||
}
|
||||
|
||||
export class PresenceManager extends BaseManager<Snowflake, Presence, PresenceResolvable> {
|
||||
constructor(client: Client, iterable?: Iterable<any>);
|
||||
}
|
||||
@@ -1894,6 +1892,8 @@ declare module 'discord.js' {
|
||||
|
||||
function WebhookMixin<T>(Base?: Constructable<T>): Constructable<T & WebhookFields>;
|
||||
|
||||
function VolumeMixin<T>(base: Constructable<T>): Constructable<T & VolumeInterface>;
|
||||
|
||||
interface WebhookFields {
|
||||
id: Snowflake;
|
||||
readonly createdAt: Date;
|
||||
@@ -1932,11 +1932,13 @@ declare module 'discord.js' {
|
||||
| 'WATCHING'
|
||||
| 'CUSTOM_STATUS';
|
||||
|
||||
type MessageFlagsString = 'CROSSPOSTED'
|
||||
| 'IS_CROSSPOST'
|
||||
| 'SUPPRESS_EMBEDS'
|
||||
| 'SOURCE_MESSAGE_DELETED'
|
||||
| 'URGENT';
|
||||
interface AddGuildMemberOptions {
|
||||
accessToken: string;
|
||||
nick?: string;
|
||||
roles?: Collection<Snowflake, Role> | RoleResolvable[];
|
||||
mute?: boolean;
|
||||
deaf?: boolean;
|
||||
}
|
||||
|
||||
interface APIErrror {
|
||||
UNKNOWN_ACCOUNT: number;
|
||||
@@ -1985,25 +1987,12 @@ declare module 'discord.js' {
|
||||
REACTION_BLOCKED: number;
|
||||
}
|
||||
|
||||
interface AddGuildMemberOptions {
|
||||
accessToken: string;
|
||||
nick?: string;
|
||||
roles?: Collection<Snowflake, Role> | RoleResolvable[];
|
||||
mute?: boolean;
|
||||
deaf?: boolean;
|
||||
}
|
||||
|
||||
interface AuditLogChange {
|
||||
key: string;
|
||||
old?: any;
|
||||
new?: any;
|
||||
}
|
||||
|
||||
interface ImageURLOptions {
|
||||
format?: ImageExt;
|
||||
size?: ImageSize;
|
||||
}
|
||||
|
||||
interface AwaitMessagesOptions extends MessageCollectorOptions {
|
||||
errors?: string[];
|
||||
}
|
||||
@@ -2084,6 +2073,21 @@ declare module 'discord.js' {
|
||||
http?: HTTPOptions;
|
||||
}
|
||||
|
||||
type ClientPresenceStatus = 'online' | 'idle' | 'dnd';
|
||||
|
||||
interface ClientPresenceStatusData {
|
||||
web?: ClientPresenceStatus;
|
||||
mobile?: ClientPresenceStatus;
|
||||
desktop?: ClientPresenceStatus;
|
||||
}
|
||||
|
||||
interface CloseEvent {
|
||||
wasClean: boolean;
|
||||
code: number;
|
||||
reason: string;
|
||||
target: WebSocket;
|
||||
}
|
||||
|
||||
type CollectorFilter = (...args: any[]) => boolean;
|
||||
|
||||
interface CollectorOptions {
|
||||
@@ -2122,6 +2126,13 @@ declare module 'discord.js' {
|
||||
| number
|
||||
| string;
|
||||
|
||||
interface CrosspostedChannel {
|
||||
channelID: Snowflake;
|
||||
guildID: Snowflake;
|
||||
type: keyof typeof ChannelType;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface DeconstructedSnowflake {
|
||||
timestamp: number;
|
||||
readonly date: Date;
|
||||
@@ -2133,11 +2144,6 @@ declare module 'discord.js' {
|
||||
|
||||
type DefaultMessageNotifications = 'ALL' | 'MENTIONS';
|
||||
|
||||
interface GuildEmojiEditData {
|
||||
name?: string;
|
||||
roles?: Collection<Snowflake, Role> | RoleResolvable[];
|
||||
}
|
||||
|
||||
interface EmbedField {
|
||||
name: string;
|
||||
value: string;
|
||||
@@ -2154,6 +2160,25 @@ declare module 'discord.js' {
|
||||
|
||||
type EmojiResolvable = Snowflake | GuildEmoji | ReactionEmoji;
|
||||
|
||||
interface ErrorEvent {
|
||||
error: any;
|
||||
message: string;
|
||||
type: string;
|
||||
target: WebSocket;
|
||||
}
|
||||
|
||||
interface EscapeMarkdownOptions {
|
||||
codeBlock?: boolean;
|
||||
inlineCode?: boolean;
|
||||
bold?: boolean;
|
||||
italic?: boolean;
|
||||
underline?: boolean;
|
||||
strikethrough?: boolean;
|
||||
spoiler?: boolean;
|
||||
inlineCodeContent?: boolean;
|
||||
codeBlockContent?: boolean;
|
||||
}
|
||||
|
||||
interface Extendable {
|
||||
GuildEmoji: typeof GuildEmoji;
|
||||
DMChannel: typeof DMChannel;
|
||||
@@ -2187,17 +2212,6 @@ declare module 'discord.js' {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface MessageActivity {
|
||||
partyID: string;
|
||||
type: number;
|
||||
}
|
||||
|
||||
interface MessageReference {
|
||||
channelID: string;
|
||||
guildID: string;
|
||||
messageID: string | null;
|
||||
}
|
||||
|
||||
type GuildAuditLogsAction = keyof GuildAuditLogsActions;
|
||||
|
||||
interface GuildAuditLogsActions {
|
||||
@@ -2286,11 +2300,6 @@ declare module 'discord.js' {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface GuildEmojiCreateOptions {
|
||||
roles?: Collection<Snowflake, Role> | RoleResolvable[];
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
interface GuildEditData {
|
||||
name?: string;
|
||||
region?: string;
|
||||
@@ -2312,6 +2321,16 @@ declare module 'discord.js' {
|
||||
channel: GuildChannelResolvable | null;
|
||||
}
|
||||
|
||||
interface GuildEmojiCreateOptions {
|
||||
roles?: Collection<Snowflake, Role> | RoleResolvable[];
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
interface GuildEmojiEditData {
|
||||
name?: string;
|
||||
roles?: Collection<Snowflake, Role> | RoleResolvable[];
|
||||
}
|
||||
|
||||
type GuildFeatures = 'ANIMATED_ICON'
|
||||
| 'BANNER'
|
||||
| 'COMMERCE'
|
||||
@@ -2366,6 +2385,11 @@ declare module 'discord.js' {
|
||||
| 1024
|
||||
| 2048;
|
||||
|
||||
interface ImageURLOptions {
|
||||
format?: ImageExt;
|
||||
size?: ImageSize;
|
||||
}
|
||||
|
||||
interface IntegrationData {
|
||||
id: string;
|
||||
type: string;
|
||||
@@ -2394,13 +2418,18 @@ declare module 'discord.js' {
|
||||
type MembershipStates = 'INVITED'
|
||||
| 'ACCEPTED';
|
||||
|
||||
type MessageAdditions = MessageEmbed | MessageAttachment | (MessageEmbed | MessageAttachment)[];
|
||||
|
||||
interface MessageActivity {
|
||||
partyID: string;
|
||||
type: number;
|
||||
}
|
||||
|
||||
interface MessageCollectorOptions extends CollectorOptions {
|
||||
max?: number;
|
||||
maxProcessed?: number;
|
||||
}
|
||||
|
||||
type MessageAdditions = MessageEmbed | MessageAttachment | (MessageEmbed | MessageAttachment)[];
|
||||
|
||||
interface MessageEditOptions {
|
||||
content?: string;
|
||||
embed?: MessageEmbedOptions | null;
|
||||
@@ -2408,6 +2437,26 @@ declare module 'discord.js' {
|
||||
flags?: BitFieldResolvable<MessageFlagsString>;
|
||||
}
|
||||
|
||||
interface MessageEmbedAuthor {
|
||||
name?: string;
|
||||
url?: string;
|
||||
iconURL?: string;
|
||||
proxyIconURL?: string;
|
||||
}
|
||||
|
||||
interface MessageEmbedFooter {
|
||||
text?: string;
|
||||
iconURL?: string;
|
||||
proxyIconURL?: string;
|
||||
}
|
||||
|
||||
interface MessageEmbedImage {
|
||||
url: string;
|
||||
proxyURL?: string;
|
||||
height?: number;
|
||||
width?: number;
|
||||
}
|
||||
|
||||
interface MessageEmbedOptions {
|
||||
title?: string;
|
||||
description?: string;
|
||||
@@ -2423,11 +2472,9 @@ declare module 'discord.js' {
|
||||
footer?: Partial<MessageEmbedFooter> & { icon_url?: string; proxy_icon_url?: string; };
|
||||
}
|
||||
|
||||
interface MessageEmbedAuthor {
|
||||
name?: string;
|
||||
url?: string;
|
||||
iconURL?: string;
|
||||
proxyIconURL?: string;
|
||||
interface MessageEmbedProvider {
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
interface MessageEmbedThumbnail {
|
||||
@@ -2437,24 +2484,6 @@ declare module 'discord.js' {
|
||||
width?: number;
|
||||
}
|
||||
|
||||
interface MessageEmbedFooter {
|
||||
text?: string;
|
||||
iconURL?: string;
|
||||
proxyIconURL?: string;
|
||||
}
|
||||
|
||||
interface MessageEmbedImage {
|
||||
url: string;
|
||||
proxyURL?: string;
|
||||
height?: number;
|
||||
width?: number;
|
||||
}
|
||||
|
||||
interface MessageEmbedProvider {
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
interface MessageEmbedVideo {
|
||||
url?: string;
|
||||
proxyURL?: string;
|
||||
@@ -2462,6 +2491,18 @@ declare module 'discord.js' {
|
||||
width?: number;
|
||||
}
|
||||
|
||||
interface MessageEvent {
|
||||
data: WebSocket.Data;
|
||||
type: string;
|
||||
target: WebSocket;
|
||||
}
|
||||
|
||||
type MessageFlagsString = 'CROSSPOSTED'
|
||||
| 'IS_CROSSPOST'
|
||||
| 'SUPPRESS_EMBEDS'
|
||||
| 'SOURCE_MESSAGE_DELETED'
|
||||
| 'URGENT';
|
||||
|
||||
interface MessageOptions {
|
||||
tts?: boolean;
|
||||
nonce?: string;
|
||||
@@ -2476,6 +2517,12 @@ declare module 'discord.js' {
|
||||
|
||||
type MessageReactionResolvable = MessageReaction | Snowflake;
|
||||
|
||||
interface MessageReference {
|
||||
channelID: string;
|
||||
guildID: string;
|
||||
messageID: string | null;
|
||||
}
|
||||
|
||||
type MessageResolvable = Message | Snowflake;
|
||||
|
||||
type MessageTarget = TextChannel | DMChannel | User | GuildMember | Webhook | WebhookClient;
|
||||
@@ -2513,6 +2560,8 @@ declare module 'discord.js' {
|
||||
|
||||
interface PermissionOverwriteOption extends Partial<Record<PermissionString, boolean | null>> { }
|
||||
|
||||
type PermissionResolvable = BitFieldResolvable<PermissionString>;
|
||||
|
||||
type PermissionString = 'CREATE_INSTANT_INVITE'
|
||||
| 'KICK_MEMBERS'
|
||||
| 'BAN_MEMBERS'
|
||||
@@ -2546,8 +2595,6 @@ declare module 'discord.js' {
|
||||
|
||||
interface RecursiveArray<T> extends Array<T | RecursiveArray<T>> { }
|
||||
|
||||
type PermissionResolvable = BitFieldResolvable<PermissionString>;
|
||||
|
||||
interface PermissionOverwriteOptions {
|
||||
allow: PermissionResolvable;
|
||||
deny: PermissionResolvable;
|
||||
@@ -2569,20 +2616,6 @@ declare module 'discord.js' {
|
||||
|
||||
type PresenceResolvable = Presence | UserResolvable | Snowflake;
|
||||
|
||||
type ClientPresenceStatus = 'online' | 'idle' | 'dnd';
|
||||
|
||||
interface ClientPresenceStatusData {
|
||||
web?: ClientPresenceStatus;
|
||||
mobile?: ClientPresenceStatus;
|
||||
desktop?: ClientPresenceStatus;
|
||||
}
|
||||
|
||||
type PartialTypes = 'USER'
|
||||
| 'CHANNEL'
|
||||
| 'GUILD_MEMBER'
|
||||
| 'MESSAGE'
|
||||
| 'REACTION';
|
||||
|
||||
type Partialize<T> = {
|
||||
id: string;
|
||||
partial: true;
|
||||
@@ -2591,11 +2624,17 @@ declare module 'discord.js' {
|
||||
[K in keyof Omit<T, 'id' | 'partial'>]: T[K] | null;
|
||||
};
|
||||
|
||||
interface PartialMessage extends Partialize<Message> {}
|
||||
interface PartialChannel extends Partialize<Channel> {}
|
||||
interface PartialGuildMember extends Partialize<GuildMember> {}
|
||||
interface PartialMessage extends Partialize<Message> {}
|
||||
interface PartialUser extends Partialize<User> {}
|
||||
|
||||
type PartialTypes = 'USER'
|
||||
| 'CHANNEL'
|
||||
| 'GUILD_MEMBER'
|
||||
| 'MESSAGE'
|
||||
| 'REACTION';
|
||||
|
||||
type PresenceStatus = ClientPresenceStatus | 'offline';
|
||||
|
||||
type PresenceStatusData = ClientPresenceStatus | 'invisible';
|
||||
@@ -2746,44 +2785,5 @@ declare module 'discord.js' {
|
||||
| 'VOICE_SERVER_UPDATE'
|
||||
| 'WEBHOOKS_UPDATE';
|
||||
|
||||
interface MessageEvent {
|
||||
data: WebSocket.Data;
|
||||
type: string;
|
||||
target: WebSocket;
|
||||
}
|
||||
|
||||
interface CloseEvent {
|
||||
wasClean: boolean;
|
||||
code: number;
|
||||
reason: string;
|
||||
target: WebSocket;
|
||||
}
|
||||
|
||||
interface ErrorEvent {
|
||||
error: any;
|
||||
message: string;
|
||||
type: string;
|
||||
target: WebSocket;
|
||||
}
|
||||
|
||||
interface CrosspostedChannel {
|
||||
channelID: Snowflake;
|
||||
guildID: Snowflake;
|
||||
type: keyof typeof ChannelType;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface EscapeMarkdownOptions {
|
||||
codeBlock?: boolean;
|
||||
inlineCode?: boolean;
|
||||
bold?: boolean;
|
||||
italic?: boolean;
|
||||
underline?: boolean;
|
||||
strikethrough?: boolean;
|
||||
spoiler?: boolean;
|
||||
inlineCodeContent?: boolean;
|
||||
codeBlockContent?: boolean;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user