Socket
Socket
Sign inDemoInstall

@notenoughupdates/discord-akairo

Package Overview
Dependencies
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@notenoughupdates/discord-akairo - npm Package Compare versions

Comparing version 9.0.10-dev.1644716050.2b9ae1a to 9.1.0

4

dist/package.json
{
"name": "@notenoughupdates/discord-akairo",
"version": "9.0.10-dev.1644716050.2b9ae1a",
"version": "9.1.0",
"description": "A highly customizable bot framework for Discord.js.",

@@ -48,3 +48,3 @@ "main": "./dist/src/index.js",

"discord-api-types": "^0.26.1",
"discord.js": "npm:@notenoughupdates/discord.js@dev",
"discord.js": "^13.6.0",
"eslint": "^8.7.0",

@@ -51,0 +51,0 @@ "eslint-config-prettier": "^8.3.0",

import { CommandUtil } from "./struct/commands/CommandUtil";
import * as Constants from "./util/Constants";
export { AkairoClient, type AkairoOptions } from "./struct/AkairoClient";
export { AkairoHandler, type AkairoHandlerOptions, type LoadPredicate } from "./struct/AkairoHandler";
export { AkairoModule, AkairoModuleOptions } from "./struct/AkairoModule";
export { ClientUtil } from "./struct/ClientUtil";
export { Argument, type ArgumentMatch, type ArgumentOptions, type ArgumentPromptData, type ArgumentPromptOptions, type ArgumentType, type ArgumentTypeCaster, type BaseArgumentType, type DefaultArgumentOptions, type DefaultValueSupplier, type FailureData, type OtherwiseContentModifier, type OtherwiseContentSupplier, type ParsedValuePredicate, type PromptContentModifier, type PromptContentSupplier } from "./struct/commands/arguments/Argument";
export { ArgumentRunner, type ArgumentRunnerState } from "./struct/commands/arguments/ArgumentRunner";
export { TypeResolver } from "./struct/commands/arguments/TypeResolver";
export { Command, type AkairoApplicationCommandAutocompleteOption, type AkairoApplicationCommandChannelOptionData, type AkairoApplicationCommandChoicesData, type AkairoApplicationCommandNonOptionsData, type AkairoApplicationCommandNumericOptionData, type AkairoApplicationCommandOptionData, type AkairoApplicationCommandSubCommandData, type AkairoApplicationCommandSubGroupData, type ArgumentGenerator, type ArgumentGeneratorReturn, type BeforeAction, type CommandOptions, type ExecutionPredicate, type KeySupplier, type MissingPermissionSupplier, type RegexSupplier, type SlashOption, type SlashPermissionsSupplier } from "./struct/commands/Command";
export { CommandHandler, type CommandHandlerOptions, type CooldownData, type IgnoreCheckPredicate, type MentionPrefixPredicate, type ParsedComponentData, type PrefixSupplier, type RegisterInteractionCommandError, type SlashResolveType } from "./struct/commands/CommandHandler";
export { CommandUtil } from "./struct/commands/CommandUtil";
export { ContentParser, type ContentParserOptions, type ContentParserResult, type ExtractedFlags, type StringData } from "./struct/commands/ContentParser";
export { Flag } from "./struct/commands/Flag";
export { ContextMenuCommand, type ContextMenuCommandOptions } from "./struct/contextMenuCommands/ContextMenuCommand";
export { ContextMenuCommandHandler } from "./struct/contextMenuCommands/ContextMenuCommandHandler";
export { Inhibitor, type InhibitorOptions } from "./struct/inhibitors/Inhibitor";
export { InhibitorHandler } from "./struct/inhibitors/InhibitorHandler";
export { Listener, type ListenerOptions, type ListenerType } from "./struct/listeners/Listener";
export { ListenerHandler } from "./struct/listeners/ListenerHandler";
export { Task, type TaskOptions } from "./struct/tasks/Task";
export { TaskHandler } from "./struct/tasks/TaskHandler";
export type { AkairoClientEvents, AkairoHandlerEvents, CommandHandlerEvents, ContextMenuCommandHandlerEvents, InhibitorHandlerEvents, ListenerHandlerEvents, TaskHandlerEvents } from "./typings/events";
export { AkairoError } from "./util/AkairoError";
export { AkairoMessage } from "./util/AkairoMessage";
export { Category } from "./util/Category";
export { Util } from "./util/Util";
export * from "./struct/AkairoClient";
export * from "./struct/AkairoHandler";
export * from "./struct/AkairoModule";
export * from "./struct/ClientUtil";
export * from "./struct/commands/arguments/Argument";
export * from "./struct/commands/arguments/ArgumentRunner";
export * from "./struct/commands/arguments/TypeResolver";
export * from "./struct/commands/Command";
export * from "./struct/commands/CommandHandler";
export * from "./struct/commands/CommandUtil";
export * from "./struct/commands/ContentParser";
export * from "./struct/commands/Flag";
export * from "./struct/contextMenuCommands/ContextMenuCommand";
export * from "./struct/contextMenuCommands/ContextMenuCommandHandler";
export * from "./struct/inhibitors/Inhibitor";
export * from "./struct/inhibitors/InhibitorHandler";
export * from "./struct/listeners/Listener";
export * from "./struct/listeners/ListenerHandler";
export * from "./struct/tasks/Task";
export * from "./struct/tasks/TaskHandler";
export * from "./typings/events";
export * from "./util/AkairoError";
export * from "./util/AkairoMessage";
export * from "./util/Category";
export * from "./util/Util";
export { Constants };

@@ -29,0 +29,0 @@ export declare const version: string;

@@ -21,2 +21,5 @@ "use strict";

};
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -26,55 +29,32 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

