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.1640130180.3e8fb1a to 9.0.10-dev.1640400856.2c63321

4

dist/package.json
{
"name": "@notenoughupdates/discord-akairo",
"version": "9.0.10-dev.1640130180.3e8fb1a",
"version": "9.0.10-dev.1640400856.2c63321",
"description": "A highly customizable bot framework for Discord.js.",

@@ -30,2 +30,4 @@ "main": "./dist/src/index.js",

"lint": "yarn eslint ./src",
"test": "yarn build && cd ./test && yarn && yarn test && cd ../",
"test:all": "yarn lint && yarn test",
"format": "yarn prettier . --write",

@@ -32,0 +34,0 @@ "build": "yarn rimraf dist && yarn tsc",

@@ -23,3 +23,2 @@ import "source-map-support/register";

import type { AkairoClientEvents, AkairoHandlerEvents, CommandHandlerEvents, ContextMenuCommandHandlerEvents, InhibitorHandlerEvents, ListenerHandlerEvents, TaskHandlerEvents } from "./typings/events";
import type { GuildTextBasedChannels } from "./typings/guildTextBasedChannels";
import AkairoError from "./util/AkairoError";

@@ -43,3 +42,3 @@ import AkairoMessage from "./util/AkairoMessage";

export { AkairoClient, AkairoError, AkairoHandler, AkairoMessage, AkairoModule, Argument, ArgumentRunner, ArgumentRunnerState, Category, ClientUtil, Command, CommandHandler, CommandUtil, Constants, ContentParser, ContentParserResult, ContextMenuCommand, ContextMenuCommandHandler, Flag, Inhibitor, InhibitorHandler, Listener, ListenerHandler, PromptContentModifier, RegisterInteractionCommandError, Task, TaskHandler, TypeResolver, Util, version };
export type { AkairoApplicationCommandAutocompleteOption, AkairoApplicationCommandChannelOptionData, AkairoApplicationCommandChoicesData, AkairoApplicationCommandNonOptionsData, AkairoApplicationCommandNumericOptionData, AkairoApplicationCommandOptionData, AkairoApplicationCommandSubCommandData, AkairoApplicationCommandSubGroupData, AkairoClientEvents, AkairoHandlerEvents, AkairoHandlerOptions, AkairoModuleOptions, AkairoOptions, ArgumentGenerator, ArgumentMatch, ArgumentOptions, ArgumentPromptData, ArgumentPromptOptions, ArgumentType, ArgumentTypeCaster, BaseArgumentType, BeforeAction, CommandHandlerEvents, CommandHandlerOptions, CommandOptions, ContentParserOptions, ContextMenuCommandHandlerEvents, ContextMenuCommandOptions, CooldownData, DefaultArgumentOptions, DefaultValueSupplier, ExecutionPredicate, ExtractedFlags, FailureData, GuildTextBasedChannels, IgnoreCheckPredicate, InhibitorHandlerEvents, InhibitorOptions, InteractionArgs, KeySupplier, ListenerHandlerEvents, ListenerOptions, ListenerType, LoadPredicate, MentionPrefixPredicate, MissingPermissionSupplier, OtherwiseContentModifier, OtherwiseContentSupplier, ParsedComponentData, ParsedValuePredicate, PrefixSupplier, PromptContentSupplier, RegexSupplier, SlashOption, SlashPermissionsSupplier, SlashResolveTypes, StringData, TaskHandlerEvents, TaskOptions };
export type { AkairoApplicationCommandAutocompleteOption, AkairoApplicationCommandChannelOptionData, AkairoApplicationCommandChoicesData, AkairoApplicationCommandNonOptionsData, AkairoApplicationCommandNumericOptionData, AkairoApplicationCommandOptionData, AkairoApplicationCommandSubCommandData, AkairoApplicationCommandSubGroupData, AkairoClientEvents, AkairoHandlerEvents, AkairoHandlerOptions, AkairoModuleOptions, AkairoOptions, ArgumentGenerator, ArgumentMatch, ArgumentOptions, ArgumentPromptData, ArgumentPromptOptions, ArgumentType, ArgumentTypeCaster, BaseArgumentType, BeforeAction, CommandHandlerEvents, CommandHandlerOptions, CommandOptions, ContentParserOptions, ContextMenuCommandHandlerEvents, ContextMenuCommandOptions, CooldownData, DefaultArgumentOptions, DefaultValueSupplier, ExecutionPredicate, ExtractedFlags, FailureData, IgnoreCheckPredicate, InhibitorHandlerEvents, InhibitorOptions, InteractionArgs, KeySupplier, ListenerHandlerEvents, ListenerOptions, ListenerType, LoadPredicate, MentionPrefixPredicate, MissingPermissionSupplier, OtherwiseContentModifier, OtherwiseContentSupplier, ParsedComponentData, ParsedValuePredicate, PrefixSupplier, PromptContentSupplier, RegexSupplier, SlashOption, SlashPermissionsSupplier, SlashResolveTypes, StringData, TaskHandlerEvents, TaskOptions };
//# sourceMappingURL=index.d.ts.map

@@ -56,2 +56,3 @@ import { Awaitable, Client, ClientOptions, Snowflake, UserResolvable } from "discord.js";

* Discord ID of the client owner(s).
* @default []
*/

@@ -61,2 +62,3 @@ ownerID?: Snowflake | Snowflake[];

* Discord ID of the client superUsers(s).
* @default []
*/

@@ -63,0 +65,0 @@ superUserID?: Snowflake | Snowflake[];

@@ -50,3 +50,3 @@ /// <reference types="node" />

*/
constructor(client: AkairoClient, options?: AkairoHandlerOptions);
constructor(client: AkairoClient, options: AkairoHandlerOptions);
/**

@@ -118,2 +118,3 @@ * Deregisters a module.

* Whether or not to set each module's category to its parent directory name.
* @default false
*/

@@ -123,2 +124,3 @@ automateCategories?: boolean;

* Only classes that extends this class can be handled.
* @default AkairoModule
*/

@@ -129,6 +131,6 @@ classToHandle?: typeof AkairoModule;

*/
directory?: string;
directory: string;
/**
* File extensions to load.
* By default this is .js, .json, and .ts files.
* @default [".js", ".json", ".ts"]
*/

@@ -139,2 +141,3 @@ extensions?: string[] | Set<string>;

* Can be set individually for each handler by overriding the `loadAll` method.
* @default () => true
*/

@@ -141,0 +144,0 @@ loadFilter?: LoadPredicate;

@@ -53,3 +53,3 @@ import type Category from "../util/Category.js";

* Category ID for organization purposes.
* Defaults to `default`.
* @default "default"
*/

@@ -56,0 +56,0 @@ category?: string;

/// <reference types="node" />
import type { BaseGuildVoiceChannel, CategoryChannel, Collection, Emoji, Guild, GuildChannel, GuildEmoji, GuildMember, Invite, Message, MessageOptions, MessagePayload, NewsChannel, Role, StageChannel, StoreChannel, TextChannel, ThreadChannel, User, VoiceChannel } from "discord.js";
import type { BaseGuildVoiceChannel, CategoryChannel, Collection, Emoji, Guild, GuildBasedChannel, GuildChannel, GuildEmoji, GuildMember, Invite, Message, MessageOptions, MessagePayload, NewsChannel, Role, StageChannel, StoreChannel, TextChannel, ThreadChannel, User, VoiceChannel } from "discord.js";
import type { URL } from "url";
import { GuildTextBasedChannels } from "../../../typings/guildTextBasedChannels.js";
import type AkairoClient from "../../AkairoClient.js";

@@ -19,3 +18,3 @@ import ContextMenuCommand from "../../contextMenuCommands/ContextMenuCommand.js";

/** ```ts
* BaseArgumentType
* keyof BaseArgumentType
* ``` */

@@ -28,5 +27,5 @@ declare type KBAT = keyof BaseArgumentType;

/** ```ts
* KBAT | string
* ArgumentType
* ``` */
declare type AT = KBAT | string;
declare type AT = ArgumentType;
/** ```ts

@@ -141,3 +140,3 @@ * BaseArgumentType

static cast<T extends KBAT>(type: T, resolver: TypeResolver, message: Message, phrase: string): Promise<BAT[T]>;
static cast<T extends AT>(type: T, resolver: TypeResolver, message: Message, phrase: string): Promise<any>;
static cast(type: AT | ATC, resolver: TypeResolver, message: Message, phrase: string): Promise<any>;
/**

@@ -150,3 +149,3 @@ * Creates a type that is the left-to-right composition of the given types.

static compose<T extends KBAT>(...types: T[]): ATCBAT<T>;
static compose<T extends AT>(...types: T[]): ATC;
static compose(...types: (AT | ATC)[]): ATC;
/**

@@ -159,3 +158,3 @@ * Creates a type that is the left-to-right composition of the given types.

static composeWithFailure<T extends KBAT>(...types: T[]): ATCBAT<T>;
static composeWithFailure<T extends AT>(...types: T[]): ATC;
static composeWithFailure(...types: (AT | ATC)[]): ATC;
/**

@@ -175,3 +174,3 @@ * Checks if something is null, undefined, or a fail flag.

static product<T extends KBAT>(...types: T[]): ATCBAT<T>;
static product<T extends AT>(...types: T[]): ATC;
static product(...types: (AT | ATC)[]): ATC;
/**

@@ -186,3 +185,3 @@ * Creates a type where the parsed value must be within a range.

static range<T extends KBAT>(type: T, min: number, max: number, inclusive?: boolean): ATCBAT<T>;
static range<T extends AT>(type: T, min: number, max: number, inclusive?: boolean): ATC;
static range(type: AT | ATC, min: number, max: number, inclusive?: boolean): ATC;
/**

@@ -196,3 +195,3 @@ * Creates a type that parses as normal but also tags it with some data.

static tagged<T extends KBAT>(type: T, tag?: any): ATCBAT<T>;
static tagged<T extends AT>(type: T, tag?: any): ATC;
static tagged(type: AT | ATC, tag?: any): ATC;
/**

@@ -206,3 +205,3 @@ * Creates a type from multiple types (union type).

static taggedUnion<T extends KBAT>(...types: T[]): ATCBAT<T>;
static taggedUnion<T extends AT>(...types: T[]): ATC;
static taggedUnion(...types: (AT | ATC)[]): ATC;
/**

@@ -216,3 +215,3 @@ * Creates a type that parses as normal but also tags it with some data and carries the original input.

static taggedWithInput<T extends KBAT>(type: T, tag?: any): ATCBAT<T>;
static taggedWithInput<T extends AT>(type: T, tag?: any): ATC;
static taggedWithInput(type: AT | ATC, tag?: any): ATC;
/**

@@ -225,3 +224,3 @@ * Creates a type from multiple types (union type).

static union<T extends KBAT>(...types: T[]): ATCBAT<T>;
static union<T extends AT>(...types: T[]): ATC;
static union(...types: (AT | ATC)[]): ATC;
/**

@@ -235,3 +234,3 @@ * Creates a type with extra validation.

static validate<T extends KBAT>(type: T, predicate: ParsedValuePredicate): ATCBAT<T>;
static validate<T extends AT>(type: T, predicate: ParsedValuePredicate): ATC;
static validate(type: AT | ATC, predicate: ParsedValuePredicate): ATC;
/**

@@ -244,3 +243,3 @@ * Creates a type that parses as normal but also carries the original input.

static withInput<T extends KBAT>(type: T): ATCBAT<T>;
static withInput<T extends AT>(type: T): ATC;
static withInput(type: AT | ATC): ATC;
}

@@ -276,3 +275,3 @@ /**

* Applicable to text, content, rest, or separate match only.
* Defaults to infinity.
* @default Infinity.
*/

@@ -282,2 +281,3 @@ limit?: number;

* Method to match text. Defaults to 'phrase'.
* @default ArgumentMatches.PHRASE
*/

@@ -293,2 +293,3 @@ match?: ArgumentMatch;

* For flags, this will count the number of occurrences.
* @default false
*/

@@ -306,2 +307,3 @@ multipleFlags?: boolean;

* Type to cast to.
* @default ArgumentTypes.STRING
*/

@@ -317,2 +319,3 @@ type?: ArgumentType | ArgumentTypeCaster;

* Applicable to phrase match only.
* @default false
*/

@@ -518,18 +521,18 @@ unordered?: boolean | number | number[];

relevants: Collection<string, User> | Collection<string, GuildMember> | null;
channel: GuildTextBasedChannels | BaseGuildVoiceChannel | null;
channels: Collection<string, GuildTextBasedChannels | BaseGuildVoiceChannel> | null;
channel: GuildBasedChannel | BaseGuildVoiceChannel | null;
channels: Collection<string, GuildBasedChannel | BaseGuildVoiceChannel> | null;
textChannel: TextChannel | null;
textChannels: Collection<string, TextChannel>;
voiceChannel: VoiceChannel;
voiceChannels: Collection<string, VoiceChannel>;
categoryChannel: CategoryChannel;
categoryChannels: Collection<string, CategoryChannel>;
newsChannel: NewsChannel;
newsChannels: Collection<string, NewsChannel>;
storeChannel: StoreChannel;
storeChannels: Collection<string, StoreChannel>;
stageChannel: StageChannel;
stageChannels: Collection<string, StageChannel>;
threadChannel: ThreadChannel;
threadChannels: Collection<string, ThreadChannel>;
textChannels: Collection<string, TextChannel> | null;
voiceChannel: VoiceChannel | null;
voiceChannels: Collection<string, VoiceChannel> | null;
categoryChannel: CategoryChannel | null;
categoryChannels: Collection<string, CategoryChannel> | null;
newsChannel: NewsChannel | null;
newsChannels: Collection<string, NewsChannel> | null;
storeChannel: StoreChannel | null;
storeChannels: Collection<string, StoreChannel> | null;
stageChannel: StageChannel | null;
stageChannels: Collection<string, StageChannel> | null;
threadChannel: ThreadChannel | null;
threadChannels: Collection<string, ThreadChannel> | null;
role: Role | null;

@@ -580,3 +583,3 @@ roles: Collection<string, Role> | null;

*/
declare type ArgumentTypeCasterReturn<R> = R extends ArgumentTypeCaster<infer S> ? S : R;
export declare type ArgumentTypeCasterReturn<R> = R extends ArgumentTypeCaster<infer S> ? S : R;
/**

@@ -586,5 +589,9 @@ * Data passed to functions that run when things failed.

export interface FailureData {
/** The input phrase that failed if there was one, otherwise an empty string. */
/**
* The input phrase that failed if there was one, otherwise an empty string.
*/
phrase: string;
/** The value that failed if there was one, otherwise null. */
/**
* The value that failed if there was one, otherwise null.
*/
failure: void | (Flag & {

@@ -591,0 +598,0 @@ value: any;

@@ -41,3 +41,3 @@ import { Collection } from "discord.js";

*/
types: Collection<string, ArgumentTypeCaster>;
types: Collection<keyof BaseArgumentType | string, ArgumentTypeCaster>;
/**

@@ -55,3 +55,3 @@ * @param handler - The command handler.

*/
type(name: keyof BaseArgumentType): ArgumentTypeCaster;
type<T extends keyof BaseArgumentType>(name: T): ArgumentTypeCaster<BaseArgumentType[T]>;
type(name: string): ArgumentTypeCaster | undefined;

@@ -58,0 +58,0 @@ /**

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

return null;
const n = phrase.replace(/0⃣|1⃣|2⃣|3⃣|4⃣|5⃣|6⃣|7⃣|8⃣|9⃣|🔟/g, (m) => {
return ["0⃣", "1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣", "🔟"].indexOf(m);
const n = phrase.replace(/0⃣|1⃣|2⃣|3⃣|4⃣|5⃣|6⃣|7⃣|8⃣|9⃣|🔟/g, m => {
return ["0⃣", "1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣", "🔟"].indexOf(m).toString();
});

@@ -261,3 +261,2 @@ if (isNaN(n))

return null;
// eslint-disable-next-line deprecation/deprecation
return channel;

@@ -264,0 +263,0 @@ },

@@ -100,5 +100,3 @@ "use strict";

execSlash(message, ...args) {
if (this.slash) {
throw new AkairoError_js_1.default("NOT_IMPLEMENTED", this.constructor.name, "execSlash");
}
throw new AkairoError_js_1.default("NOT_IMPLEMENTED", this.constructor.name, "execSlash");
}

@@ -105,0 +103,0 @@ /**

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

@@ -163,3 +163,3 @@ import AkairoMessage from "../../util/AkairoMessage.js";

*/
constructor(client: AkairoClient, options?: CommandHandlerOptions);
constructor(client: AkairoClient, options: CommandHandlerOptions);
/**

@@ -305,3 +305,3 @@ * Set up the command handler

*/
addPrompt(channel: TextBasedChannels, user: User): void;
addPrompt(channel: TextBasedChannel, user: User): void;
/**

@@ -312,3 +312,3 @@ * Removes an ongoing prompt.

*/
removePrompt(channel: TextBasedChannels, user: User): void;
removePrompt(channel: TextBasedChannel, user: User): void;
/**

@@ -319,3 +319,3 @@ * Checks if there is an ongoing prompt.

*/
hasPrompt(channel: TextBasedChannels, user: User): boolean;
hasPrompt(channel: TextBasedChannel, user: User): boolean;
/**

@@ -408,2 +408,3 @@ * Finds a command by alias.

* Default argument options.
* @default {}
*/

@@ -417,2 +418,3 @@ argumentDefaults?: DefaultArgumentOptions;

* Specify whether to register all slash commands when starting the client.
* @default false
*/

@@ -422,2 +424,3 @@ autoRegisterSlashCommands?: boolean;

* Whether or not to block bots.
* @default true
*/

@@ -427,2 +430,3 @@ blockBots?: boolean;

* Whether or not to block self.
* @default true
*/

@@ -436,3 +440,4 @@ blockClient?: boolean;

* Milliseconds a message should exist for before its command util instance is marked for removal.
* If 0, CommandUtil instances will never be removed and will cause memory to increase indefinitely.
* If `0`, CommandUtil instances will never be removed and will cause memory to increase indefinitely.
* @default 300_000 // 5 minutes
*/

@@ -442,3 +447,4 @@ commandUtilLifetime?: number;

* Time interval in milliseconds for sweeping command util instances.
* If 0, CommandUtil instances will never be removed and will cause memory to increase indefinitely.
* If `0`, CommandUtil instances will never be removed and will cause memory to increase indefinitely.
* @default 300_000 // 5 minutes
*/

@@ -448,2 +454,3 @@ commandUtilSweepInterval?: number;

* Default cooldown for commands.
* @default 0
*/

@@ -453,2 +460,3 @@ defaultCooldown?: number;

* Whether or not members are fetched on each message author from a guild.
* @default false
*/

@@ -458,2 +466,3 @@ fetchMembers?: boolean;

* Whether or not to handle edited messages using CommandUtil.
* @default false
*/

@@ -463,2 +472,3 @@ handleEdits?: boolean;

* ID of user(s) to ignore cooldown or a function to ignore. Defaults to the client owner(s).
* @default client.ownerID
*/

@@ -468,2 +478,3 @@ ignoreCooldown?: Snowflake | Snowflake[] | IgnoreCheckPredicate;

* ID of user(s) to ignore `userPermissions` checks or a function to ignore.
* @default []
*/

@@ -473,2 +484,3 @@ ignorePermissions?: Snowflake | Snowflake[] | IgnoreCheckPredicate;

* The prefix(es) for command parsing.
* @default "!"
*/

@@ -478,2 +490,3 @@ prefix?: string | string[] | PrefixSupplier;

* Whether or not to store messages in CommandUtil.
* @default false
*/

@@ -483,2 +496,3 @@ storeMessages?: boolean;

* Show "BotName is typing" information message on the text channels when a command is running.
* @default false
*/

@@ -488,2 +502,3 @@ typing?: boolean;

* Whether or not to require the use of execSlash for slash commands.
* @default false
*/

@@ -493,2 +508,3 @@ execSlash?: boolean;

* Whether or not to skip built in reasons post type inhibitors so you can make custom ones.
* @default false
*/

@@ -500,2 +516,3 @@ skipBuiltInPostInhibitors?: boolean;

* Warning: this is experimental
* @default false
*/

@@ -502,0 +519,0 @@ useSlashPermissions?: boolean;

@@ -43,2 +43,3 @@ import type { ArgumentOptions } from "./arguments/Argument.js";

* Words considered flags.
* @default []
*/

@@ -48,6 +49,8 @@ flagWords?: string[];

* Words considered option flags.
* @default []
*/
optionFlagWords?: string[];
/**
* Whether to parse quotes. Defaults to `true`.
* Whether to parse quotes.
* @default true
*/

@@ -54,0 +57,0 @@ quoted?: boolean;

@@ -57,3 +57,4 @@ "use strict";

class Tokenizer {
constructor(content, { flagWords = [], optionFlagWords = [], quoted = true, separator } = {}) {
constructor(content, options) {
const { flagWords = [], optionFlagWords = [], quoted = true, separator } = options ?? {};
this.content = content;

@@ -60,0 +61,0 @@ this.flagWords = flagWords;

@@ -41,3 +41,3 @@ import type { Awaitable, Collection, ContextMenuInteraction } from "discord.js";

*/
constructor(client: AkairoClient, options?: AkairoHandlerOptions);
constructor(client: AkairoClient, options: AkairoHandlerOptions);
/**

@@ -44,0 +44,0 @@ * Set up the context menu command handler

@@ -76,2 +76,3 @@ import type { Message } from "discord.js";

* Reason emitted when command or message is blocked.
* @default ""
*/

@@ -81,3 +82,3 @@ reason?: string;

* Can be 'all' to run on all messages, 'pre' to run on messages not blocked by the built-in inhibitors, or 'post' to run on messages that are commands.
* Defaults to `post`
* @default "post"
*/

@@ -88,3 +89,3 @@ type?: "all" | "pre" | "post";

* The inhibitor with the highest priority is the one that is used for the block reason.
* Defaults to `0`
* @default 0
*/

@@ -91,0 +92,0 @@ priority?: number;

@@ -37,3 +37,3 @@ import type { Awaitable, Collection, Message } from "discord.js";

*/
constructor(client: AkairoClient, options?: AkairoHandlerOptions);
constructor(client: AkairoClient, options: AkairoHandlerOptions);
/**

@@ -40,0 +40,0 @@ * Tests inhibitors against the message.

@@ -74,3 +74,3 @@ /// <reference types="node" />

* Type of listener, either 'on' or 'once'.
* Defaults to `on`
* @default "on"
*/

@@ -77,0 +77,0 @@ type?: ListenerType;

@@ -42,3 +42,3 @@ /// <reference types="node" />

*/
constructor(client: AkairoClient, options?: AkairoHandlerOptions);
constructor(client: AkairoClient, options: AkairoHandlerOptions);
/**

@@ -45,0 +45,0 @@ * Adds a listener to the EventEmitter.

@@ -68,2 +68,3 @@ import type Category from "../../util/Category.js";

* Whether or not the task runs on start.
* @default false
*/

@@ -70,0 +71,0 @@ runOnStart?: boolean;

@@ -35,3 +35,3 @@ import type { Awaitable, Collection } from "discord.js";

*/
constructor(client: AkairoClient, options?: AkairoHandlerOptions);
constructor(client: AkairoClient, options: AkairoHandlerOptions);
/**

@@ -38,0 +38,0 @@ * Start all tasks.

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

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

*/
get channel(): TextBasedChannels | null;
get channel(): TextBasedChannel | null;
/**

@@ -65,0 +65,0 @@ * The message contents with all mentions replaced by the equivalent text.

{
"name": "@notenoughupdates/discord-akairo",
"version": "9.0.10-dev.1640130180.3e8fb1a",
"version": "9.0.10-dev.1640400856.2c63321",
"description": "A highly customizable bot framework for Discord.js.",

@@ -30,2 +30,4 @@ "main": "./dist/src/index.js",

"lint": "yarn eslint ./src",
"test": "yarn build && cd ./test && yarn && yarn test && cd ../",
"test:all": "yarn lint && yarn test",
"format": "yarn prettier . --write",

@@ -32,0 +34,0 @@ "build": "yarn rimraf dist && yarn tsc",

@@ -81,3 +81,2 @@ import "source-map-support/register";

} from "./typings/events";
import type { GuildTextBasedChannels } from "./typings/guildTextBasedChannels";
import AkairoError from "./util/AkairoError";

@@ -171,3 +170,2 @@ import AkairoMessage from "./util/AkairoMessage";

FailureData,
GuildTextBasedChannels,
IgnoreCheckPredicate,

@@ -174,0 +172,0 @@ InhibitorHandlerEvents,

@@ -86,2 +86,3 @@ import { Awaitable, Client, ClientOptions, Snowflake, UserResolvable } from "discord.js";

* Discord ID of the client owner(s).
* @default []
*/

@@ -92,4 +93,5 @@ ownerID?: Snowflake | Snowflake[];

* Discord ID of the client superUsers(s).
* @default []
*/
superUserID?: Snowflake | Snowflake[];
}

@@ -62,3 +62,3 @@ import { Collection } from "discord.js";

*/
public constructor(client: AkairoClient, options?: AkairoHandlerOptions) {
public constructor(client: AkairoClient, options: AkairoHandlerOptions) {
const {

@@ -74,3 +74,3 @@ directory,

this.client = client;
this.directory = directory!;
this.directory = directory;
this.classToHandle = classToHandle;

@@ -274,2 +274,3 @@ this.extensions = new Set(extensions);

* Whether or not to set each module's category to its parent directory name.
* @default false
*/

@@ -280,2 +281,3 @@ automateCategories?: boolean;

* Only classes that extends this class can be handled.
* @default AkairoModule
*/

@@ -287,7 +289,7 @@ classToHandle?: typeof AkairoModule;

*/
directory?: string;
directory: string;
/**
* File extensions to load.
* By default this is .js, .json, and .ts files.
* @default [".js", ".json", ".ts"]
*/

@@ -299,4 +301,5 @@ extensions?: string[] | Set<string>;

* Can be set individually for each handler by overriding the `loadAll` method.
* @default () => true
*/
loadFilter?: LoadPredicate;
}

@@ -79,5 +79,5 @@ import type Category from "../util/Category.js";

* Category ID for organization purposes.
* Defaults to `default`.
* @default "default"
*/
category?: string;
}

@@ -7,2 +7,3 @@ import type {

Guild,
GuildBasedChannel,
GuildChannel,

@@ -25,3 +26,2 @@ GuildEmoji,

import type { URL } from "url";
import { GuildTextBasedChannels } from "../../../typings/guildTextBasedChannels.js";
import { ArgumentMatches, ArgumentTypes } from "../../../util/Constants.js";

@@ -44,3 +44,3 @@ import Util from "../../../util/Util.js";

/** ```ts
* BaseArgumentType
* keyof BaseArgumentType
* ``` */

@@ -53,5 +53,5 @@ type KBAT = keyof BaseArgumentType;

/** ```ts
* KBAT | string
* ArgumentType
* ``` */
type AT = KBAT | string;
type AT = ArgumentType;
/** ```ts

@@ -440,3 +440,3 @@ * BaseArgumentType

public static cast<T extends KBAT>(type: T, resolver: TypeResolver, message: Message, phrase: string): Promise<BAT[T]>;
public static cast<T extends AT>(type: T, resolver: TypeResolver, message: Message, phrase: string): Promise<any>;
public static cast(type: AT | ATC, resolver: TypeResolver, message: Message, phrase: string): Promise<any>;
public static async cast(type: ATC | AT, resolver: TypeResolver, message: Message, phrase: string): Promise<any> {

@@ -480,4 +480,4 @@ if (Array.isArray(type)) {

if (resolver.type(type)) {
let res = resolver.type(type)?.call(this, message, phrase);
if (resolver.type(type as any)) {
let res = resolver.type(type as any)?.call(this, message, phrase);
if (Util.isPromise(res)) res = await res;

@@ -497,3 +497,3 @@ return res;

public static compose<T extends KBAT>(...types: T[]): ATCBAT<T>;
public static compose<T extends AT>(...types: T[]): ATC;
public static compose(...types: (AT | ATC)[]): ATC;
public static compose(...types: (AT | ATC)[]): ATC {

@@ -519,3 +519,3 @@ return async function typeFn(this: any, message, phrase) {

public static composeWithFailure<T extends KBAT>(...types: T[]): ATCBAT<T>;
public static composeWithFailure<T extends AT>(...types: T[]): ATC;
public static composeWithFailure(...types: (AT | ATC)[]): ATC;
public static composeWithFailure(...types: (AT | ATC)[]): ATC {

@@ -548,3 +548,3 @@ return async function typeFn(this: any, message, phrase) {

public static product<T extends KBAT>(...types: T[]): ATCBAT<T>;
public static product<T extends AT>(...types: T[]): ATC;
public static product(...types: (AT | ATC)[]): ATC;
public static product(...types: (AT | ATC)[]): ATC {

@@ -573,3 +573,3 @@ return async function typeFn(this: any, message, phrase) {

public static range<T extends KBAT>(type: T, min: number, max: number, inclusive?: boolean): ATCBAT<T>;
public static range<T extends AT>(type: T, min: number, max: number, inclusive?: boolean): ATC;
public static range(type: AT | ATC, min: number, max: number, inclusive?: boolean): ATC;
public static range(type: AT | ATC, min: number, max: number, inclusive = false): ATC {

@@ -591,3 +591,3 @@ return Argument.validate(type as any, (msg, p, x) => {

public static tagged<T extends KBAT>(type: T, tag?: any): ATCBAT<T>;
public static tagged<T extends AT>(type: T, tag?: any): ATC;
public static tagged(type: AT | ATC, tag?: any): ATC;
public static tagged(type: AT | ATC, tag: any = type): ATC {

@@ -613,3 +613,3 @@ return async function typeFn(this: any, message, phrase) {

public static taggedUnion<T extends KBAT>(...types: T[]): ATCBAT<T>;
public static taggedUnion<T extends AT>(...types: T[]): ATC;
public static taggedUnion(...types: (AT | ATC)[]): ATC;
public static taggedUnion(...types: (AT | ATC)[]): ATC {

@@ -635,3 +635,3 @@ return async function typeFn(this: any, message, phrase) {

public static taggedWithInput<T extends KBAT>(type: T, tag?: any): ATCBAT<T>;
public static taggedWithInput<T extends AT>(type: T, tag?: any): ATC;
public static taggedWithInput(type: AT | ATC, tag?: any): ATC;
public static taggedWithInput(type: AT | ATC, tag: any = type): ATC {

@@ -656,3 +656,3 @@ return async function typeFn(this: any, message, phrase) {

public static union<T extends KBAT>(...types: T[]): ATCBAT<T>;
public static union<T extends AT>(...types: T[]): ATC;
public static union(...types: (AT | ATC)[]): ATC;
public static union(...types: (AT | ATC)[]): ATC {

@@ -678,3 +678,3 @@ return async function typeFn(this: any, message, phrase) {

public static validate<T extends KBAT>(type: T, predicate: ParsedValuePredicate): ATCBAT<T>;
public static validate<T extends AT>(type: T, predicate: ParsedValuePredicate): ATC;
public static validate(type: AT | ATC, predicate: ParsedValuePredicate): ATC;
public static validate(type: AT | ATC, predicate: ParsedValuePredicate): ATC {

@@ -697,3 +697,3 @@ return async function typeFn(this: any, message, phrase) {

public static withInput<T extends KBAT>(type: T): ATCBAT<T>;
public static withInput<T extends AT>(type: T): ATC;
public static withInput(type: AT | ATC): ATC;
public static withInput(type: AT | ATC): ATC {

@@ -746,3 +746,3 @@ return async function typeFn(this: any, message, phrase) {

* Applicable to text, content, rest, or separate match only.
* Defaults to infinity.
* @default Infinity.
*/

@@ -753,2 +753,3 @@ limit?: number;

* Method to match text. Defaults to 'phrase'.
* @default ArgumentMatches.PHRASE
*/

@@ -766,2 +767,3 @@ match?: ArgumentMatch;

* For flags, this will count the number of occurrences.
* @default false
*/

@@ -782,2 +784,3 @@ multipleFlags?: boolean;

* Type to cast to.
* @default ArgumentTypes.STRING
*/

@@ -794,2 +797,3 @@ type?: ArgumentType | ArgumentTypeCaster;

* Applicable to phrase match only.
* @default false
*/

@@ -1018,20 +1022,20 @@ unordered?: boolean | number | number[];

relevants: Collection<string, User> | Collection<string, GuildMember> | null;
channel: GuildTextBasedChannels | BaseGuildVoiceChannel | null;
channels: Collection<string, GuildTextBasedChannels | BaseGuildVoiceChannel> | null;
channel: GuildBasedChannel | BaseGuildVoiceChannel | null;
channels: Collection<string, GuildBasedChannel | BaseGuildVoiceChannel> | null;
textChannel: TextChannel | null;
textChannels: Collection<string, TextChannel>;
voiceChannel: VoiceChannel;
voiceChannels: Collection<string, VoiceChannel>;
categoryChannel: CategoryChannel;
categoryChannels: Collection<string, CategoryChannel>;
newsChannel: NewsChannel;
newsChannels: Collection<string, NewsChannel>;
textChannels: Collection<string, TextChannel> | null;
voiceChannel: VoiceChannel | null;
voiceChannels: Collection<string, VoiceChannel> | null;
categoryChannel: CategoryChannel | null;
categoryChannels: Collection<string, CategoryChannel> | null;
newsChannel: NewsChannel | null;
newsChannels: Collection<string, NewsChannel> | null;
// eslint-disable-next-line deprecation/deprecation
storeChannel: StoreChannel;
storeChannel: StoreChannel | null;
// eslint-disable-next-line deprecation/deprecation
storeChannels: Collection<string, StoreChannel>;
stageChannel: StageChannel;
stageChannels: Collection<string, StageChannel>;
threadChannel: ThreadChannel;
threadChannels: Collection<string, ThreadChannel>;
storeChannels: Collection<string, StoreChannel> | null;
stageChannel: StageChannel | null;
stageChannels: Collection<string, StageChannel> | null;
threadChannel: ThreadChannel | null;
threadChannels: Collection<string, ThreadChannel> | null;
role: Role | null;

@@ -1085,3 +1089,3 @@ roles: Collection<string, Role> | null;

*/
type ArgumentTypeCasterReturn<R> = R extends ArgumentTypeCaster<infer S> ? S : R;
export type ArgumentTypeCasterReturn<R> = R extends ArgumentTypeCaster<infer S> ? S : R;

@@ -1092,6 +1096,10 @@ /**

export interface FailureData {
/** The input phrase that failed if there was one, otherwise an empty string. */
/**
* The input phrase that failed if there was one, otherwise an empty string.
*/
phrase: string;
/** The value that failed if there was one, otherwise null. */
/**
* The value that failed if there was one, otherwise null.
*/
failure: void | (Flag & { value: any });

@@ -1098,0 +1106,0 @@ }

@@ -62,3 +62,3 @@ import {

*/
public declare types: Collection<string, ArgumentTypeCaster>;
public declare types: Collection<keyof BaseArgumentType | string, ArgumentTypeCaster>;

@@ -83,16 +83,18 @@ /**

public addBuiltInTypes(): void {
const builtIns = {
[ArgumentTypes.STRING]: (_message: Message, phrase: string) => {
const builtIns: {
[K in keyof BaseArgumentType]: (message: Message, phrase: string) => BaseArgumentType[K] | Promise<BaseArgumentType[K]>;
} = {
[ArgumentTypes.STRING]: (_message, phrase) => {
return phrase || null;
},
[ArgumentTypes.LOWERCASE]: (_message: Message, phrase: string) => {
[ArgumentTypes.LOWERCASE]: (_message, phrase) => {
return phrase ? phrase.toLowerCase() : null;
},
[ArgumentTypes.UPPERCASE]: (_message: Message, phrase: string) => {
[ArgumentTypes.UPPERCASE]: (_message, phrase) => {
return phrase ? phrase.toUpperCase() : null;
},
[ArgumentTypes.CHAR_CODES]: (_message: Message, phrase: string) => {
[ArgumentTypes.CHAR_CODES]: (_message, phrase) => {
if (!phrase) return null;

@@ -104,3 +106,3 @@ const codes = [];

[ArgumentTypes.NUMBER]: (_message: Message, phrase: string) => {
[ArgumentTypes.NUMBER]: (_message, phrase) => {
if (!phrase || isNaN(+phrase)) return null;

@@ -110,3 +112,3 @@ return parseFloat(phrase);

[ArgumentTypes.INTEGER]: (_message: Message, phrase: string) => {
[ArgumentTypes.INTEGER]: (_message, phrase) => {
if (!phrase || isNaN(+phrase)) return null;

@@ -116,3 +118,3 @@ return parseInt(phrase);

[ArgumentTypes.BIGINT]: (_message: Message, phrase: string) => {
[ArgumentTypes.BIGINT]: (_message, phrase) => {
if (!phrase || isNaN(+phrase)) return null;

@@ -123,13 +125,13 @@ return BigInt(phrase);

// Just for fun.
[ArgumentTypes.EMOJINT]: (_message: Message, phrase: any) => {
[ArgumentTypes.EMOJINT]: (_message, phrase) => {
if (!phrase) return null;
const n = phrase.replace(/0⃣|1⃣|2⃣|3⃣|4⃣|5⃣|6⃣|7⃣|8⃣|9⃣|🔟/g, (m: string) => {
return ["0⃣", "1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣", "🔟"].indexOf(m);
const n = phrase.replace(/0⃣|1⃣|2⃣|3⃣|4⃣|5⃣|6⃣|7⃣|8⃣|9⃣|🔟/g, m => {
return ["0⃣", "1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣", "🔟"].indexOf(m).toString();
});
if (isNaN(n)) return null;
if (isNaN(n as any)) return null;
return parseInt(n);
},
[ArgumentTypes.URL]: (_message: Message, phrase: string) => {
[ArgumentTypes.URL]: (_message, phrase) => {
if (!phrase) return null;

@@ -145,3 +147,3 @@ if (/^<.+>$/.test(phrase)) phrase = phrase.slice(1, -1);

[ArgumentTypes.DATE]: (_message: Message, phrase: string) => {
[ArgumentTypes.DATE]: (_message, phrase) => {
if (!phrase) return null;

@@ -153,3 +155,3 @@ const timestamp = Date.parse(phrase);

[ArgumentTypes.COLOR]: (_message: Message, phrase: string) => {
[ArgumentTypes.COLOR]: (_message, phrase) => {
if (!phrase) return null;

@@ -165,3 +167,3 @@

[ArgumentTypes.USER]: (_message: Message, phrase: string) => {
[ArgumentTypes.USER]: (_message, phrase) => {
if (!phrase) return null;

@@ -171,3 +173,3 @@ return this.client.util.resolveUser(phrase, this.client.users.cache);

[ArgumentTypes.USERS]: (_message: Message, phrase: string) => {
[ArgumentTypes.USERS]: (_message, phrase) => {
if (!phrase) return null;

@@ -178,3 +180,3 @@ const users = this.client.util.resolveUsers(phrase, this.client.users.cache);

[ArgumentTypes.MEMBER]: (message: Message, phrase: string) => {
[ArgumentTypes.MEMBER]: (message, phrase) => {
if (!phrase) return null;

@@ -185,3 +187,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.MEMBERS]: (message: Message, phrase: string) => {
[ArgumentTypes.MEMBERS]: (message, phrase) => {
if (!phrase) return null;

@@ -193,3 +195,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.RELEVANT]: (message: Message, phrase: string) => {
[ArgumentTypes.RELEVANT]: (message, phrase) => {
if (!phrase) return null;

@@ -211,3 +213,3 @@

[ArgumentTypes.RELEVANTS]: (message: Message, phrase: string) => {
[ArgumentTypes.RELEVANTS]: (message, phrase) => {
if (!phrase) return null;

@@ -228,3 +230,3 @@ const persons = message.inGuild()

[ArgumentTypes.CHANNEL]: (message: Message, phrase: string) => {
[ArgumentTypes.CHANNEL]: (message, phrase) => {
if (!phrase) return null;

@@ -235,3 +237,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.CHANNELS]: (message: Message, phrase: string) => {
[ArgumentTypes.CHANNELS]: (message, phrase) => {
if (!phrase) return null;

@@ -243,3 +245,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.TEXT_CHANNEL]: (message: Message, phrase: string) => {
[ArgumentTypes.TEXT_CHANNEL]: (message, phrase) => {
if (!phrase) return null;

@@ -250,6 +252,6 @@ if (!message.inGuild()) return null;

return channel as TextChannel;
return channel;
},
[ArgumentTypes.TEXT_CHANNELS]: (message: Message, phrase: string) => {
[ArgumentTypes.TEXT_CHANNELS]: (message, phrase) => {
if (!phrase) return null;

@@ -264,3 +266,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.VOICE_CHANNEL]: (message: Message, phrase: string) => {
[ArgumentTypes.VOICE_CHANNEL]: (message, phrase) => {
if (!phrase) return null;

@@ -270,6 +272,6 @@ if (!message.inGuild()) return null;

if (!channel || channel.type !== "GUILD_VOICE") return null;
return channel as VoiceChannel;
return channel;
},
[ArgumentTypes.VOICE_CHANNELS]: (message: Message, phrase: string) => {
[ArgumentTypes.VOICE_CHANNELS]: (message, phrase) => {
if (!phrase) return null;

@@ -284,3 +286,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.CATEGORY_CHANNEL]: (message: Message, phrase: string) => {
[ArgumentTypes.CATEGORY_CHANNEL]: (message, phrase) => {
if (!phrase) return null;

@@ -291,6 +293,6 @@ if (!message.inGuild()) return null;

return channel as CategoryChannel;
return channel;
},
[ArgumentTypes.CATEGORY_CHANNELS]: (message: Message, phrase: string) => {
[ArgumentTypes.CATEGORY_CHANNELS]: (message, phrase) => {
if (!phrase) return null;

@@ -305,3 +307,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.NEWS_CHANNEL]: (message: Message, phrase: string) => {
[ArgumentTypes.NEWS_CHANNEL]: (message, phrase) => {
if (!phrase) return null;

@@ -312,6 +314,6 @@ if (!message.inGuild()) return null;

return channel as NewsChannel;
return channel;
},
[ArgumentTypes.NEWS_CHANNELS]: (message: Message, phrase: string) => {
[ArgumentTypes.NEWS_CHANNELS]: (message, phrase) => {
if (!phrase) return null;

@@ -326,3 +328,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.STORE_CHANNEL]: (message: Message, phrase: string) => {
[ArgumentTypes.STORE_CHANNEL]: (message, phrase) => {
if (!phrase) return null;

@@ -333,7 +335,6 @@ if (!message.inGuild()) return null;

// eslint-disable-next-line deprecation/deprecation
return channel as StoreChannel;
return channel;
},
[ArgumentTypes.STORE_CHANNELS]: (message: Message, phrase: string) => {
[ArgumentTypes.STORE_CHANNELS]: (message, phrase) => {
if (!phrase) return null;

@@ -349,3 +350,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.STAGE_CHANNEL]: (message: Message, phrase: string) => {
[ArgumentTypes.STAGE_CHANNEL]: (message, phrase) => {
if (!phrase) return null;

@@ -356,6 +357,6 @@ if (!message.inGuild()) return null;

return channel as StageChannel;
return channel;
},
[ArgumentTypes.STAGE_CHANNELS]: (message: Message, phrase: string) => {
[ArgumentTypes.STAGE_CHANNELS]: (message, phrase) => {
if (!phrase) return null;

@@ -370,3 +371,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.THREAD_CHANNEL]: (message: Message, phrase: string) => {
[ArgumentTypes.THREAD_CHANNEL]: (message, phrase) => {
if (!phrase) return null;

@@ -377,6 +378,6 @@ if (!message.inGuild()) return null;

return channel as ThreadChannel;
return channel;
},
[ArgumentTypes.THREAD_CHANNELS]: (message: Message, phrase: string) => {
[ArgumentTypes.THREAD_CHANNELS]: (message, phrase) => {
if (!phrase) return null;

@@ -391,3 +392,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.ROLE]: (message: Message, phrase: string) => {
[ArgumentTypes.ROLE]: (message, phrase) => {
if (!phrase) return null;

@@ -398,3 +399,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.ROLES]: (message: Message, phrase: string) => {
[ArgumentTypes.ROLES]: (message, phrase) => {
if (!phrase) return null;

@@ -406,3 +407,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.EMOJI]: (message: Message, phrase: string) => {
[ArgumentTypes.EMOJI]: (message, phrase) => {
if (!phrase) return null;

@@ -413,3 +414,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.EMOJIS]: (message: Message, phrase: string) => {
[ArgumentTypes.EMOJIS]: (message, phrase) => {
if (!phrase) return null;

@@ -421,3 +422,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.GUILD]: (_message: Message, phrase: string) => {
[ArgumentTypes.GUILD]: (_message, phrase) => {
if (!phrase) return null;

@@ -427,3 +428,3 @@ return this.client.util.resolveGuild(phrase, this.client.guilds.cache);

[ArgumentTypes.GUILDS]: (_message: Message, phrase: string) => {
[ArgumentTypes.GUILDS]: (_message, phrase) => {
if (!phrase) return null;

@@ -434,3 +435,3 @@ const guilds = this.client.util.resolveGuilds(phrase, this.client.guilds.cache);

[ArgumentTypes.MESSAGE]: (message: Message, phrase: string) => {
[ArgumentTypes.MESSAGE]: (message, phrase) => {
if (!phrase) return null;

@@ -444,3 +445,3 @@ try {

[ArgumentTypes.GUILD_MESSAGE]: async (message: Message, phrase: string) => {
[ArgumentTypes.GUILD_MESSAGE]: async (message, phrase) => {
if (!phrase) return null;

@@ -460,3 +461,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.RELEVANT_MESSAGE]: async (message: Message, phrase: string) => {
[ArgumentTypes.RELEVANT_MESSAGE]: async (message, phrase) => {
if (!phrase) return null;

@@ -482,3 +483,3 @@ const hereMsg = await message.channel.messages.fetch(phrase).catch(() => null);

[ArgumentTypes.INVITE]: (_message: Message, phrase: string) => {
[ArgumentTypes.INVITE]: (_message, phrase) => {
if (!phrase) return null;

@@ -492,3 +493,3 @@ try {

[ArgumentTypes.USER_MENTION]: (_message: Message, phrase: string) => {
[ArgumentTypes.USER_MENTION]: (_message, phrase) => {
if (!phrase) return null;

@@ -500,3 +501,3 @@ const id = phrase.match(/<@!?(\d{17,19})>/);

[ArgumentTypes.MEMBER_MENTION]: (message: Message, phrase: string) => {
[ArgumentTypes.MEMBER_MENTION]: (message, phrase) => {
if (!phrase) return null;

@@ -509,3 +510,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.CHANNEL_MENTION]: (message: Message, phrase: string) => {
[ArgumentTypes.CHANNEL_MENTION]: (message, phrase) => {
if (!phrase) return null;

@@ -518,3 +519,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.ROLE_MENTION]: (message: Message, phrase: string) => {
[ArgumentTypes.ROLE_MENTION]: (message, phrase) => {
if (!phrase) return null;

@@ -527,3 +528,3 @@ if (!message.guild) return null;

[ArgumentTypes.EMOJI_MENTION]: (message: Message, phrase: string) => {
[ArgumentTypes.EMOJI_MENTION]: (message, phrase) => {
if (!phrase) return null;

@@ -536,3 +537,3 @@ if (!message.inGuild()) return null;

[ArgumentTypes.COMMAND_ALIAS]: (_message: Message, phrase: string) => {
[ArgumentTypes.COMMAND_ALIAS]: (_message, phrase) => {
if (!phrase) return null;

@@ -542,3 +543,3 @@ return this.commandHandler.findCommand(phrase) ?? null;

[ArgumentTypes.COMMAND]: (_message: Message, phrase: string) => {
[ArgumentTypes.COMMAND]: (_message, phrase) => {
if (!phrase) return null;

@@ -548,3 +549,3 @@ return this.commandHandler.modules.get(phrase) ?? null;

[ArgumentTypes.INHIBITOR]: (_message: Message, phrase: string) => {
[ArgumentTypes.INHIBITOR]: (_message, phrase) => {
if (!phrase) return null;

@@ -554,3 +555,3 @@ return this.inhibitorHandler?.modules.get(phrase) ?? null;

[ArgumentTypes.LISTENER]: (_message: Message, phrase: string) => {
[ArgumentTypes.LISTENER]: (_message, phrase) => {
if (!phrase) return null;

@@ -560,3 +561,3 @@ return this.listenerHandler?.modules.get(phrase) ?? null;

[ArgumentTypes.TASK]: (_message: Message, phrase: string) => {
[ArgumentTypes.TASK]: (_message, phrase) => {
if (!phrase) return null;

@@ -566,3 +567,3 @@ return this.taskHandler?.modules.get(phrase) ?? null;

[ArgumentTypes.CONTEXT_MENU_COMMAND]: (_message: Message, phrase: string) => {
[ArgumentTypes.CONTEXT_MENU_COMMAND]: (_message, phrase) => {
if (!phrase) return null;

@@ -582,3 +583,3 @@ return this.contextMenuCommandHandler?.modules.get(phrase) ?? null;

*/
public type(name: keyof BaseArgumentType): ArgumentTypeCaster;
public type<T extends keyof BaseArgumentType>(name: T): ArgumentTypeCaster<BaseArgumentType[T]>;
public type(name: string): ArgumentTypeCaster | undefined;

@@ -585,0 +586,0 @@ public type(name: string): ArgumentTypeCaster | undefined {

@@ -350,5 +350,3 @@ /* eslint-disable func-names, @typescript-eslint/no-unused-vars */

public execSlash(message: AkairoMessage, ...args: any[]): any {
if (this.slash) {
throw new AkairoError("NOT_IMPLEMENTED", this.constructor.name, "execSlash");
}
throw new AkairoError("NOT_IMPLEMENTED", this.constructor.name, "execSlash");
}

@@ -355,0 +353,0 @@

@@ -16,3 +16,3 @@ import {

Snowflake,
TextBasedChannels,
TextBasedChannel,
TextChannel,

@@ -225,3 +225,3 @@ User

*/
public constructor(client: AkairoClient, options?: CommandHandlerOptions) {
public constructor(client: AkairoClient, options: CommandHandlerOptions) {
const {

@@ -1448,3 +1448,3 @@ directory,

*/
public addPrompt(channel: TextBasedChannels, user: User): void {
public addPrompt(channel: TextBasedChannel, user: User): void {
let users = this.prompts.get(channel.id);

@@ -1461,3 +1461,3 @@ if (!users) this.prompts.set(channel.id, new Set());

*/
public removePrompt(channel: TextBasedChannels, user: User): void {
public removePrompt(channel: TextBasedChannel, user: User): void {
const users = this.prompts.get(channel.id);

@@ -1474,3 +1474,3 @@ if (!users) return;

*/
public hasPrompt(channel: TextBasedChannels, user: User): boolean {
public hasPrompt(channel: TextBasedChannel, user: User): boolean {
const users = this.prompts.get(channel.id);

@@ -1611,2 +1611,3 @@ if (!users) return false;

* Default argument options.
* @default {}
*/

@@ -1622,2 +1623,3 @@ argumentDefaults?: DefaultArgumentOptions;

* Specify whether to register all slash commands when starting the client.
* @default false
*/

@@ -1628,2 +1630,3 @@ autoRegisterSlashCommands?: boolean;

* Whether or not to block bots.
* @default true
*/

@@ -1634,2 +1637,3 @@ blockBots?: boolean;

* Whether or not to block self.
* @default true
*/

@@ -1645,3 +1649,4 @@ blockClient?: boolean;

* Milliseconds a message should exist for before its command util instance is marked for removal.
* If 0, CommandUtil instances will never be removed and will cause memory to increase indefinitely.
* If `0`, CommandUtil instances will never be removed and will cause memory to increase indefinitely.
* @default 300_000 // 5 minutes
*/

@@ -1652,3 +1657,4 @@ commandUtilLifetime?: number;

* Time interval in milliseconds for sweeping command util instances.
* If 0, CommandUtil instances will never be removed and will cause memory to increase indefinitely.
* If `0`, CommandUtil instances will never be removed and will cause memory to increase indefinitely.
* @default 300_000 // 5 minutes
*/

@@ -1659,2 +1665,3 @@ commandUtilSweepInterval?: number;

* Default cooldown for commands.
* @default 0
*/

@@ -1665,2 +1672,3 @@ defaultCooldown?: number;

* Whether or not members are fetched on each message author from a guild.
* @default false
*/

@@ -1671,2 +1679,3 @@ fetchMembers?: boolean;

* Whether or not to handle edited messages using CommandUtil.
* @default false
*/

@@ -1677,2 +1686,3 @@ handleEdits?: boolean;

* ID of user(s) to ignore cooldown or a function to ignore. Defaults to the client owner(s).
* @default client.ownerID
*/

@@ -1683,2 +1693,3 @@ ignoreCooldown?: Snowflake | Snowflake[] | IgnoreCheckPredicate;

* ID of user(s) to ignore `userPermissions` checks or a function to ignore.
* @default []
*/

@@ -1689,2 +1700,3 @@ ignorePermissions?: Snowflake | Snowflake[] | IgnoreCheckPredicate;

* The prefix(es) for command parsing.
* @default "!"
*/

@@ -1695,2 +1707,3 @@ prefix?: string | string[] | PrefixSupplier;

* Whether or not to store messages in CommandUtil.
* @default false
*/

@@ -1701,2 +1714,3 @@ storeMessages?: boolean;

* Show "BotName is typing" information message on the text channels when a command is running.
* @default false
*/

@@ -1707,2 +1721,3 @@ typing?: boolean;

* Whether or not to require the use of execSlash for slash commands.
* @default false
*/

@@ -1713,2 +1728,3 @@ execSlash?: boolean;

* Whether or not to skip built in reasons post type inhibitors so you can make custom ones.
* @default false
*/

@@ -1721,2 +1737,3 @@ skipBuiltInPostInhibitors?: boolean;

* Warning: this is experimental
* @default false
*/

@@ -1723,0 +1740,0 @@ useSlashPermissions?: boolean;

@@ -67,6 +67,5 @@ import { ArgumentMatches } from "../../util/Constants.js";

public constructor(
content: string,
{ flagWords = [], optionFlagWords = [], quoted = true, separator }: ContentParserOptions = {}
) {
public constructor(content: string, options?: ContentParserOptions) {
const { flagWords = [], optionFlagWords = [], quoted = true, separator } = options ?? {};
this.content = content;

@@ -479,6 +478,4 @@ this.flagWords = flagWords;

this.flagWords.sort((a, b) => b.length - a.length);
this.optionFlagWords = optionFlagWords;
this.optionFlagWords.sort((a, b) => b.length - a.length);
this.quoted = Boolean(quoted);

@@ -534,2 +531,3 @@ this.separator = separator;

* Words considered flags.
* @default []
*/

@@ -540,2 +538,3 @@ flagWords?: string[];

* Words considered option flags.
* @default []
*/

@@ -545,3 +544,4 @@ optionFlagWords?: string[];

/**
* Whether to parse quotes. Defaults to `true`.
* Whether to parse quotes.
* @default true
*/

@@ -548,0 +548,0 @@ quoted?: boolean;

@@ -50,3 +50,3 @@ import type { Awaitable, Collection, ContextMenuInteraction } from "discord.js";

*/
public constructor(client: AkairoClient, options?: AkairoHandlerOptions) {
public constructor(client: AkairoClient, options: AkairoHandlerOptions) {
const {

@@ -53,0 +53,0 @@ directory,

@@ -102,2 +102,3 @@ /* eslint-disable @typescript-eslint/no-unused-vars */

* Reason emitted when command or message is blocked.
* @default ""
*/

@@ -108,3 +109,3 @@ reason?: string;

* Can be 'all' to run on all messages, 'pre' to run on messages not blocked by the built-in inhibitors, or 'post' to run on messages that are commands.
* Defaults to `post`
* @default "post"
*/

@@ -116,5 +117,5 @@ type?: "all" | "pre" | "post";

* The inhibitor with the highest priority is the one that is used for the block reason.
* Defaults to `0`
* @default 0
*/
priority?: number;
}

@@ -45,3 +45,3 @@ import type { Awaitable, Collection, Message } from "discord.js";

*/
public constructor(client: AkairoClient, options?: AkairoHandlerOptions) {
public constructor(client: AkairoClient, options: AkairoHandlerOptions) {
const { directory, classToHandle = Inhibitor, extensions = [".js", ".ts"], automateCategories, loadFilter } = options ?? {};

@@ -48,0 +48,0 @@

@@ -98,3 +98,3 @@ /* eslint-disable func-names, @typescript-eslint/no-unused-vars */

* Type of listener, either 'on' or 'once'.
* Defaults to `on`
* @default "on"
*/

@@ -101,0 +101,0 @@ type?: ListenerType;

@@ -50,3 +50,3 @@ import { Awaitable, Collection } from "discord.js";

*/
public constructor(client: AkairoClient, options?: AkairoHandlerOptions) {
public constructor(client: AkairoClient, options: AkairoHandlerOptions) {
const { directory, classToHandle = Listener, extensions = [".js", ".ts"], automateCategories, loadFilter } = options ?? {};

@@ -53,0 +53,0 @@

@@ -91,4 +91,5 @@ /* eslint-disable func-names, @typescript-eslint/no-unused-vars */

* Whether or not the task runs on start.
* @default false
*/
runOnStart?: boolean;
}

@@ -42,3 +42,3 @@ import type { Awaitable, Collection } from "discord.js";

*/
public constructor(client: AkairoClient, options?: AkairoHandlerOptions) {
public constructor(client: AkairoClient, options: AkairoHandlerOptions) {
const { directory, classToHandle = Task, extensions = [".js", ".ts"], automateCategories, loadFilter } = options ?? {};

@@ -45,0 +45,0 @@

@@ -12,3 +12,3 @@ import type { APIInteractionGuildMember, APIMessage } from "discord-api-types/v9";

Snowflake,
TextBasedChannels,
TextBasedChannel,
User,

@@ -116,3 +116,3 @@ Util

*/
public get channel(): TextBasedChannels | null {
public get channel(): TextBasedChannel | null {
return this.interaction.channel;

@@ -119,0 +119,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

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