mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
fix(Structures): remove Structures (#6027)
This commit is contained in:
@@ -10,6 +10,7 @@ const ChannelManager = require('../managers/ChannelManager');
|
|||||||
const GuildManager = require('../managers/GuildManager');
|
const GuildManager = require('../managers/GuildManager');
|
||||||
const UserManager = require('../managers/UserManager');
|
const UserManager = require('../managers/UserManager');
|
||||||
const ShardClientUtil = require('../sharding/ShardClientUtil');
|
const ShardClientUtil = require('../sharding/ShardClientUtil');
|
||||||
|
const ClientPresence = require('../structures/ClientPresence');
|
||||||
const GuildPreview = require('../structures/GuildPreview');
|
const GuildPreview = require('../structures/GuildPreview');
|
||||||
const GuildTemplate = require('../structures/GuildTemplate');
|
const GuildTemplate = require('../structures/GuildTemplate');
|
||||||
const Invite = require('../structures/Invite');
|
const Invite = require('../structures/Invite');
|
||||||
@@ -22,7 +23,6 @@ const DataResolver = require('../util/DataResolver');
|
|||||||
const Intents = require('../util/Intents');
|
const Intents = require('../util/Intents');
|
||||||
const Options = require('../util/Options');
|
const Options = require('../util/Options');
|
||||||
const Permissions = require('../util/Permissions');
|
const Permissions = require('../util/Permissions');
|
||||||
const Structures = require('../util/Structures');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main hub for interacting with the Discord API, and the starting point for any bot.
|
* The main hub for interacting with the Discord API, and the starting point for any bot.
|
||||||
@@ -119,7 +119,6 @@ class Client extends BaseClient {
|
|||||||
*/
|
*/
|
||||||
this.channels = new ChannelManager(this);
|
this.channels = new ChannelManager(this);
|
||||||
|
|
||||||
const ClientPresence = Structures.get('ClientPresence');
|
|
||||||
/**
|
/**
|
||||||
* The presence of the Client
|
* The presence of the Client
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const Action = require('./Action');
|
const Action = require('./Action');
|
||||||
|
const ButtonInteraction = require('../../structures/ButtonInteraction');
|
||||||
|
const CommandInteraction = require('../../structures/CommandInteraction');
|
||||||
|
const SelectMenuInteraction = require('../../structures/SelectMenuInteraction');
|
||||||
const { Events, InteractionTypes, MessageComponentTypes } = require('../../util/Constants');
|
const { Events, InteractionTypes, MessageComponentTypes } = require('../../util/Constants');
|
||||||
const Structures = require('../../util/Structures');
|
|
||||||
|
|
||||||
let deprecationEmitted = false;
|
let deprecationEmitted = false;
|
||||||
|
|
||||||
@@ -16,15 +18,15 @@ class InteractionCreateAction extends Action {
|
|||||||
let InteractionType;
|
let InteractionType;
|
||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
case InteractionTypes.APPLICATION_COMMAND:
|
case InteractionTypes.APPLICATION_COMMAND:
|
||||||
InteractionType = Structures.get('CommandInteraction');
|
InteractionType = CommandInteraction;
|
||||||
break;
|
break;
|
||||||
case InteractionTypes.MESSAGE_COMPONENT:
|
case InteractionTypes.MESSAGE_COMPONENT:
|
||||||
switch (data.data.component_type) {
|
switch (data.data.component_type) {
|
||||||
case MessageComponentTypes.BUTTON:
|
case MessageComponentTypes.BUTTON:
|
||||||
InteractionType = Structures.get('ButtonInteraction');
|
InteractionType = ButtonInteraction;
|
||||||
break;
|
break;
|
||||||
case MessageComponentTypes.SELECT_MENU:
|
case MessageComponentTypes.SELECT_MENU:
|
||||||
InteractionType = Structures.get('SelectMenuInteraction');
|
InteractionType = SelectMenuInteraction;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
client.emit(
|
client.emit(
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const Action = require('./Action');
|
const Action = require('./Action');
|
||||||
|
const VoiceState = require('../../structures/VoiceState');
|
||||||
const { Events } = require('../../util/Constants');
|
const { Events } = require('../../util/Constants');
|
||||||
const Structures = require('../../util/Structures');
|
|
||||||
|
|
||||||
class VoiceStateUpdate extends Action {
|
class VoiceStateUpdate extends Action {
|
||||||
handle(data) {
|
handle(data) {
|
||||||
const client = this.client;
|
const client = this.client;
|
||||||
const guild = client.guilds.cache.get(data.guild_id);
|
const guild = client.guilds.cache.get(data.guild_id);
|
||||||
if (guild) {
|
if (guild) {
|
||||||
const VoiceState = Structures.get('VoiceState');
|
|
||||||
// Update the state
|
// Update the state
|
||||||
const oldState =
|
const oldState =
|
||||||
guild.voiceStates.cache.get(data.user_id)?._clone() ?? new VoiceState(guild, { user_id: data.user_id });
|
guild.voiceStates.cache.get(data.user_id)?._clone() ?? new VoiceState(guild, { user_id: data.user_id });
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ module.exports = {
|
|||||||
Options: require('./util/Options'),
|
Options: require('./util/Options'),
|
||||||
Permissions: require('./util/Permissions'),
|
Permissions: require('./util/Permissions'),
|
||||||
SnowflakeUtil: require('./util/SnowflakeUtil'),
|
SnowflakeUtil: require('./util/SnowflakeUtil'),
|
||||||
Structures: require('./util/Structures'),
|
|
||||||
SystemChannelFlags: require('./util/SystemChannelFlags'),
|
SystemChannelFlags: require('./util/SystemChannelFlags'),
|
||||||
ThreadMemberFlags: require('./util/ThreadMemberFlags'),
|
ThreadMemberFlags: require('./util/ThreadMemberFlags'),
|
||||||
UserFlags: require('./util/UserFlags'),
|
UserFlags: require('./util/UserFlags'),
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
const BaseManager = require('./BaseManager');
|
const BaseManager = require('./BaseManager');
|
||||||
const { Error } = require('../errors');
|
const { Error } = require('../errors');
|
||||||
|
|
||||||
let Structures;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages the API methods of a data model along with a collection of instances.
|
* Manages the API methods of a data model along with a collection of instances.
|
||||||
* @extends {BaseManager}
|
* @extends {BaseManager}
|
||||||
@@ -14,8 +12,6 @@ class DataManager extends BaseManager {
|
|||||||
constructor(client, holds) {
|
constructor(client, holds) {
|
||||||
super(client);
|
super(client);
|
||||||
|
|
||||||
if (!Structures) Structures = require('../util/Structures');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The data structure belonging to this manager.
|
* The data structure belonging to this manager.
|
||||||
* @name DataManager#holds
|
* @name DataManager#holds
|
||||||
@@ -23,7 +19,7 @@ class DataManager extends BaseManager {
|
|||||||
* @private
|
* @private
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
Object.defineProperty(this, 'holds', { value: Structures.get(holds.name) ?? holds });
|
Object.defineProperty(this, 'holds', { value: holds });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const Base = require('./Base');
|
const Base = require('./Base');
|
||||||
|
let CategoryChannel;
|
||||||
|
let DMChannel;
|
||||||
|
let NewsChannel;
|
||||||
|
let StageChannel;
|
||||||
|
let StoreChannel;
|
||||||
|
let TextChannel;
|
||||||
|
let ThreadChannel;
|
||||||
|
let VoiceChannel;
|
||||||
const { ChannelTypes, ThreadChannelTypes } = require('../util/Constants');
|
const { ChannelTypes, ThreadChannelTypes } = require('../util/Constants');
|
||||||
const SnowflakeUtil = require('../util/SnowflakeUtil');
|
const SnowflakeUtil = require('../util/SnowflakeUtil');
|
||||||
|
|
||||||
@@ -120,11 +128,18 @@ class Channel extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static create(client, data, guild) {
|
static create(client, data, guild) {
|
||||||
const Structures = require('../util/Structures');
|
if (!CategoryChannel) CategoryChannel = require('./CategoryChannel');
|
||||||
|
if (!DMChannel) DMChannel = require('./DMChannel');
|
||||||
|
if (!NewsChannel) NewsChannel = require('./NewsChannel');
|
||||||
|
if (!StageChannel) StageChannel = require('./StageChannel');
|
||||||
|
if (!StoreChannel) StoreChannel = require('./StoreChannel');
|
||||||
|
if (!TextChannel) TextChannel = require('./TextChannel');
|
||||||
|
if (!ThreadChannel) ThreadChannel = require('./ThreadChannel');
|
||||||
|
if (!VoiceChannel) VoiceChannel = require('./VoiceChannel');
|
||||||
|
|
||||||
let channel;
|
let channel;
|
||||||
if (!data.guild_id && !guild) {
|
if (!data.guild_id && !guild) {
|
||||||
if ((data.recipients && data.type !== ChannelTypes.GROUP) || data.type === ChannelTypes.DM) {
|
if ((data.recipients && data.type !== ChannelTypes.GROUP) || data.type === ChannelTypes.DM) {
|
||||||
const DMChannel = Structures.get('DMChannel');
|
|
||||||
channel = new DMChannel(client, data);
|
channel = new DMChannel(client, data);
|
||||||
} else if (data.type === ChannelTypes.GROUP) {
|
} else if (data.type === ChannelTypes.GROUP) {
|
||||||
const PartialGroupDMChannel = require('./PartialGroupDMChannel');
|
const PartialGroupDMChannel = require('./PartialGroupDMChannel');
|
||||||
@@ -136,39 +151,32 @@ class Channel extends Base {
|
|||||||
if (guild) {
|
if (guild) {
|
||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
case ChannelTypes.TEXT: {
|
case ChannelTypes.TEXT: {
|
||||||
const TextChannel = Structures.get('TextChannel');
|
|
||||||
channel = new TextChannel(guild, data);
|
channel = new TextChannel(guild, data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChannelTypes.VOICE: {
|
case ChannelTypes.VOICE: {
|
||||||
const VoiceChannel = Structures.get('VoiceChannel');
|
|
||||||
channel = new VoiceChannel(guild, data);
|
channel = new VoiceChannel(guild, data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChannelTypes.CATEGORY: {
|
case ChannelTypes.CATEGORY: {
|
||||||
const CategoryChannel = Structures.get('CategoryChannel');
|
|
||||||
channel = new CategoryChannel(guild, data);
|
channel = new CategoryChannel(guild, data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChannelTypes.NEWS: {
|
case ChannelTypes.NEWS: {
|
||||||
const NewsChannel = Structures.get('NewsChannel');
|
|
||||||
channel = new NewsChannel(guild, data);
|
channel = new NewsChannel(guild, data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChannelTypes.STORE: {
|
case ChannelTypes.STORE: {
|
||||||
const StoreChannel = Structures.get('StoreChannel');
|
|
||||||
channel = new StoreChannel(guild, data);
|
channel = new StoreChannel(guild, data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChannelTypes.STAGE: {
|
case ChannelTypes.STAGE: {
|
||||||
const StageChannel = Structures.get('StageChannel');
|
|
||||||
channel = new StageChannel(guild, data);
|
channel = new StageChannel(guild, data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChannelTypes.NEWS_THREAD:
|
case ChannelTypes.NEWS_THREAD:
|
||||||
case ChannelTypes.PUBLIC_THREAD:
|
case ChannelTypes.PUBLIC_THREAD:
|
||||||
case ChannelTypes.PRIVATE_THREAD: {
|
case ChannelTypes.PRIVATE_THREAD: {
|
||||||
const ThreadChannel = Structures.get('ThreadChannel');
|
|
||||||
channel = new ThreadChannel(guild, data);
|
channel = new ThreadChannel(guild, data);
|
||||||
channel.parent?.threads.cache.set(channel.id, channel);
|
channel.parent?.threads.cache.set(channel.id, channel);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const User = require('./User');
|
||||||
const DataResolver = require('../util/DataResolver');
|
const DataResolver = require('../util/DataResolver');
|
||||||
const Structures = require('../util/Structures');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the logged in client's Discord user.
|
* Represents the logged in client's Discord user.
|
||||||
* @extends {User}
|
* @extends {User}
|
||||||
*/
|
*/
|
||||||
class ClientUser extends Structures.get('User') {
|
class ClientUser extends User {
|
||||||
constructor(client, data) {
|
constructor(client, data) {
|
||||||
super(client, data);
|
super(client, data);
|
||||||
this._typing = new Map();
|
this._typing = new Map();
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const Base = require('./Base');
|
const Base = require('./Base');
|
||||||
|
const { Presence } = require('./Presence');
|
||||||
|
const VoiceState = require('./VoiceState');
|
||||||
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
||||||
const { Error } = require('../errors');
|
const { Error } = require('../errors');
|
||||||
const GuildMemberRoleManager = require('../managers/GuildMemberRoleManager');
|
const GuildMemberRoleManager = require('../managers/GuildMemberRoleManager');
|
||||||
const Permissions = require('../util/Permissions');
|
const Permissions = require('../util/Permissions');
|
||||||
let Structures;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a member of a guild on Discord.
|
* Represents a member of a guild on Discord.
|
||||||
@@ -130,8 +131,6 @@ class GuildMember extends Base {
|
|||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get voice() {
|
get voice() {
|
||||||
if (!Structures) Structures = require('../util/Structures');
|
|
||||||
const VoiceState = Structures.get('VoiceState');
|
|
||||||
return this.guild.voiceStates.cache.get(this.id) ?? new VoiceState(this.guild, { user_id: this.id });
|
return this.guild.voiceStates.cache.get(this.id) ?? new VoiceState(this.guild, { user_id: this.id });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,8 +158,6 @@ class GuildMember extends Base {
|
|||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get presence() {
|
get presence() {
|
||||||
if (!Structures) Structures = require('../util/Structures');
|
|
||||||
const Presence = Structures.get('Presence');
|
|
||||||
return (
|
return (
|
||||||
this.guild.presences.cache.get(this.id) ??
|
this.guild.presences.cache.get(this.id) ??
|
||||||
new Presence(this.client, {
|
new Presence(this.client, {
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const Base = require('./Base');
|
const Base = require('./Base');
|
||||||
|
const { Presence } = require('./Presence');
|
||||||
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
||||||
const { Error } = require('../errors');
|
const { Error } = require('../errors');
|
||||||
const SnowflakeUtil = require('../util/SnowflakeUtil');
|
const SnowflakeUtil = require('../util/SnowflakeUtil');
|
||||||
const UserFlags = require('../util/UserFlags');
|
const UserFlags = require('../util/UserFlags');
|
||||||
|
|
||||||
let Structures;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a user on Discord.
|
* Represents a user on Discord.
|
||||||
* @implements {TextBasedChannel}
|
* @implements {TextBasedChannel}
|
||||||
@@ -153,8 +152,6 @@ class User extends Base {
|
|||||||
for (const guild of this.client.guilds.cache.values()) {
|
for (const guild of this.client.guilds.cache.values()) {
|
||||||
if (guild.presences.cache.has(this.id)) return guild.presences.cache.get(this.id);
|
if (guild.presences.cache.has(this.id)) return guild.presences.cache.get(this.id);
|
||||||
}
|
}
|
||||||
if (!Structures) Structures = require('../util/Structures');
|
|
||||||
const Presence = Structures.get('Presence');
|
|
||||||
return new Presence(this.client, { user: { id: this.id } });
|
return new Presence(this.client, { user: { id: this.id } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,122 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An extendable structure:
|
|
||||||
* * **`GuildEmoji`**
|
|
||||||
* * **`DMChannel`**
|
|
||||||
* * **`TextChannel`**
|
|
||||||
* * **`VoiceChannel`**
|
|
||||||
* * **`CategoryChannel`**
|
|
||||||
* * **`NewsChannel`**
|
|
||||||
* * **`StoreChannel`**
|
|
||||||
* * **`StageChannel`**
|
|
||||||
* * **`ThreadChannel`**
|
|
||||||
* * **`GuildMember`**
|
|
||||||
* * **`ThreadMember`**
|
|
||||||
* * **`Guild`**
|
|
||||||
* * **`Message`**
|
|
||||||
* * **`MessageReaction`**
|
|
||||||
* * **`Presence`**
|
|
||||||
* * **`ClientPresence`**
|
|
||||||
* * **`VoiceState`**
|
|
||||||
* * **`Role`**
|
|
||||||
* * **`User`**
|
|
||||||
* * **`CommandInteraction`**
|
|
||||||
* * **`ButtonInteraction`**
|
|
||||||
* * **`StageInstance`**
|
|
||||||
* * **`SelectMenuInteraction`**
|
|
||||||
* @typedef {string} ExtendableStructure
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allows for the extension of built-in Discord.js structures that are instantiated by {@link BaseManager Managers}.
|
|
||||||
*/
|
|
||||||
class Structures extends null {
|
|
||||||
/**
|
|
||||||
* Retrieves a structure class.
|
|
||||||
* @param {string} structure Name of the structure to retrieve
|
|
||||||
* @returns {Function}
|
|
||||||
*/
|
|
||||||
static get(structure) {
|
|
||||||
if (typeof structure === 'string') return structures[structure];
|
|
||||||
throw new TypeError(`"structure" argument must be a string (received ${typeof structure})`);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extends a structure.
|
|
||||||
* <warn> Make sure to extend all structures before instantiating your client.
|
|
||||||
* Extending after doing so may not work as expected. </warn>
|
|
||||||
* @param {ExtendableStructure} structure Name of the structure class to extend
|
|
||||||
* @param {Function} extender Function that takes the base class to extend as its only parameter and returns the
|
|
||||||
* extended class/prototype
|
|
||||||
* @returns {Function} Extended class/prototype returned from the extender
|
|
||||||
* @example
|
|
||||||
* const { Structures } = require('discord.js');
|
|
||||||
*
|
|
||||||
* Structures.extend('Guild', Guild => {
|
|
||||||
* class CoolGuild extends Guild {
|
|
||||||
* constructor(client, data) {
|
|
||||||
* super(client, data);
|
|
||||||
* this.cool = true;
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* return CoolGuild;
|
|
||||||
* });
|
|
||||||
*/
|
|
||||||
static extend(structure, extender) {
|
|
||||||
if (!structures[structure]) throw new RangeError(`"${structure}" is not a valid extensible structure.`);
|
|
||||||
if (typeof extender !== 'function') {
|
|
||||||
const received = `(received ${typeof extender})`;
|
|
||||||
throw new TypeError(
|
|
||||||
`"extender" argument must be a function that returns the extended structure class/prototype ${received}.`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const extended = extender(structures[structure]);
|
|
||||||
if (typeof extended !== 'function') {
|
|
||||||
const received = `(received ${typeof extended})`;
|
|
||||||
throw new TypeError(`The extender function must return the extended structure class/prototype ${received}.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(extended.prototype instanceof structures[structure])) {
|
|
||||||
const prototype = Object.getPrototypeOf(extended);
|
|
||||||
const received = `${extended.name ?? 'unnamed'}${prototype.name ? ` extends ${prototype.name}` : ''}`;
|
|
||||||
throw new Error(
|
|
||||||
'The class/prototype returned from the extender function must extend the existing structure class/prototype' +
|
|
||||||
` (received function ${received}; expected extension of ${structures[structure].name}).`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
structures[structure] = extended;
|
|
||||||
return extended;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const structures = {
|
|
||||||
GuildEmoji: require('../structures/GuildEmoji'),
|
|
||||||
DMChannel: require('../structures/DMChannel'),
|
|
||||||
TextChannel: require('../structures/TextChannel'),
|
|
||||||
VoiceChannel: require('../structures/VoiceChannel'),
|
|
||||||
CategoryChannel: require('../structures/CategoryChannel'),
|
|
||||||
NewsChannel: require('../structures/NewsChannel'),
|
|
||||||
StoreChannel: require('../structures/StoreChannel'),
|
|
||||||
StageChannel: require('../structures/StageChannel'),
|
|
||||||
ThreadChannel: require('../structures/ThreadChannel'),
|
|
||||||
GuildMember: require('../structures/GuildMember'),
|
|
||||||
ThreadMember: require('../structures/ThreadMember'),
|
|
||||||
Guild: require('../structures/Guild'),
|
|
||||||
Message: require('../structures/Message'),
|
|
||||||
MessageReaction: require('../structures/MessageReaction'),
|
|
||||||
Presence: require('../structures/Presence').Presence,
|
|
||||||
ClientPresence: require('../structures/ClientPresence'),
|
|
||||||
VoiceState: require('../structures/VoiceState'),
|
|
||||||
Role: require('../structures/Role'),
|
|
||||||
User: require('../structures/User'),
|
|
||||||
CommandInteraction: require('../structures/CommandInteraction'),
|
|
||||||
ButtonInteraction: require('../structures/ButtonInteraction'),
|
|
||||||
SelectMenuInteraction: require('../structures/SelectMenuInteraction'),
|
|
||||||
StageInstance: require('../structures/StageInstance'),
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = Structures;
|
|
||||||
37
typings/index.d.ts
vendored
37
typings/index.d.ts
vendored
@@ -1888,20 +1888,6 @@ declare module 'discord.js' {
|
|||||||
public type: 'store';
|
public type: 'store';
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Structures extends null {
|
|
||||||
private constructor();
|
|
||||||
public static get<K extends keyof Extendable>(structure: K): Extendable[K];
|
|
||||||
public static get(structure: string): (...args: any[]) => void;
|
|
||||||
public static extend<K extends keyof Extendable, T extends Extendable[K]>(
|
|
||||||
structure: K,
|
|
||||||
extender: (baseClass: Extendable[K]) => T,
|
|
||||||
): T;
|
|
||||||
public static extend<T extends (...args: any[]) => void>(
|
|
||||||
structure: string,
|
|
||||||
extender: (baseClass: typeof Function) => T,
|
|
||||||
): T;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SystemChannelFlags extends BitField<SystemChannelFlagsString> {
|
export class SystemChannelFlags extends BitField<SystemChannelFlagsString> {
|
||||||
public static FLAGS: Record<SystemChannelFlagsString, number>;
|
public static FLAGS: Record<SystemChannelFlagsString, number>;
|
||||||
public static resolve(bit?: BitFieldResolvable<SystemChannelFlagsString, number>): number;
|
public static resolve(bit?: BitFieldResolvable<SystemChannelFlagsString, number>): number;
|
||||||
@@ -3326,29 +3312,6 @@ declare module 'discord.js' {
|
|||||||
|
|
||||||
type ExplicitContentFilterLevel = keyof typeof ExplicitContentFilterLevels;
|
type ExplicitContentFilterLevel = keyof typeof ExplicitContentFilterLevels;
|
||||||
|
|
||||||
interface Extendable {
|
|
||||||
GuildEmoji: typeof GuildEmoji;
|
|
||||||
DMChannel: typeof DMChannel;
|
|
||||||
TextChannel: typeof TextChannel;
|
|
||||||
VoiceChannel: typeof VoiceChannel;
|
|
||||||
CategoryChannel: typeof CategoryChannel;
|
|
||||||
NewsChannel: typeof NewsChannel;
|
|
||||||
StoreChannel: typeof StoreChannel;
|
|
||||||
ThreadChannel: typeof ThreadChannel;
|
|
||||||
GuildMember: typeof GuildMember;
|
|
||||||
ThreadMember: typeof ThreadMember;
|
|
||||||
Guild: typeof Guild;
|
|
||||||
Message: typeof Message;
|
|
||||||
MessageReaction: typeof MessageReaction;
|
|
||||||
Presence: typeof Presence;
|
|
||||||
VoiceState: typeof VoiceState;
|
|
||||||
Role: typeof Role;
|
|
||||||
User: typeof User;
|
|
||||||
CommandInteraction: typeof CommandInteraction;
|
|
||||||
ButtonInteraction: typeof ButtonInteraction;
|
|
||||||
SelectMenuInteraction: typeof SelectMenuInteraction;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface FetchApplicationCommandOptions extends BaseFetchOptions {
|
interface FetchApplicationCommandOptions extends BaseFetchOptions {
|
||||||
guildID?: Snowflake;
|
guildID?: Snowflake;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user