@evolvejs/core
Version:
An advanced Discord API wrapper with TS and JS support
64 lines (63 loc) • 2.48 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Structures = void 0;
const CategoryChannel_1 = require("./Channel/CategoryChannel");
const DMChannel_1 = require("./Channel/DMChannel");
const NewsChannel_1 = require("./Channel/NewsChannel");
const StoreChannel_1 = require("./Channel/StoreChannel");
const TextChannel_1 = require("./Channel/TextChannel");
const VoiceChannel_1 = require("./Channel/VoiceChannel");
const Emoji_1 = require("./Guild/Emoji");
const Guild_1 = require("./Guild/Guild");
const GuildMember_1 = require("./Guild/GuildMember");
const Role_1 = require("./Guild/Role");
const VoiceState_1 = require("./Guild/VoiceState");
const Message_1 = require("./Message/Message");
const MessageReaction_1 = require("./Message/MessageReaction");
const ClientStatus_1 = require("./Miscs/ClientStatus");
const PresenceUpdate_1 = require("./User/PresenceUpdate");
const User_1 = require("./User/User");
class Structures {
constructor(client) {
this.structures = {
Emoji: Emoji_1.Emoji,
DMChannel: DMChannel_1.DMChannel,
TextChannel: TextChannel_1.TextChannel,
VoiceChannel: VoiceChannel_1.VoiceChannel,
CategoryChannel: CategoryChannel_1.CategoryChannel,
NewsChannel: NewsChannel_1.NewsChannel,
StoreChannel: StoreChannel_1.StoreChannel,
GuildMember: GuildMember_1.GuildMember,
Guild: Guild_1.Guild,
Message: Message_1.Message,
MessageReaction: MessageReaction_1.MessageReaction,
PresenceUpdate: PresenceUpdate_1.PresenceUpdate,
ClientStatus: ClientStatus_1.ClientStatus,
VoiceState: VoiceState_1.VoiceState,
Role: Role_1.Role,
User: User_1.User,
};
Object.defineProperty(this, "client", {
value: client,
enumerable: false,
writable: false,
});
}
get(name) {
if (!this.structures[name])
throw this.client.transformer.error("Invalid Structure Name");
return this.structures[name];
}
extend(name, extender) {
try {
const structure = this.get(name);
const extended = extender(structure);
this.structures[name] = extended;
return extended;
}
catch (e) {
throw this.client.transformer.error(e);
}
}
}
exports.Structures = Structures;