Object.defineProperty(exports, "__esModule", { value: true });
exports.version = exports.Constants = exports.Util = exports.Category = exports.AkairoMessage = exports.AkairoError = exports.TaskHandler = exports.Task = exports.ListenerHandler = exports.Listener = exports.InhibitorHandler = exports.Inhibitor = exports.ContextMenuCommandHandler = exports.ContextMenuCommand = exports.Flag = exports.ContentParser = exports.CommandUtil = exports.CommandHandler = exports.Command = exports.TypeResolver = exports.ArgumentRunner = exports.Argument = exports.ClientUtil = exports.AkairoModule = exports.AkairoHandler = exports.AkairoClient = void 0;
exports.version = exports.Constants = void 0;
const package_json_1 = __importDefault(require("../package.json"));
const Constants = __importStar(require("./util/Constants"));
exports.Constants = Constants;
var AkairoClient_1 = require("./struct/AkairoClient");
Object.defineProperty(exports, "AkairoClient", { enumerable: true, get: function () { return AkairoClient_1.AkairoClient; } });
var AkairoHandler_1 = require("./struct/AkairoHandler");
Object.defineProperty(exports, "AkairoHandler", { enumerable: true, get: function () { return AkairoHandler_1.AkairoHandler; } });
var AkairoModule_1 = require("./struct/AkairoModule");
Object.defineProperty(exports, "AkairoModule", { enumerable: true, get: function () { return AkairoModule_1.AkairoModule; } });
var ClientUtil_1 = require("./struct/ClientUtil");
Object.defineProperty(exports, "ClientUtil", { enumerable: true, get: function () { return ClientUtil_1.ClientUtil; } });
var Argument_1 = require("./struct/commands/arguments/Argument");
Object.defineProperty(exports, "Argument", { enumerable: true, get: function () { return Argument_1.Argument; } });
var ArgumentRunner_1 = require("./struct/commands/arguments/ArgumentRunner");
Object.defineProperty(exports, "ArgumentRunner", { enumerable: true, get: function () { return ArgumentRunner_1.ArgumentRunner; } });
var TypeResolver_1 = require("./struct/commands/arguments/TypeResolver");
Object.defineProperty(exports, "TypeResolver", { enumerable: true, get: function () { return TypeResolver_1.TypeResolver; } });
var Command_1 = require("./struct/commands/Command");
Object.defineProperty(exports, "Command", { enumerable: true, get: function () { return Command_1.Command; } });
var CommandHandler_1 = require("./struct/commands/CommandHandler");
Object.defineProperty(exports, "CommandHandler", { enumerable: true, get: function () { return CommandHandler_1.CommandHandler; } });
var CommandUtil_1 = require("./struct/commands/CommandUtil");
Object.defineProperty(exports, "CommandUtil", { enumerable: true, get: function () { return CommandUtil_1.CommandUtil; } });
var ContentParser_1 = require("./struct/commands/ContentParser");
Object.defineProperty(exports, "ContentParser", { enumerable: true, get: function () { return ContentParser_1.ContentParser; } });
var Flag_1 = require("./struct/commands/Flag");
Object.defineProperty(exports, "Flag", { enumerable: true, get: function () { return Flag_1.Flag; } });
var ContextMenuCommand_1 = require("./struct/contextMenuCommands/ContextMenuCommand");
Object.defineProperty(exports, "ContextMenuCommand", { enumerable: true, get: function () { return ContextMenuCommand_1.ContextMenuCommand; } });
var ContextMenuCommandHandler_1 = require("./struct/contextMenuCommands/ContextMenuCommandHandler");
Object.defineProperty(exports, "ContextMenuCommandHandler", { enumerable: true, get: function () { return ContextMenuCommandHandler_1.ContextMenuCommandHandler; } });
var Inhibitor_1 = require("./struct/inhibitors/Inhibitor");
Object.defineProperty(exports, "Inhibitor", { enumerable: true, get: function () { return Inhibitor_1.Inhibitor; } });
var InhibitorHandler_1 = require("./struct/inhibitors/InhibitorHandler");
Object.defineProperty(exports, "InhibitorHandler", { enumerable: true, get: function () { return InhibitorHandler_1.InhibitorHandler; } });
var Listener_1 = require("./struct/listeners/Listener");
Object.defineProperty(exports, "Listener", { enumerable: true, get: function () { return Listener_1.Listener; } });
var ListenerHandler_1 = require("./struct/listeners/ListenerHandler");
Object.defineProperty(exports, "ListenerHandler", { enumerable: true, get: function () { return ListenerHandler_1.ListenerHandler; } });
var Task_1 = require("./struct/tasks/Task");
Object.defineProperty(exports, "Task", { enumerable: true, get: function () { return Task_1.Task; } });
var TaskHandler_1 = require("./struct/tasks/TaskHandler");
Object.defineProperty(exports, "TaskHandler", { enumerable: true, get: function () { return TaskHandler_1.TaskHandler; } });
var AkairoError_1 = require("./util/AkairoError");
Object.defineProperty(exports, "AkairoError", { enumerable: true, get: function () { return AkairoError_1.AkairoError; } });
var AkairoMessage_1 = require("./util/AkairoMessage");
Object.defineProperty(exports, "AkairoMessage", { enumerable: true, get: function () { return AkairoMessage_1.AkairoMessage; } });
var Category_1 = require("./util/Category");
Object.defineProperty(exports, "Category", { enumerable: true, get: function () { return Category_1.Category; } });
var Util_1 = require("./util/Util");
Object.defineProperty(exports, "Util", { enumerable: true, get: function () { return Util_1.Util; } });
__exportStar(require("./struct/AkairoClient"), exports);
__exportStar(require("./struct/AkairoHandler"), exports);
__exportStar(require("./struct/AkairoModule"), exports);
__exportStar(require("./struct/ClientUtil"), exports);
__exportStar(require("./struct/commands/arguments/Argument"), exports);
__exportStar(require("./struct/commands/arguments/ArgumentRunner"), exports);
__exportStar(require("./struct/commands/arguments/TypeResolver"), exports);
__exportStar(require("./struct/commands/Command"), exports);
__exportStar(require("./struct/commands/CommandHandler"), exports);
__exportStar(require("./struct/commands/CommandUtil"), exports);
__exportStar(require("./struct/commands/ContentParser"), exports);
__exportStar(require("./struct/commands/Flag"), exports);
__exportStar(require("./struct/contextMenuCommands/ContextMenuCommand"), exports);
__exportStar(require("./struct/contextMenuCommands/ContextMenuCommandHandler"), exports);
__exportStar(require("./struct/inhibitors/Inhibitor"), exports);
__exportStar(require("./struct/inhibitors/InhibitorHandler"), exports);
__exportStar(require("./struct/listeners/Listener"), exports);
__exportStar(require("./struct/listeners/ListenerHandler"), exports);
__exportStar(require("./struct/tasks/Task"), exports);
__exportStar(require("./struct/tasks/TaskHandler"), exports);
__exportStar(require("./typings/events"), exports);
__exportStar(require("./util/AkairoError"), exports);
__exportStar(require("./util/AkairoMessage"), exports);
__exportStar(require("./util/Category"), exports);
__exportStar(require("./util/Util"), exports);
exports.version = package_json_1.default.version;
//# sourceMappingURL=index.js.map
/// <reference types="node" />
import { APIEmbed } from "discord-api-types";
import { BufferResolvable, Collection, Embed, Emoji, Guild, GuildChannel, GuildMember, MessageAttachment, PermissionsString, Role, Snowflake, ThreadChannel, User } from "discord.js";
import { BufferResolvable, Collection, Emoji, Guild, GuildChannel, GuildMember, MessageAttachment, MessageEmbed, PermissionString, Role, Snowflake, ThreadChannel, User } from "discord.js";
import type { Stream } from "stream";

@@ -88,3 +88,3 @@ import type { AkairoClient } from "./AkairoClient.js";

