seyfert
Version:
The most advanced framework for discord bots
57 lines (56 loc) • 1.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EntryPointCommand = void 0;
const common_1 = require("../../common");
const types_1 = require("../../types");
class EntryPointCommand {
middlewares = [];
__filePath;
__t;
name;
type = types_1.ApplicationCommandType.PrimaryEntryPoint;
nsfw;
integrationTypes = [];
contexts = [];
description;
botPermissions;
dm;
handler;
name_localizations;
description_localizations;
props = {};
toJSON() {
return {
handler: this.handler,
name: this.name,
type: this.type,
nsfw: this.nsfw,
default_member_permissions: null,
guild_id: null,
description: this.description,
name_localizations: this.name_localizations,
description_localizations: this.description_localizations,
dm_permission: this.dm,
contexts: this.contexts,
integration_types: this.integrationTypes,
};
}
async reload() {
delete require.cache[this.__filePath];
const __tempCommand = await (0, common_1.magicImport)(this.__filePath).then(x => x.default ?? x);
Object.setPrototypeOf(this, __tempCommand.prototype);
}
onRunError(context, error) {
context.client.logger.fatal(`${this.name}.<onRunError>`, context.author.id, error);
}
onMiddlewaresError(context, error) {
context.client.logger.fatal(`${this.name}.<onMiddlewaresError>`, context.author.id, error);
}
onBotPermissionsFail(context, permissions) {
context.client.logger.fatal(`${this.name}.<onBotPermissionsFail>`, context.author.id, permissions);
}
onInternalError(client, command, error) {
client.logger.fatal(command.name, error);
}
}
exports.EntryPointCommand = EntryPointCommand;