UNPKG

commandbot

Version:

A framework that helps you create your own Discord bot easier.

43 lines (42 loc) 1.27 kB
import { PermissionGuildCommand } from "./base/PermissionGuildCommand.js"; /** * Representation of all context menu Discord interactions * @class */ export class ContextMenuCommand extends PermissionGuildCommand { /** * Type of context menu interaction * @type {ContextType} * @public * @readonly */ contextType; /** * 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 { ...super.toObject(), type: this.contextType === "USER" ? 2 : 3, }; } }