*/
embed(data?: Embed | APIEmbed): Embed;
embed(data?: MessageEmbed | APIEmbed): MessageEmbed;
/**

@@ -100,3 +100,3 @@ * Combination of `<Client>.fetchUser()` and `<Guild>.fetchMember()`.

*/
permissionNames(): PermissionsString[];
permissionNames(): PermissionString[];
/**

@@ -103,0 +103,0 @@ * Resolves a channel from a string, such as an ID, a name, or a mention.

@@ -166,4 +166,4 @@ "use strict";

compareStreaming(oldMember, newMember) {
const s1 = oldMember.presence?.activities.find(c => c.type === 1 /* Streaming */);
const s2 = newMember.presence?.activities.find(c => c.type === 1 /* Streaming */);
const s1 = oldMember.presence?.activities.find(c => c.type === "STREAMING");
const s2 = newMember.presence?.activities.find(c => c.type === "STREAMING");
if (s1 === s2)

@@ -182,3 +182,3 @@ return 0;

embed(data) {
return new discord_js_1.Embed(data);
return new discord_js_1.MessageEmbed(data);
}

@@ -199,3 +199,3 @@ /**

permissionNames() {
return Object.keys(discord_js_1.PermissionFlagsBits);
return Object.keys(discord_js_1.Permissions.FLAGS);
}

@@ -288,4 +288,4 @@ /**

const resolved = [];
for (const key of Object.keys(discord_js_1.PermissionFlagsBits)) {
if (BigInt(number) & discord_js_1.PermissionFlagsBits[key])
for (const key of Object.keys(discord_js_1.Permissions.FLAGS)) {
if (BigInt(number) & discord_js_1.Permissions.FLAGS[key])
resolved.push(key);

@@ -292,0 +292,0 @@ }

@@ -175,3 +175,3 @@ "use strict";

const channel = this.client.util.resolveChannel(phrase, message.guild.channels.cache);
if (!channel || !channel.isText())
if (!channel || channel.type !== "GUILD_TEXT")
return null;

@@ -197,3 +197,3 @@ return channel;

const channel = this.client.util.resolveChannel(phrase, message.guild.channels.cache);
if (!channel || !channel.isVoice())
if (!channel || channel.type !== "GUILD_VOICE")
return null;

@@ -219,3 +219,3 @@ return channel;

const channel = this.client.util.resolveChannel(phrase, message.guild.channels.cache);
if (!channel || !channel.isCategory())
if (!channel || channel.type !== "GUILD_CATEGORY")
return null;

@@ -232,3 +232,3 @@ return channel;

return null;
const categoryChannels = channels.filter(c => c.isCategory());
const categoryChannels = channels.filter(c => c.type === "GUILD_CATEGORY");
return categoryChannels.size ? categoryChannels : null;

@@ -242,3 +242,3 @@ },

const channel = this.client.util.resolveChannel(phrase, message.guild.channels.cache);
if (!channel || !channel.isNews())
if (!channel || channel.type !== "GUILD_NEWS")
return null;

@@ -255,3 +255,3 @@ return channel;

return null;
const newsChannels = channels.filter(c => c.isNews());
const newsChannels = channels.filter(c => c.type === "GUILD_NEWS");
return newsChannels.size ? newsChannels : null;

@@ -265,3 +265,3 @@ },

const channel = this.client.util.resolveChannel(phrase, message.guild.channels.cache);
if (!channel || !channel.isStore())
if (!channel || channel.type !== "GUILD_STORE")
return null;

@@ -279,3 +279,3 @@ return channel;

// eslint-disable-next-line deprecation/deprecation
const storeChannels = channels.filter(c => c.isStore());
const storeChannels = channels.filter(c => c.type === "GUILD_STORE");
return storeChannels.size ? storeChannels : null;

@@ -289,3 +289,3 @@ },

const channel = this.client.util.resolveChannel(phrase, message.guild.channels.cache);
if (!channel || !channel.isStage())
if (!channel || channel.type !== "GUILD_STAGE_VOICE")
return null;

@@ -302,3 +302,3 @@ return channel;

return null;
const storeChannels = channels.filter(c => c.isStage());
const storeChannels = channels.filter(c => c.type === "GUILD_STAGE_VOICE");
return storeChannels.size ? storeChannels : null;

@@ -384,3 +384,3 @@ },

for (const channel of message.guild.channels.cache.values()) {
if (!channel.isTextBased())
if (!channel.isText())
continue;

@@ -406,3 +406,3 @@ try {

for (const channel of message.guild.channels.cache.values()) {
if (!channel.isTextBased())
if (!channel.isText())
continue;

@@ -409,0 +409,0 @@ try {

/// <reference types="node" />
import { ApplicationCommandData, AutocompleteInteraction, Awaitable, ChatInputCommandInteraction, Collection, DiscordAPIError, Guild, Message, Snowflake, TextBasedChannel, User } from "discord.js";
import { ApplicationCommandData, AutocompleteInteraction, Awaitable, Collection, CommandInteraction, DiscordAPIError, Guild, Message, Snowflake, TextBasedChannel, User } from "discord.js";
import type { CommandHandlerEvents as CommandHandlerEventsType } from "../../typings/events";

@@ -196,3 +196,3 @@ import { AkairoMessage } from "../../util/AkairoMessage.js";

*/
handleSlash(interaction: ChatInputCommandInteraction): Promise<boolean | null>;
handleSlash(interaction: CommandInteraction): Promise<boolean | null>;
/**

@@ -199,0 +199,0 @@ * Handles autocomplete interactions.

@@ -160,3 +160,3 @@ "use strict";

this.client.on("interactionCreate", i => {
if (i.isChatInputCommand())
if (i.isCommand())
this.handleSlash(i);

@@ -203,3 +203,3 @@ if (i.isAutocomplete())

defaultPermission: data.slashDefaultPermission,
type: 1 /* ChatInput */
type: 1 /* CHAT_INPUT */
});

@@ -229,4 +229,8 @@ }

name: options.name,
description: options.type === 1 /* ChatInput */ ? options.description ?? "" : undefined,
options: options.type === 1 /* ChatInput */ ? options.options ?? [] : undefined,
description: options.type === 1 /* CHAT_INPUT */ || options.type === "CHAT_INPUT"
? options.description ?? ""
: undefined,
options: options.type === 1 /* CHAT_INPUT */ || options.type === "CHAT_INPUT"
? options.options ?? []
: undefined,
defaultPermission: options.defaultPermission,

@@ -276,4 +280,8 @@ type: options.type

name: options.name,
description: options.type === 1 /* ChatInput */ ? options.description ?? "" : undefined,
options: options.type === 1 /* ChatInput */ ? options.options ?? [] : undefined,
description: options.type === 1 /* CHAT_INPUT */ || options.type === "CHAT_INPUT"
? options.description ?? ""
: undefined,
options: options.type === 1 /* CHAT_INPUT */ || options.type === "CHAT_INPUT"
? options.options ?? []
: undefined,
defaultPermission: options.defaultPermission,

