commandbot
Version:
A framework that helps you create your own Discord bot easier.
37 lines (36 loc) • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContextMenuCommand = void 0;
const PermissionGuildCommand_js_1 = require("./base/PermissionGuildCommand.js");
/**
* Representation of all context menu Discord interactions
* @class
*/
class ContextMenuCommand extends PermissionGuildCommand_js_1.PermissionGuildCommand {
/**
* Context menu command constructor
* @constructor
* @param {CommandManager} manager - manager that this command belongs to
* @param {ContextMenuCommandInit} options - initialization options
*/
constructor(manager, options) {
super(manager, "CONTEXT", {
name: options.name,
function: options.function,
announceSuccess: options.announceSuccess,
guilds: options.guilds,
permissions: options.permissions,
dm: options.dm,
ephemeral: options.ephemeral,
});
this.contextType = options.contextType;
}
/**
* @returns {ContextMenuCommandObject} Discord API object
* @public
*/
toObject() {
return Object.assign(Object.assign({}, super.toObject()), { type: this.contextType === "USER" ? 2 : 3 });
}
}
exports.ContextMenuCommand = ContextMenuCommand;