@jadl/cmd
Version:
A command handler for JADL
18 lines (17 loc) • 834 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Command = void 0;
const v9_1 = require("discord-api-types/v9");
const Symbols_1 = require("../Symbols");
const Decorators_1 = require("../utils/Decorators");
exports.Command = Decorators_1.Decorators.createBaseDecorator(([name, description, type], command) => {
command[Symbols_1.Symbols.commandName] = name;
const interaction = command[Symbols_1.Symbols.interaction];
interaction.name = name;
interaction.type = type ?? v9_1.ApplicationCommandType.ChatInput;
if (!interaction.default_member_permissions)
interaction.default_member_permissions = null;
if (interaction.type === v9_1.ApplicationCommandType.ChatInput) {
interaction.description = description ?? 'Missing Description';
}
});