@@ -343,3 +351,3 @@ type: options.type

id: u,
type: 2 /* User */,
type: "USER",
permission: true

@@ -579,7 +587,6 @@ }))

for (const option of interaction.options["_hoistedOptions"]) {
if (option.type === 1 /* Subcommand */ ||
option.type === 2 /* SubcommandGroup */)
if (option.type === "SUB_COMMAND" || option.type === "SUB_COMMAND_GROUP")
continue;
const originalOption = commandModule.slashOptions?.find(o => o.name === option.name);
const func = `get${originalOption?.resolve ?? AkairoApplicationCommandOptionType[option.type]}`;
const func = `get${originalOption?.resolve ?? [Util_js_1.Util.snakeToCamelCase(option.type)]}`;
if (![

@@ -596,3 +603,3 @@ "getBoolean",

].includes(func))
throw new Error(` ${option.type}`);
throw new Error(`${func} is not a valid get function.`);
convertedOptions[option.name] = interaction.options[func](option.name, false);

@@ -608,3 +615,4 @@ }

}
if (usedSubcommandOrGroup.type === 1 /* Subcommand */) {
if (usedSubcommandOrGroup.type === "SUB_COMMAND" ||
usedSubcommandOrGroup.type === 1 /* SUB_COMMAND */) {
if (!usedSubcommandOrGroup.options) {

@@ -616,3 +624,4 @@ this.client.emit("akairoDebug", "[handleSlash] Unable to find subcommand options");

}
else if (usedSubcommandOrGroup.type === 2 /* SubcommandGroup */) {
else if (usedSubcommandOrGroup.type === "SUB_COMMAND_GROUP" ||
usedSubcommandOrGroup.type === 2 /* SUB_COMMAND_GROUP */) {
const usedSubCommand = usedSubcommandOrGroup.options?.find(subcommand => subcommand.name === convertedOptions.subcommand);

@@ -639,12 +648,20 @@ if (!usedSubCommand) {

switch (option.type) {
case 5 /* Boolean */:
case 5 /* BOOLEAN */:
case "BOOLEAN":
convertedOptions[option.name] ??= false;
break;
case 7 /* Channel */:
case 4 /* Integer */:
case 9 /* Mentionable */:
case 10 /* Number */:
case 8 /* Role */:
case 3 /* String */:
case 6 /* User */:
case 7 /* CHANNEL */:
case "CHANNEL":
case 4 /* INTEGER */:
case "INTEGER":
case 9 /* MENTIONABLE */:
case "MENTIONABLE":
case 10 /* NUMBER */:
case "NUMBER":
case 8 /* ROLE */:
case "ROLE":
case 3 /* STRING */:
case "STRING":
case 6 /* USER */:
case "USER":
default:

@@ -986,3 +1003,3 @@ convertedOptions[option.name] ??= null;

else if (message.guild) {
if (message.channel?.type === 1 /* DM */)
if (message.channel?.type === "DM")
return false;

@@ -1014,3 +1031,3 @@ const missing = message.channel?.permissionsFor(message.guild.me)?.missing(command.clientPermissions);

else if (message.guild) {
if (message.channel?.type === 1 /* DM */)
if (message.channel?.type === "DM")
return false;

@@ -1296,22 +1313,3 @@ const missing = message.channel?.permissionsFor(message.author)?.missing(command.userPermissions);

const slashResolvable = ["Boolean", "Channel", "String", "Integer", "Number", "User", "Member", "Role", "Mentionable"];
// todo: remove this once discord-api-types updates
/**
* Used for reverse mapping since discord exports its enums as const enums.
* @internal
*/
var AkairoApplicationCommandOptionType;
(function (AkairoApplicationCommandOptionType) {
AkairoApplicationCommandOptionType[AkairoApplicationCommandOptionType["Subcommand"] = 1] = "Subcommand";
AkairoApplicationCommandOptionType[AkairoApplicationCommandOptionType["SubcommandGroup"] = 2] = "SubcommandGroup";
AkairoApplicationCommandOptionType[AkairoApplicationCommandOptionType["String"] = 3] = "String";
AkairoApplicationCommandOptionType[AkairoApplicationCommandOptionType["Integer"] = 4] = "Integer";
AkairoApplicationCommandOptionType[AkairoApplicationCommandOptionType["Boolean"] = 5] = "Boolean";
// eslint-disable-next-line @typescript-eslint/no-shadow
AkairoApplicationCommandOptionType[AkairoApplicationCommandOptionType["User"] = 6] = "User";
AkairoApplicationCommandOptionType[AkairoApplicationCommandOptionType["Channel"] = 7] = "Channel";
AkairoApplicationCommandOptionType[AkairoApplicationCommandOptionType["Role"] = 8] = "Role";
AkairoApplicationCommandOptionType[AkairoApplicationCommandOptionType["Mentionable"] = 9] = "Mentionable";
AkairoApplicationCommandOptionType[AkairoApplicationCommandOptionType["Number"] = 10] = "Number";
})(AkairoApplicationCommandOptionType || (AkairoApplicationCommandOptionType = {}));
/**
* @typedef {CommandInteractionOptionResolver} VSCodePleaseStopRemovingMyImports

@@ -1318,0 +1316,0 @@ * @internal

@@ -1,2 +0,2 @@

import { ApplicationCommandType, type ContextMenuCommandInteraction, type Snowflake } from "discord.js";
import { type ContextMenuInteraction, type Snowflake } from "discord.js";
import type { Category } from "../../util/Category.js";

@@ -29,3 +29,3 @@ import type { AkairoClient } from "../AkairoClient.js";

*/
type: ApplicationCommandType.User | ApplicationCommandType.Message;
type: "USER" | "MESSAGE";
/**

@@ -56,3 +56,3 @@ * The category of this context menu command.

*/
exec(interaction: ContextMenuCommandInteraction): any;
exec(interaction: ContextMenuInteraction): any;
}

@@ -92,4 +92,4 @@ export interface ContextMenuCommand extends AkairoModule {

*/
type: ApplicationCommandType.User | ApplicationCommandType.Message;
type: "USER" | "MESSAGE";
}
//# sourceMappingURL=ContextMenuCommand.d.ts.map

@@ -25,4 +25,4 @@ "use strict";

throw new TypeError("options.ownerOnly must be a boolean");
if (type !== 2 /* User */ && type !== 3 /* Message */)
throw new TypeError("options.type must be either ApplicationCommandType.User or ApplicationCommandType.Message.");
if (type !== "USER" && type !== "MESSAGE")
throw new TypeError("options.type must be either 'USER' or 'MESSAGE'.");
super(id, { category });

@@ -29,0 +29,0 @@ this.guilds = guilds;

@@ -1,2 +0,2 @@

import type { Awaitable, Collection, ContextMenuCommandInteraction } from "discord.js";
import type { Awaitable, Collection, ContextMenuInteraction } from "discord.js";
import type { ContextMenuCommandHandlerEvents } from "../../typings/events";

@@ -50,3 +50,3 @@ import type { Category } from "../../util/Category.js";

*/
handle(interaction: ContextMenuCommandInteraction): Promise<boolean | null>;
handle(interaction: ContextMenuInteraction): Promise<boolean | null>;
/**

@@ -58,3 +58,3 @@ * Handles errors from the handling.

*/
emitError(err: Error, interaction: ContextMenuCommandInteraction, command: ContextMenuCommand | AkairoModule): void;
emitError(err: Error, interaction: ContextMenuInteraction, command: ContextMenuCommand | AkairoModule): void;
}

@@ -61,0 +61,0 @@ declare type Events = ContextMenuCommandHandlerEvents;

@@ -36,3 +36,3 @@ "use strict";

this.client.on("interactionCreate", i => {
if (!i.isUserContextMenuCommand())
if (!i.isUserContextMenu())
return;

@@ -39,0 +39,0 @@ this.handle(i);

@@ -1,2 +0,2 @@

import type { ChatInputCommandInteraction, ClientEvents, ContextMenuCommandInteraction, Message } from "discord.js";
import type { ClientEvents, CommandInteraction, ContextMenuInteraction, Message } from "discord.js";
import type { AkairoModule } from "../struct/AkairoModule.js";

@@ -156,3 +156,3 @@ import type { Command } from "../struct/commands/Command.js";

*/
slashNotFound: [interaction: ChatInputCommandInteraction];
slashNotFound: [interaction: CommandInteraction];
/**

@@ -229,3 +229,3 @@ * Emitted when a slash command starts execution.

*/
error: [error: Error, interaction: ContextMenuCommandInteraction, command: ContextMenuCommand];
error: [error: Error, interaction: ContextMenuInteraction, command: ContextMenuCommand];
/**

@@ -237,3 +237,3 @@ * Emitted when a context menu command finishes execution.

*/
finished: [interaction: ContextMenuCommandInteraction, command: ContextMenuCommand, returnValue: any];
finished: [interaction: ContextMenuInteraction, command: ContextMenuCommand, returnValue: any];
/**

@@ -243,3 +243,3 @@ * Emitted when a an incoming interaction command cannot be matched with a command.

*/
notFound: [interaction: ContextMenuCommandInteraction];
notFound: [interaction: ContextMenuInteraction];
/**

@@ -251,3 +251,3 @@ * Emitted when a command starts execution.

*/
started: [interaction: ContextMenuCommandInteraction, command: ContextMenuCommand];
started: [interaction: ContextMenuInteraction, command: ContextMenuCommand];
/**

@@ -260,3 +260,3 @@ * Emitted when a command is blocked.

blocked: [
interaction: ContextMenuCommandInteraction,
interaction: ContextMenuInteraction,
command: Command,

@@ -263,0 +263,0 @@ reason: typeof BuiltInReasons.OWNER | typeof BuiltInReasons.SUPER_USER

import type { APIInteractionGuildMember, APIMessage } from "discord-api-types/v9";
import { Base, ChatInputCommandInteraction, Guild, GuildMember, GuildTextBasedChannel, InteractionReplyOptions, Message, MessagePayload, Snowflake, TextBasedChannel, User } from "discord.js";
import { Base, CommandInteraction, Guild, GuildMember, GuildTextBasedChannel, InteractionReplyOptions, Message, MessagePayload, Snowflake, TextBasedChannel, User } from "discord.js";
import type { AkairoClient } from "../struct/AkairoClient.js";

@@ -40,3 +40,3 @@ import type { CommandUtil } from "../struct/commands/CommandUtil.js";

*/
interaction: ChatInputCommandInteraction;
interaction: CommandInteraction;
/**

@@ -59,3 +59,3 @@ * Represents the author of the interaction as a guild member.

*/
constructor(client: AkairoClient, interaction: ChatInputCommandInteraction);
constructor(client: AkairoClient, interaction: CommandInteraction);
/**

@@ -62,0 +62,0 @@ * The channel that the interaction was sent in.

{
"name": "@notenoughupdates/discord-akairo",
"version": "9.0.10-dev.1644716050.2b9ae1a",
"version": "9.1.0",
"description": "A highly customizable bot framework for Discord.js.",

@@ -48,3 +48,3 @@ "main": "./dist/src/index.js",

"discord-api-types": "^0.26.1",
"discord.js": "npm:@notenoughupdates/discord.js@dev",
"discord.js": "^13.6.0",
"eslint": "^8.7.0",

@@ -51,0 +51,0 @@ "eslint-config-prettier": "^8.3.0",

import packageJSON from "../package.json";
import { CommandUtil } from "./struct/commands/CommandUtil";
import * as Constants from "./util/Constants";
export { AkairoClient, type AkairoOptions } from "./struct/AkairoClient";
export { AkairoHandler, type AkairoHandlerOptions, type LoadPredicate } from "./struct/AkairoHandler";
export { AkairoModule, AkairoModuleOptions } from "./struct/AkairoModule";
export { ClientUtil } from "./struct/ClientUtil";
export {
Argument,
type ArgumentMatch,
type ArgumentOptions,
type ArgumentPromptData,
type ArgumentPromptOptions,
type ArgumentType,
type ArgumentTypeCaster,
type BaseArgumentType,
type DefaultArgumentOptions,
type DefaultValueSupplier,
type FailureData,
type OtherwiseContentModifier,
type OtherwiseContentSupplier,
type ParsedValuePredicate,
type PromptContentModifier,
type PromptContentSupplier
} from "./struct/commands/arguments/Argument";
export { ArgumentRunner, type ArgumentRunnerState } from "./struct/commands/arguments/ArgumentRunner";
export { TypeResolver } from "./struct/commands/arguments/TypeResolver";
export {
Command,
type AkairoApplicationCommandAutocompleteOption,
type AkairoApplicationCommandChannelOptionData,
type AkairoApplicationCommandChoicesData,
type AkairoApplicationCommandNonOptionsData,
type AkairoApplicationCommandNumericOptionData,
type AkairoApplicationCommandOptionData,
type AkairoApplicationCommandSubCommandData,
type AkairoApplicationCommandSubGroupData,
type ArgumentGenerator,
type ArgumentGeneratorReturn,
type BeforeAction,
type CommandOptions,
type ExecutionPredicate,
type KeySupplier,
type MissingPermissionSupplier,
type RegexSupplier,
type SlashOption,
type SlashPermissionsSupplier
} from "./struct/commands/Command";
export {
CommandHandler,
type CommandHandlerOptions,
type CooldownData,
type IgnoreCheckPredicate,
type MentionPrefixPredicate,
type ParsedComponentData,
type PrefixSupplier,
type RegisterInteractionCommandError,
type SlashResolveType
} from "./struct/commands/CommandHandler";
export { CommandUtil } from "./struct/commands/CommandUtil";
export {
ContentParser,
type ContentParserOptions,
type ContentParserResult,
type ExtractedFlags,
type StringData
} from "./struct/commands/ContentParser";
export { Flag } from "./struct/commands/Flag";
export { ContextMenuCommand, type ContextMenuCommandOptions } from "./struct/contextMenuCommands/ContextMenuCommand";
export { ContextMenuCommandHandler } from "./struct/contextMenuCommands/ContextMenuCommandHandler";
export { Inhibitor, type InhibitorOptions } from "./struct/inhibitors/Inhibitor";
export { InhibitorHandler } from "./struct/inhibitors/InhibitorHandler";
export { Listener, type ListenerOptions, type ListenerType } from "./struct/listeners/Listener";
export { ListenerHandler } from "./struct/listeners/ListenerHandler";
export { Task, type TaskOptions } from "./struct/tasks/Task";
export { TaskHandler } from "./struct/tasks/TaskHandler";
export type {
AkairoClientEvents,
AkairoHandlerEvents,
CommandHandlerEvents,
ContextMenuCommandHandlerEvents,
InhibitorHandlerEvents,
ListenerHandlerEvents,
TaskHandlerEvents
} from "./typings/events";
export { AkairoError } from "./util/AkairoError";
export { AkairoMessage } from "./util/AkairoMessage";
export { Category } from "./util/Category";
export { Util } from "./util/Util";
export * from "./struct/AkairoClient";
export * from "./struct/AkairoHandler";
export * from "./struct/AkairoModule";
export * from "./struct/ClientUtil";
export * from "./struct/commands/arguments/Argument";
export * from "./struct/commands/arguments/ArgumentRunner";
export * from "./struct/commands/arguments/TypeResolver";
export * from "./struct/commands/Command";
export * from "./struct/commands/CommandHandler";
export * from "./struct/commands/CommandUtil";
export * from "./struct/commands/ContentParser";
export * from "./struct/commands/Flag";
export * from "./struct/contextMenuCommands/ContextMenuCommand";
export * from "./struct/contextMenuCommands/ContextMenuCommandHandler";
export * from "./struct/inhibitors/Inhibitor";
export * from "./struct/inhibitors/InhibitorHandler";
export * from "./struct/listeners/Listener";
export * from "./struct/listeners/ListenerHandler";
export * from "./struct/tasks/Task";
export * from "./struct/tasks/TaskHandler";
export * from "./typings/events";
export * from "./util/AkairoError";
export * from "./util/AkairoMessage";
export * from "./util/Category";
export * from "./util/Util";
export { Constants };

@@ -91,0 +30,0 @@ export const { version } = packageJSON;

import { APIEmbed } from "discord-api-types";
import {
ActivityType,
BufferResolvable,
Collection,
Embed,
Emoji,

@@ -12,4 +10,5 @@ Guild,

MessageAttachment,
PermissionFlagsBits,
PermissionsString,
MessageEmbed,
Permissions,
PermissionString,
Role,

@@ -222,4 +221,4 @@ Snowflake,

public compareStreaming(oldMember: GuildMember, newMember: GuildMember): 0 | 1 | 2 {
const s1 = oldMember.presence?.activities.find(c => c.type === ActivityType.Streaming);
const s2 = newMember.presence?.activities.find(c => c.type === ActivityType.Streaming);
const s1 = oldMember.presence?.activities.find(c => c.type === "STREAMING");
const s2 = newMember.presence?.activities.find(c => c.type === "STREAMING");
if (s1 === s2) return 0;

@@ -235,4 +234,4 @@ if (s1) return 1;

*/
public embed(data?: Embed | APIEmbed): Embed {
return new Embed(data);
public embed(data?: MessageEmbed | APIEmbed): MessageEmbed {
return new MessageEmbed(data);
}

@@ -254,4 +253,4 @@

*/
public permissionNames(): PermissionsString[] {
return Object.keys(PermissionFlagsBits) as PermissionsString[];
public permissionNames(): PermissionString[] {
return Object.keys(Permissions.FLAGS) as PermissionString[];
}

@@ -394,4 +393,4 @@

for (const key of Object.keys(PermissionFlagsBits)) {
if (BigInt(number) & PermissionFlagsBits[key as PermissionsString]) resolved.push(key);
for (const key of Object.keys(Permissions.FLAGS)) {
if (BigInt(number) & Permissions.FLAGS[key as PermissionString]) resolved.push(key);
}

@@ -398,0 +397,0 @@

@@ -233,3 +233,3 @@ import {

const channel = this.client.util.resolveChannel(phrase, message.guild.channels.cache);
if (!channel || !channel.isText()) return null;
if (!channel || channel.type !== "GUILD_TEXT") return null;

@@ -253,3 +253,3 @@ return channel;

const channel = this.client.util.resolveChannel(phrase, message.guild.channels.cache);
if (!channel || !channel.isVoice()) return null;
if (!channel || channel.type !== "GUILD_VOICE") return null;
return channel;

@@ -272,3 +272,3 @@ },

const channel = this.client.util.resolveChannel(phrase, message.guild.channels.cache);
if (!channel || !channel.isCategory()) return null;
if (!channel || channel.type !== "GUILD_CATEGORY") return null;

@@ -284,3 +284,3 @@ return channel;

const categoryChannels = <Collection<string, CategoryChannel>>channels.filter(c => c.isCategory());
const categoryChannels = <Collection<string, CategoryChannel>>channels.filter(c => c.type === "GUILD_CATEGORY");
return categoryChannels.size ? categoryChannels : null;

@@ -293,3 +293,3 @@ },

const channel = this.client.util.resolveChannel(phrase, message.guild.channels.cache);
if (!channel || !channel.isNews()) return null;
if (!channel || channel.type !== "GUILD_NEWS") return null;

@@ -305,3 +305,3 @@ return channel;

const newsChannels = <Collection<string, NewsChannel>>channels.filter(c => c.isNews());
const newsChannels = <Collection<string, NewsChannel>>channels.filter(c => c.type === "GUILD_NEWS");
return newsChannels.size ? newsChannels : null;

@@ -314,3 +314,3 @@ },

const channel = this.client.util.resolveChannel(phrase, message.guild.channels.cache);
if (!channel || !channel.isStore()) return null;
if (!channel || channel.type !== "GUILD_STORE") return null;

@@ -327,3 +327,3 @@ return channel;

// eslint-disable-next-line deprecation/deprecation
const storeChannels = <Collection<string, StoreChannel>>channels.filter(c => c.isStore());
const storeChannels = <Collection<string, StoreChannel>>channels.filter(c => c.type === "GUILD_STORE");
return storeChannels.size ? storeChannels : null;

@@ -336,3 +336,3 @@ },

const channel = this.client.util.resolveChannel(phrase, message.guild.channels.cache);
if (!channel || !channel.isStage()) return null;
if (!channel || channel.type !== "GUILD_STAGE_VOICE") return null;

@@ -348,3 +348,3 @@ return channel;

const storeChannels = <Collection<string, StageChannel>>channels.filter(c => c.isStage());
const storeChannels = <Collection<string, StageChannel>>channels.filter(c => c.type === "GUILD_STAGE_VOICE");
return storeChannels.size ? storeChannels : null;

@@ -422,3 +422,3 @@ },

for (const channel of message.guild.channels.cache.values()) {
if (!channel.isTextBased()) continue;
if (!channel.isText()) continue;
try {

@@ -443,3 +443,3 @@ return await channel.messages.fetch(phrase);

for (const channel of message.guild.channels.cache.values()) {
if (!channel.isTextBased()) continue;
if (!channel.isText()) continue;
try {

@@ -446,0 +446,0 @@ return await channel.messages.fetch(phrase);

@@ -5,10 +5,6 @@ import {

ApplicationCommandOptionData,
ApplicationCommandOptionType,
ApplicationCommandPermissionType,
ApplicationCommandType,
AutocompleteInteraction,
Awaitable,
ChannelType,
ChatInputCommandInteraction,
Collection,
CommandInteraction,
CommandInteractionOption,

@@ -25,2 +21,3 @@ CommandInteractionOptionResolver,

} from "discord.js";
import { ApplicationCommandOptionTypes, ApplicationCommandTypes } from "discord.js/typings/enums";
import type { CommandHandlerEvents as CommandHandlerEventsType } from "../../typings/events";

@@ -383,3 +380,3 @@ import { AkairoError } from "../../util/AkairoError.js";

this.client.on("interactionCreate", i => {
if (i.isChatInputCommand()) this.handleSlash(i);
if (i.isCommand()) this.handleSlash(i);
if (i.isAutocomplete()) this.handleAutocomplete(i);

@@ -424,3 +421,3 @@ });

defaultPermission: data.slashDefaultPermission,
type: ApplicationCommandType.ChatInput
type: ApplicationCommandTypes.CHAT_INPUT
});

@@ -452,4 +449,10 @@ }

name: options.name,
description: options.type === ApplicationCommandType.ChatInput ? options.description ?? "" : undefined,
options: options.type === ApplicationCommandType.ChatInput ? options.options ?? [] : undefined,
description:
options.type === ApplicationCommandTypes.CHAT_INPUT || options.type === "CHAT_INPUT"
? options.description ?? ""
: undefined,
options:
options.type === ApplicationCommandTypes.CHAT_INPUT || options.type === "CHAT_INPUT"
? options.options ?? []
: undefined,
defaultPermission: options.defaultPermission,

@@ -494,4 +497,10 @@ type: options.type

name: options.name,
description: options.type === ApplicationCommandType.ChatInput ? options.description ?? "" : undefined,
options: options.type === ApplicationCommandType.ChatInput ? options.options ?? [] : undefined,
description:
options.type === ApplicationCommandTypes.CHAT_INPUT || options.type === "CHAT_INPUT"
? options.description ?? ""
: undefined,
options:
options.type === ApplicationCommandTypes.CHAT_INPUT || options.type === "CHAT_INPUT"
? options.options ?? []
: undefined,
defaultPermission: options.defaultPermission,

@@ -567,3 +576,3 @@ type: options.type

id: u,
type: ApplicationCommandPermissionType.User,
type: "USER",
permission: true

@@ -778,3 +787,3 @@ }))

// eslint-disable-next-line complexity
public async handleSlash(interaction: ChatInputCommandInteraction): Promise<boolean | null> {
public async handleSlash(interaction: CommandInteraction): Promise<boolean | null> {
const commandModule = this.findCommand(interaction.commandName);

@@ -833,10 +842,6 @@

for (const option of (interaction.options as CommandInteractionOptionResolver)["_hoistedOptions"]) {
if (
option.type === ApplicationCommandOptionType.Subcommand ||
option.type === ApplicationCommandOptionType.SubcommandGroup
)
continue;
if (option.type === "SUB_COMMAND" || option.type === "SUB_COMMAND_GROUP") continue;
const originalOption = commandModule.slashOptions?.find(o => o.name === option.name);
const func = `get${originalOption?.resolve ?? AkairoApplicationCommandOptionType[option.type]}` as GetFunction;
const func = `get${originalOption?.resolve ?? [Util.snakeToCamelCase(option.type)]}` as GetFunction;
if (

@@ -857,3 +862,3 @@ !(

)
throw new Error(` ${option.type}`);
throw new Error(`${func} is not a valid get function.`);
convertedOptions[option.name] = interaction.options[func](option.name, false);

@@ -877,3 +882,6 @@ }

}
if (usedSubcommandOrGroup.type === ApplicationCommandOptionType.Subcommand) {
if (
usedSubcommandOrGroup.type === "SUB_COMMAND" ||
usedSubcommandOrGroup.type === ApplicationCommandOptionTypes.SUB_COMMAND
) {
if (!(<SubCommand>usedSubcommandOrGroup).options) {

@@ -884,3 +892,6 @@ this.client.emit("akairoDebug", "[handleSlash] Unable to find subcommand options");

handleOptions((<SubCommand>usedSubcommandOrGroup).options!);
} else if (usedSubcommandOrGroup.type === ApplicationCommandOptionType.SubcommandGroup) {
} else if (
usedSubcommandOrGroup.type === "SUB_COMMAND_GROUP" ||
usedSubcommandOrGroup.type === ApplicationCommandOptionTypes.SUB_COMMAND_GROUP
) {
const usedSubCommand = (<SubCommandGroup>usedSubcommandOrGroup).options?.find(

@@ -908,12 +919,20 @@ subcommand => subcommand.name === convertedOptions.subcommand

switch (option.type) {
case ApplicationCommandOptionType.Boolean:
case ApplicationCommandOptionTypes.BOOLEAN:
case "BOOLEAN":
convertedOptions[option.name] ??= false;
break;
case ApplicationCommandOptionType.Channel:
case ApplicationCommandOptionType.Integer:
case ApplicationCommandOptionType.Mentionable:
case ApplicationCommandOptionType.Number:
case ApplicationCommandOptionType.Role:
case ApplicationCommandOptionType.String:
case ApplicationCommandOptionType.User:
case ApplicationCommandOptionTypes.CHANNEL:
case "CHANNEL":
case ApplicationCommandOptionTypes.INTEGER:
case "INTEGER":
case ApplicationCommandOptionTypes.MENTIONABLE:
case "MENTIONABLE":
case ApplicationCommandOptionTypes.NUMBER:
case "NUMBER":
case ApplicationCommandOptionTypes.ROLE:
case "ROLE":
case ApplicationCommandOptionTypes.STRING:
case "STRING":
case ApplicationCommandOptionTypes.USER:
case "USER":
default:

@@ -1284,3 +1303,3 @@ convertedOptions[option.name] ??= null;

} else if (message.guild) {
if (message.channel?.type === ChannelType.DM) return false;
if (message.channel?.type === "DM") return false;
const missing = message.channel?.permissionsFor(message.guild.me!)?.missing(command.clientPermissions);

@@ -1312,3 +1331,3 @@ if (missing?.length) {

} else if (message.guild) {
if (message.channel?.type === ChannelType.DM) return false;
if (message.channel?.type === "DM") return false;
const missing = message.channel?.permissionsFor(message.author)?.missing(command.userPermissions);

@@ -1906,24 +1925,5 @@ if (missing?.length) {

// todo: remove this once discord-api-types updates
/**
* Used for reverse mapping since discord exports its enums as const enums.
* @internal
*/
enum AkairoApplicationCommandOptionType {
Subcommand = ApplicationCommandOptionType.Subcommand,
SubcommandGroup = ApplicationCommandOptionType.SubcommandGroup,
String = ApplicationCommandOptionType.String,
Integer = ApplicationCommandOptionType.Integer,
Boolean = ApplicationCommandOptionType.Boolean,
// eslint-disable-next-line @typescript-eslint/no-shadow
User = ApplicationCommandOptionType.User,
Channel = ApplicationCommandOptionType.Channel,
Role = ApplicationCommandOptionType.Role,
Mentionable = ApplicationCommandOptionType.Mentionable,
Number = ApplicationCommandOptionType.Number
}
/**
* @typedef {CommandInteractionOptionResolver} VSCodePleaseStopRemovingMyImports
* @internal
*/
/* eslint-disable func-names, @typescript-eslint/no-unused-vars */
import { ApplicationCommandType, type ContextMenuCommandInteraction, type Snowflake } from "discord.js";
import { type ContextMenuInteraction, type Snowflake } from "discord.js";
import { AkairoError } from "../../util/AkairoError.js";

@@ -37,3 +37,3 @@ import type { Category } from "../../util/Category.js";

*/
public declare type: ApplicationCommandType.User | ApplicationCommandType.Message;
public declare type: "USER" | "MESSAGE";

@@ -72,4 +72,3 @@ /**

if (ownerOnly !== undefined && typeof ownerOnly !== "boolean") throw new TypeError("options.ownerOnly must be a boolean");
if (type !== ApplicationCommandType.User && type !== ApplicationCommandType.Message)
throw new TypeError("options.type must be either ApplicationCommandType.User or ApplicationCommandType.Message.");
if (type !== "USER" && type !== "MESSAGE") throw new TypeError("options.type must be either 'USER' or 'MESSAGE'.");

@@ -89,3 +88,3 @@ super(id, { category });

*/
public exec(interaction: ContextMenuCommandInteraction): any {
public exec(interaction: ContextMenuInteraction): any {
throw new AkairoError("NOT_IMPLEMENTED", this.constructor.name, "exec");

@@ -134,3 +133,3 @@ }

*/
type: ApplicationCommandType.User | ApplicationCommandType.Message;
type: "USER" | "MESSAGE";
}

@@ -1,2 +0,2 @@

import type { Awaitable, Collection, ContextMenuCommandInteraction } from "discord.js";
import type { Awaitable, Collection, ContextMenuInteraction } from "discord.js";
import type { ContextMenuCommandHandlerEvents } from "../../typings/events";

@@ -80,3 +80,3 @@ import { AkairoError } from "../../util/AkairoError.js";

this.client.on("interactionCreate", i => {
if (!i.isUserContextMenuCommand()) return;
if (!i.isUserContextMenu()) return;

@@ -92,3 +92,3 @@ this.handle(i);

*/
public async handle(interaction: ContextMenuCommandInteraction): Promise<boolean | null> {
public async handle(interaction: ContextMenuInteraction): Promise<boolean | null> {
const command = this.modules.find(module => module.name === interaction.commandName);

@@ -125,3 +125,3 @@

*/
public emitError(err: Error, interaction: ContextMenuCommandInteraction, command: ContextMenuCommand | AkairoModule): void {
public emitError(err: Error, interaction: ContextMenuInteraction, command: ContextMenuCommand | AkairoModule): void {
if (this.listenerCount(ContextCommandHandlerEvents.ERROR)) {

@@ -128,0 +128,0 @@ this.emit(ContextCommandHandlerEvents.ERROR, err, interaction, command);

@@ -1,2 +0,2 @@

import type { ChatInputCommandInteraction, ClientEvents, ContextMenuCommandInteraction, Message } from "discord.js";
import type { ClientEvents, CommandInteraction, ContextMenuInteraction, Message } from "discord.js";
import type { AkairoModule } from "../struct/AkairoModule.js";

@@ -178,3 +178,3 @@ import type { Command } from "../struct/commands/Command.js";

*/
slashNotFound: [interaction: ChatInputCommandInteraction];
slashNotFound: [interaction: CommandInteraction];

@@ -262,3 +262,3 @@ /**

*/
error: [error: Error, interaction: ContextMenuCommandInteraction, command: ContextMenuCommand];
error: [error: Error, interaction: ContextMenuInteraction, command: ContextMenuCommand];

@@ -271,3 +271,3 @@ /**

*/
finished: [interaction: ContextMenuCommandInteraction, command: ContextMenuCommand, returnValue: any];
finished: [interaction: ContextMenuInteraction, command: ContextMenuCommand, returnValue: any];

@@ -278,3 +278,3 @@ /**

*/
notFound: [interaction: ContextMenuCommandInteraction];
notFound: [interaction: ContextMenuInteraction];

@@ -287,3 +287,3 @@ /**

*/
started: [interaction: ContextMenuCommandInteraction, command: ContextMenuCommand];
started: [interaction: ContextMenuInteraction, command: ContextMenuCommand];

@@ -297,3 +297,3 @@ /**

blocked: [
interaction: ContextMenuCommandInteraction,
interaction: ContextMenuInteraction,
command: Command,

@@ -300,0 +300,0 @@ reason: typeof BuiltInReasons.OWNER | typeof BuiltInReasons.SUPER_USER

import type { APIInteractionGuildMember, APIMessage } from "discord-api-types/v9";
import {
Base,
ChatInputCommandInteraction,
CommandInteraction,
Guild,

@@ -61,3 +61,3 @@ GuildMember,

*/
public declare interaction: ChatInputCommandInteraction;
public declare interaction: CommandInteraction;

@@ -84,3 +84,3 @@ /**

*/
public constructor(client: AkairoClient, interaction: ChatInputCommandInteraction) {
public constructor(client: AkairoClient, interaction: CommandInteraction) {
super(client);

@@ -87,0 +87,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc