@notenoughupdates/discord-akairo
Advanced tools
Comparing version 9.0.8-dev.1636663997.73c25d1 to 9.0.8
{ | ||
"name": "@notenoughupdates/discord-akairo", | ||
"version": "9.0.8-dev.1636663997.73c25d1", | ||
"version": "9.0.8", | ||
"description": "A highly customizable bot framework for Discord.js.", | ||
@@ -38,21 +38,22 @@ "main": "./dist/src/index.js", | ||
"lodash": "^4.17.21", | ||
"source-map-support": "^0.5.20" | ||
"source-map-support": "^0.5.21" | ||
}, | ||
"devDependencies": { | ||
"@discordjs/voice": "^0.7.1", | ||
"@discordjs/voice": "^0.7.5", | ||
"@favware/npm-deprecate": "^1.0.4", | ||
"@types/lodash": "^4.14.176", | ||
"@types/node": "^16.11.6", | ||
"@types/lodash": "^4.14.177", | ||
"@types/node": "^16.11.10", | ||
"@types/source-map-support": "^0.5.4", | ||
"@typescript-eslint/eslint-plugin": "^5.2.0", | ||
"@typescript-eslint/parser": "^5.2.0", | ||
"@typescript-eslint/eslint-plugin": "^5.4.0", | ||
"@typescript-eslint/parser": "^5.4.0", | ||
"discord-api-types": "0.24.0", | ||
"discord.js": "npm:@notenoughupdates/discord.js@dev", | ||
"discord.js-docgen": "discordjs/docgen", | ||
"eslint": "^8.1.0", | ||
"eslint": "^8.3.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"jsdoc": "^3.6.7", | ||
"prettier": "^2.4.1", | ||
"prettier": "^2.5.0", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.4.4" | ||
"typedoc": "^0.22.10", | ||
"typescript": "^4.5.2" | ||
}, | ||
@@ -85,6 +86,3 @@ "prettier": { | ||
"sourceType": "module", | ||
"project": "./tsconfig-eslint.json", | ||
"extraFileExtensions": [ | ||
".mjs" | ||
] | ||
"project": "./tsconfig-eslint.json" | ||
}, | ||
@@ -91,0 +89,0 @@ "env": { |
@@ -6,7 +6,9 @@ import "source-map-support/register"; | ||
import ClientUtil from "./struct/ClientUtil"; | ||
import Argument, { ArgumentMatch, ArgumentOptions, ArgumentPromptData, ArgumentPromptOptions, ArgumentType, ArgumentTypeCaster, ArgumentTypeCaster_, DefaultArgumentOptions, DefaultValueSupplier, FailureData, OtherwiseContentModifier, OtherwiseContentSupplier, ParsedValuePredicate, PromptContentModifier, PromptContentSupplier } from "./struct/commands/arguments/Argument"; | ||
import Argument, { ArgumentMatch, ArgumentOptions, ArgumentPromptData, ArgumentPromptOptions, ArgumentType, ArgumentTypeCaster, ArgumentTypeCaster_, BaseArgumentType, DefaultArgumentOptions, DefaultValueSupplier, FailureData, OtherwiseContentModifier, OtherwiseContentSupplier, ParsedValuePredicate, PromptContentModifier, PromptContentSupplier } from "./struct/commands/arguments/Argument"; | ||
import ArgumentRunner, { ArgumentRunnerState } from "./struct/commands/arguments/ArgumentRunner"; | ||
import TypeResolver from "./struct/commands/arguments/TypeResolver"; | ||
import Command, { AkairoApplicationCommandChannelOptionData, AkairoApplicationCommandChoicesData, AkairoApplicationCommandNonOptionsData, AkairoApplicationCommandOptionData, AkairoApplicationCommandSubCommandData, AkairoApplicationCommandSubGroupData, ArgumentGenerator, BeforeAction, CommandOptions, ExecutionPredicate, KeySupplier, MissingPermissionSupplier, RegexSupplier, SlashOption } from "./struct/commands/Command"; | ||
import Command, { AkairoApplicationCommandAutocompleteOption, AkairoApplicationCommandChannelOptionData, AkairoApplicationCommandChoicesData, AkairoApplicationCommandNonOptionsData, AkairoApplicationCommandNumericOptionData, AkairoApplicationCommandOptionData, AkairoApplicationCommandSubCommandData, AkairoApplicationCommandSubGroupData, ArgumentGenerator, BeforeAction, CommandOptions, ExecutionPredicate, KeySupplier, MissingPermissionSupplier, RegexSupplier, SlashOption, SlashPermissionsSupplier } from "./struct/commands/Command"; | ||
import CommandHandler, { CommandHandlerOptions, CooldownData, IgnoreCheckPredicate, MentionPrefixPredicate, ParsedComponentData, PrefixSupplier, SlashResolveTypes } from "./struct/commands/CommandHandler"; | ||
import CommandUtil from "./struct/commands/CommandUtil"; | ||
import ContentParser, { ContentParserOptions, ContentParserResult, ExtractedFlags, StringData } from "./struct/commands/ContentParser"; | ||
import Flag from "./struct/commands/Flag"; | ||
@@ -17,7 +19,7 @@ import ContextMenuCommand, { ContextMenuCommandOptions } from "./struct/contextMenuCommands/ContextMenuCommand"; | ||
import InhibitorHandler from "./struct/inhibitors/InhibitorHandler"; | ||
import Listener, { ListenerOptions } from "./struct/listeners/Listener"; | ||
import Listener, { ListenerOptions, ListenerType } from "./struct/listeners/Listener"; | ||
import ListenerHandler from "./struct/listeners/ListenerHandler"; | ||
import Task, { TaskOptions } from "./struct/tasks/Task"; | ||
import TaskHandler from "./struct/tasks/TaskHandler"; | ||
import type { AkairoClientEvents, AkairoHandlerEvents, CommandHandlerEvents, InhibitorHandlerEvents, ListenerHandlerEvents, TaskHandlerEvents } from "./typings/events"; | ||
import type { AkairoClientEvents, AkairoHandlerEvents, CommandHandlerEvents, ContextMenuCommandHandlerEvents, InhibitorHandlerEvents, ListenerHandlerEvents, TaskHandlerEvents } from "./typings/events"; | ||
import type { GuildTextBasedChannels } from "./typings/guildTextBasedChannels"; | ||
@@ -41,4 +43,4 @@ import AkairoError from "./util/AkairoError"; | ||
} | ||
export { AkairoClient, AkairoError, AkairoHandler, AkairoMessage, AkairoModule, Argument, Category, ClientUtil, Command, CommandHandler, CommandUtil, Constants, ContextMenuCommand, ContextMenuCommandHandler, Flag, Inhibitor, InhibitorHandler, Listener, ListenerHandler, PromptContentModifier, Task, TaskHandler, TypeResolver, Util, version }; | ||
export type { AkairoApplicationCommandChannelOptionData, AkairoApplicationCommandChoicesData, AkairoApplicationCommandNonOptionsData, AkairoApplicationCommandOptionData, AkairoApplicationCommandSubCommandData, AkairoApplicationCommandSubGroupData, AkairoClientEvents, AkairoHandlerEvents, AkairoHandlerOptions, AkairoModuleOptions, AkairoOptions, ArgumentGenerator, ArgumentMatch, ArgumentOptions, ArgumentPromptData, ArgumentPromptOptions, ArgumentType, ArgumentTypeCaster_, ArgumentTypeCaster, BeforeAction, CommandHandlerEvents, CommandHandlerOptions, CommandOptions, ContextMenuCommandOptions, CooldownData, DefaultArgumentOptions, DefaultValueSupplier, ExecutionPredicate, FailureData, GuildTextBasedChannels, IgnoreCheckPredicate, InhibitorHandlerEvents, InhibitorOptions, KeySupplier, ListenerHandlerEvents, ListenerOptions, LoadPredicate, MentionPrefixPredicate, MissingPermissionSupplier, OtherwiseContentModifier, OtherwiseContentSupplier, ParsedComponentData, ParsedValuePredicate, PrefixSupplier, PromptContentSupplier, RegexSupplier, SlashOption, SlashResolveTypes, TaskHandlerEvents, TaskOptions }; | ||
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, 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_, ArgumentTypeCaster, BaseArgumentType, BeforeAction, CommandHandlerEvents, CommandHandlerOptions, CommandOptions, ContentParserOptions, ContextMenuCommandHandlerEvents, ContextMenuCommandOptions, CooldownData, DefaultArgumentOptions, DefaultValueSupplier, ExecutionPredicate, ExtractedFlags, FailureData, GuildTextBasedChannels, IgnoreCheckPredicate, InhibitorHandlerEvents, InhibitorOptions, 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 |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = exports.Util = exports.TypeResolver = exports.TaskHandler = exports.Task = exports.ListenerHandler = exports.Listener = exports.InhibitorHandler = exports.Inhibitor = exports.Flag = exports.ContextMenuCommandHandler = exports.ContextMenuCommand = exports.Constants = exports.CommandUtil = exports.CommandHandler = exports.Command = exports.ClientUtil = exports.Category = exports.Argument = exports.AkairoModule = exports.AkairoMessage = exports.AkairoHandler = exports.AkairoError = exports.AkairoClient = void 0; | ||
const tslib_1 = require("tslib"); | ||
exports.version = exports.Util = exports.TypeResolver = exports.TaskHandler = exports.Task = exports.ListenerHandler = exports.Listener = exports.InhibitorHandler = exports.Inhibitor = exports.Flag = exports.ContextMenuCommandHandler = exports.ContextMenuCommand = exports.ContentParser = exports.Constants = exports.CommandUtil = exports.CommandHandler = exports.Command = exports.ClientUtil = exports.Category = exports.ArgumentRunner = exports.Argument = exports.AkairoModule = exports.AkairoMessage = exports.AkairoHandler = exports.AkairoError = exports.AkairoClient = void 0; | ||
require("source-map-support/register"); | ||
const package_json_1 = (0, tslib_1.__importDefault)(require("../package.json")); | ||
const AkairoClient_1 = (0, tslib_1.__importDefault)(require("./struct/AkairoClient")); | ||
const package_json_1 = __importDefault(require("../package.json")); | ||
const AkairoClient_1 = __importDefault(require("./struct/AkairoClient")); | ||
exports.AkairoClient = AkairoClient_1.default; | ||
const AkairoHandler_1 = (0, tslib_1.__importDefault)(require("./struct/AkairoHandler")); | ||
const AkairoHandler_1 = __importDefault(require("./struct/AkairoHandler")); | ||
exports.AkairoHandler = AkairoHandler_1.default; | ||
const AkairoModule_1 = (0, tslib_1.__importDefault)(require("./struct/AkairoModule")); | ||
const AkairoModule_1 = __importDefault(require("./struct/AkairoModule")); | ||
exports.AkairoModule = AkairoModule_1.default; | ||
const ClientUtil_1 = (0, tslib_1.__importDefault)(require("./struct/ClientUtil")); | ||
const ClientUtil_1 = __importDefault(require("./struct/ClientUtil")); | ||
exports.ClientUtil = ClientUtil_1.default; | ||
const Argument_1 = (0, tslib_1.__importDefault)(require("./struct/commands/arguments/Argument")); | ||
const Argument_1 = __importDefault(require("./struct/commands/arguments/Argument")); | ||
exports.Argument = Argument_1.default; | ||
const TypeResolver_1 = (0, tslib_1.__importDefault)(require("./struct/commands/arguments/TypeResolver")); | ||
const ArgumentRunner_1 = __importDefault(require("./struct/commands/arguments/ArgumentRunner")); | ||
exports.ArgumentRunner = ArgumentRunner_1.default; | ||
const TypeResolver_1 = __importDefault(require("./struct/commands/arguments/TypeResolver")); | ||
exports.TypeResolver = TypeResolver_1.default; | ||
const Command_1 = (0, tslib_1.__importDefault)(require("./struct/commands/Command")); | ||
const Command_1 = __importDefault(require("./struct/commands/Command")); | ||
exports.Command = Command_1.default; | ||
const CommandHandler_1 = (0, tslib_1.__importDefault)(require("./struct/commands/CommandHandler")); | ||
const CommandHandler_1 = __importDefault(require("./struct/commands/CommandHandler")); | ||
exports.CommandHandler = CommandHandler_1.default; | ||
const CommandUtil_1 = (0, tslib_1.__importDefault)(require("./struct/commands/CommandUtil")); | ||
const CommandUtil_1 = __importDefault(require("./struct/commands/CommandUtil")); | ||
exports.CommandUtil = CommandUtil_1.default; | ||
const Flag_1 = (0, tslib_1.__importDefault)(require("./struct/commands/Flag")); | ||
const ContentParser_1 = __importDefault(require("./struct/commands/ContentParser")); | ||
exports.ContentParser = ContentParser_1.default; | ||
const Flag_1 = __importDefault(require("./struct/commands/Flag")); | ||
exports.Flag = Flag_1.default; | ||
const ContextMenuCommand_1 = (0, tslib_1.__importDefault)(require("./struct/contextMenuCommands/ContextMenuCommand")); | ||
const ContextMenuCommand_1 = __importDefault(require("./struct/contextMenuCommands/ContextMenuCommand")); | ||
exports.ContextMenuCommand = ContextMenuCommand_1.default; | ||
const ContextMenuCommandHandler_1 = (0, tslib_1.__importDefault)(require("./struct/contextMenuCommands/ContextMenuCommandHandler")); | ||
const ContextMenuCommandHandler_1 = __importDefault(require("./struct/contextMenuCommands/ContextMenuCommandHandler")); | ||
exports.ContextMenuCommandHandler = ContextMenuCommandHandler_1.default; | ||
const Inhibitor_1 = (0, tslib_1.__importDefault)(require("./struct/inhibitors/Inhibitor")); | ||
const Inhibitor_1 = __importDefault(require("./struct/inhibitors/Inhibitor")); | ||
exports.Inhibitor = Inhibitor_1.default; | ||
const InhibitorHandler_1 = (0, tslib_1.__importDefault)(require("./struct/inhibitors/InhibitorHandler")); | ||
const InhibitorHandler_1 = __importDefault(require("./struct/inhibitors/InhibitorHandler")); | ||
exports.InhibitorHandler = InhibitorHandler_1.default; | ||
const Listener_1 = (0, tslib_1.__importDefault)(require("./struct/listeners/Listener")); | ||
const Listener_1 = __importDefault(require("./struct/listeners/Listener")); | ||
exports.Listener = Listener_1.default; | ||
const ListenerHandler_1 = (0, tslib_1.__importDefault)(require("./struct/listeners/ListenerHandler")); | ||
const ListenerHandler_1 = __importDefault(require("./struct/listeners/ListenerHandler")); | ||
exports.ListenerHandler = ListenerHandler_1.default; | ||
const Task_1 = (0, tslib_1.__importDefault)(require("./struct/tasks/Task")); | ||
const Task_1 = __importDefault(require("./struct/tasks/Task")); | ||
exports.Task = Task_1.default; | ||
const TaskHandler_1 = (0, tslib_1.__importDefault)(require("./struct/tasks/TaskHandler")); | ||
const TaskHandler_1 = __importDefault(require("./struct/tasks/TaskHandler")); | ||
exports.TaskHandler = TaskHandler_1.default; | ||
const AkairoError_1 = (0, tslib_1.__importDefault)(require("./util/AkairoError")); | ||
const AkairoError_1 = __importDefault(require("./util/AkairoError")); | ||
exports.AkairoError = AkairoError_1.default; | ||
const AkairoMessage_1 = (0, tslib_1.__importDefault)(require("./util/AkairoMessage")); | ||
const AkairoMessage_1 = __importDefault(require("./util/AkairoMessage")); | ||
exports.AkairoMessage = AkairoMessage_1.default; | ||
const Category_1 = (0, tslib_1.__importDefault)(require("./util/Category")); | ||
const Category_1 = __importDefault(require("./util/Category")); | ||
exports.Category = Category_1.default; | ||
const Constants = (0, tslib_1.__importStar)(require("./util/Constants")); | ||
const Constants = __importStar(require("./util/Constants")); | ||
exports.Constants = Constants; | ||
const Util_1 = (0, tslib_1.__importDefault)(require("./util/Util")); | ||
const Util_1 = __importDefault(require("./util/Util")); | ||
exports.Util = Util_1.default; | ||
@@ -53,0 +78,0 @@ const version = package_json_1.default.version; |
@@ -0,0 +0,0 @@ import { Awaitable, Client, ClientOptions, Snowflake, UserResolvable } from "discord.js"; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const discord_js_1 = require("discord.js"); | ||
const ClientUtil_js_1 = (0, tslib_1.__importDefault)(require("./ClientUtil.js")); | ||
const ClientUtil_js_1 = __importDefault(require("./ClientUtil.js")); | ||
/** | ||
@@ -7,0 +9,0 @@ * The Akairo framework client. Creates the handlers and sets them up. |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const discord_js_1 = require("discord.js"); | ||
const events_1 = (0, tslib_1.__importDefault)(require("events")); | ||
const fs_1 = (0, tslib_1.__importDefault)(require("fs")); | ||
const path_1 = (0, tslib_1.__importDefault)(require("path")); | ||
const url_1 = (0, tslib_1.__importDefault)(require("url")); | ||
const AkairoError_js_1 = (0, tslib_1.__importDefault)(require("../util/AkairoError.js")); | ||
const Category_js_1 = (0, tslib_1.__importDefault)(require("../util/Category.js")); | ||
const events_1 = __importDefault(require("events")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const path_1 = __importDefault(require("path")); | ||
const url_1 = __importDefault(require("url")); | ||
const AkairoError_js_1 = __importDefault(require("../util/AkairoError.js")); | ||
const Category_js_1 = __importDefault(require("../util/Category.js")); | ||
const Constants_js_1 = require("../util/Constants.js"); | ||
const AkairoModule_js_1 = (0, tslib_1.__importDefault)(require("./AkairoModule.js")); | ||
const AkairoModule_js_1 = __importDefault(require("./AkairoModule.js")); | ||
/** | ||
@@ -14,0 +16,0 @@ * Base class for handling modules. |
@@ -0,0 +0,0 @@ import type Category from "../util/Category.js"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -379,6 +379,4 @@ import type { Message, MessageOptions, MessagePayload } from "discord.js"; | ||
export declare type ArgumentMatch = "phrase" | "flag" | "option" | "rest" | "separate" | "text" | "content" | "restContent" | "none"; | ||
export declare type BaseArgumentType = "string" | "lowercase" | "uppercase" | "charCodes" | "number" | "integer" | "bigint" | "emojint" | "url" | "date" | "color" | "user" | "users" | "member" | "members" | "relevant" | "relevants" | "channel" | "channels" | "textChannel" | "textChannels" | "voiceChannel" | "voiceChannels" | "categoryChannel" | "categoryChannels" | "newsChannel" | "newsChannels" | "storeChannel" | "storeChannels" | "stageChannel" | "stageChannels" | "threadChannel" | "threadChannels" | "role" | "roles" | "emoji" | "emojis" | "guild" | "guilds" | "message" | "guildMessage" | "relevantMessage" | "invite" | "userMention" | "memberMention" | "channelMention" | "roleMention" | "emojiMention" | "commandAlias" | "command" | "inhibitor" | "listener" | "task" | "contextMenuCommand"; | ||
/** | ||
* The type that the argument should be cast to. | ||
* - `string` does not cast to any type. | ||
* * - `string` does not cast to any type. | ||
* - `lowercase` makes the input lowercase. | ||
@@ -427,2 +425,6 @@ * - `uppercase` makes the input uppercase. | ||
* - `emojiMention` matches a mention of an emoji. | ||
*/ | ||
export declare type BaseArgumentType = "string" | "lowercase" | "uppercase" | "charCodes" | "number" | "integer" | "bigint" | "emojint" | "url" | "date" | "color" | "user" | "users" | "member" | "members" | "relevant" | "relevants" | "channel" | "channels" | "textChannel" | "textChannels" | "voiceChannel" | "voiceChannels" | "categoryChannel" | "categoryChannels" | "newsChannel" | "newsChannels" | "storeChannel" | "storeChannels" | "stageChannel" | "stageChannels" | "threadChannel" | "threadChannels" | "role" | "roles" | "emoji" | "emojis" | "guild" | "guilds" | "message" | "guildMessage" | "relevantMessage" | "invite" | "userMention" | "memberMention" | "channelMention" | "roleMention" | "emojiMention" | "commandAlias" | "command" | "inhibitor" | "listener" | "task" | "contextMenuCommand"; | ||
/** | ||
* The type that the argument should be cast to. | ||
* | ||
@@ -429,0 +431,0 @@ * An array of strings can be used to restrict input to only those strings, case insensitive. |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const Constants_js_1 = require("../../../util/Constants.js"); | ||
const Util_js_1 = (0, tslib_1.__importDefault)(require("../../../util/Util.js")); | ||
const Flag_js_1 = (0, tslib_1.__importDefault)(require("../Flag.js")); | ||
const Util_js_1 = __importDefault(require("../../../util/Util.js")); | ||
const Flag_js_1 = __importDefault(require("../Flag.js")); | ||
/** | ||
@@ -8,0 +10,0 @@ * Represents an argument for a command. |
@@ -0,0 +0,0 @@ import type { Message } from "discord.js"; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const AkairoError_js_1 = (0, tslib_1.__importDefault)(require("../../../util/AkairoError.js")); | ||
const AkairoError_js_1 = __importDefault(require("../../../util/AkairoError.js")); | ||
const Constants_js_1 = require("../../../util/Constants.js"); | ||
const Flag_js_1 = (0, tslib_1.__importDefault)(require("../Flag.js")); | ||
const Argument_js_1 = (0, tslib_1.__importDefault)(require("./Argument.js")); | ||
const Flag_js_1 = __importDefault(require("../Flag.js")); | ||
const Argument_js_1 = __importDefault(require("./Argument.js")); | ||
/** | ||
@@ -9,0 +11,0 @@ * Runs arguments. |
@@ -0,0 +0,0 @@ import { Collection } from "discord.js"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -1,2 +0,2 @@ | ||
import { ApplicationCommandChannelOptionData, ApplicationCommandChoicesData, ApplicationCommandNonOptionsData, ApplicationCommandSubCommandData, ApplicationCommandSubGroupData, Message, PermissionResolvable, Snowflake } from "discord.js"; | ||
import { ApplicationCommandAutocompleteOption, ApplicationCommandChannelOptionData, ApplicationCommandChoicesData, ApplicationCommandNonOptionsData, ApplicationCommandNumericOptionData, ApplicationCommandPermissionData, ApplicationCommandSubCommandData, ApplicationCommandSubGroupData, AutocompleteInteraction, Guild, Message, PermissionResolvable, Snowflake } from "discord.js"; | ||
import type AkairoMessage from "../../util/AkairoMessage.js"; | ||
@@ -20,2 +20,6 @@ import type Category from "../../util/Category.js"; | ||
/** | ||
* Argument options or generator. | ||
*/ | ||
_args?: ArgumentOptions[] | ArgumentGenerator; | ||
/** | ||
* Default prompt options. | ||
@@ -25,2 +29,6 @@ */ | ||
/** | ||
* The argument runner. | ||
*/ | ||
argumentRunner: ArgumentRunner; | ||
/** | ||
* Category the command belongs to. | ||
@@ -44,7 +52,11 @@ */ | ||
*/ | ||
cooldown?: number; | ||
cooldown: number | null; | ||
/** | ||
* The content parser. | ||
*/ | ||
contentParser: ContentParser; | ||
/** | ||
* Description of the command. | ||
*/ | ||
description: any; | ||
description: string | any | any[]; | ||
/** | ||
@@ -111,2 +123,8 @@ * Whether or not this command can be ran by an edit. | ||
/** | ||
* The default permission to set when creating the slash command. | ||
* | ||
* **Note:** Requires the useSlashPermissions to be enabled in the command handler | ||
*/ | ||
slashDefaultPermission: boolean; | ||
/** | ||
* Whether slash command responses for this command should be ephemeral or not. | ||
@@ -124,2 +142,10 @@ */ | ||
/** | ||
* The slash permissions to set in each guild for this command. | ||
*/ | ||
slashPermissions?: ApplicationCommandPermissionData[] | SlashPermissionsSupplier; | ||
/** | ||
* Only allows this command to be executed as a slash command. | ||
*/ | ||
slashOnly: boolean; | ||
/** | ||
* Whether or not to allow client superUsers(s) only. | ||
@@ -137,18 +163,2 @@ */ | ||
/** | ||
* Argument options or generator. | ||
*/ | ||
_args?: ArgumentOptions[] | ArgumentGenerator; | ||
/** | ||
* The content parser. | ||
*/ | ||
contentParser: ContentParser; | ||
/** | ||
* The argument runner. | ||
*/ | ||
argumentRunner: ArgumentRunner; | ||
/** | ||
* Only allows this command to be executed as a slash command. | ||
*/ | ||
slashOnly: boolean; | ||
/** | ||
* Generator for arguments. | ||
@@ -195,2 +205,7 @@ */ | ||
/** | ||
* Respond to autocomplete interactions for this command. | ||
* @param interaction The autocomplete interaction | ||
*/ | ||
autocomplete(interaction: AutocompleteInteraction): any; | ||
/** | ||
* Parses content using the command's arguments. | ||
@@ -218,2 +233,3 @@ * @param message - Message to use. | ||
* Command names. | ||
* @default [] | ||
*/ | ||
@@ -223,2 +239,3 @@ aliases?: string[]; | ||
* Argument options or generator. | ||
* @default this._args || this.args || [] | ||
*/ | ||
@@ -228,2 +245,3 @@ args?: ArgumentOptions[] | ArgumentGenerator; | ||
* The default argument options. | ||
* @default {} | ||
*/ | ||
@@ -233,2 +251,3 @@ argumentDefaults?: DefaultArgumentOptions; | ||
* Function to run before argument parsing and execution. | ||
* @default this.before || (() => undefined) | ||
*/ | ||
@@ -238,2 +257,3 @@ before?: BeforeAction; | ||
* Restricts channel to either 'guild' or 'dm'. | ||
* @default null | ||
*/ | ||
@@ -243,2 +263,3 @@ channel?: "guild" | "dm"; | ||
* Permissions required by the client to run this command. | ||
* @default this.clientPermissions | ||
*/ | ||
@@ -248,2 +269,3 @@ clientPermissions?: PermissionResolvable | PermissionResolvable[] | MissingPermissionSupplier; | ||
* Whether or not to run on messages that are not directly commands. | ||
* @default this.condition || (() => false) | ||
*/ | ||
@@ -253,2 +275,3 @@ condition?: ExecutionPredicate; | ||
* The command cooldown in milliseconds. | ||
* @default null | ||
*/ | ||
@@ -258,2 +281,3 @@ cooldown?: number; | ||
* Description of the command. | ||
* @default "" | ||
*/ | ||
@@ -263,2 +287,3 @@ description?: string | any | any[]; | ||
* Whether or not message edits will run this command. | ||
* @default true | ||
*/ | ||
@@ -268,2 +293,3 @@ editable?: boolean; | ||
* Flags to use when using an ArgumentGenerator | ||
* @default [] | ||
*/ | ||
@@ -285,2 +311,3 @@ flags?: string[]; | ||
* Whether or not to only allow the command to be run in NSFW channels. | ||
* @default false | ||
*/ | ||
@@ -290,2 +317,3 @@ onlyNsfw?: boolean; | ||
* Option flags to use when using an ArgumentGenerator. | ||
* @default [] | ||
*/ | ||
@@ -295,2 +323,3 @@ optionFlags?: string[]; | ||
* Whether or not to allow client owner(s) only. | ||
* @default false | ||
*/ | ||
@@ -300,2 +329,3 @@ ownerOnly?: boolean; | ||
* The prefix(es) to overwrite the global one for this command. | ||
* @default this.prefix | ||
*/ | ||
@@ -305,2 +335,3 @@ prefix?: string | string[] | PrefixSupplier; | ||
* Whether or not to consider quotes. | ||
* @default true | ||
*/ | ||
@@ -310,2 +341,3 @@ quoted?: boolean; | ||
* Amount of command uses allowed until cooldown. | ||
* @default 1 | ||
*/ | ||
@@ -315,2 +347,3 @@ ratelimit?: number; | ||
* A regex to match in messages that are not directly commands. The args object will have `match` and `matches` properties. | ||
* @default this.regex | ||
*/ | ||
@@ -324,6 +357,15 @@ regex?: RegExp | RegexSupplier; | ||
* Mark command as slash command and set information. | ||
* @default false | ||
*/ | ||
slash?: boolean; | ||
/** | ||
* The default permission to set when creating the slash command. | ||
* | ||
* **Note:** Requires `useSlashPermissions` to be enabled in the command handler | ||
* @default this.handler.useSlashPermissions ? !this.ownerOnly : true | ||
*/ | ||
slashDefaultPermission?: boolean; | ||
/** | ||
* Whether slash command responses for this command should be ephemeral or not. | ||
* @default false | ||
*/ | ||
@@ -333,2 +375,3 @@ slashEphemeral?: boolean; | ||
* Assign slash commands to Specific guilds. This option will make the commands not register globally, but only to the chosen servers. | ||
* @default [] | ||
*/ | ||
@@ -341,3 +384,12 @@ slashGuilds?: string[]; | ||
/** | ||
* The slash permissions to set in each guild for this command. | ||
*/ | ||
slashPermissions?: ApplicationCommandPermissionData[] | SlashPermissionsSupplier; | ||
/** | ||
* Only allow this command to be used as a slash command. Also makes `slash` `true` | ||
*/ | ||
slashOnly?: boolean; | ||
/** | ||
* Whether or not to allow client superUsers(s) only. | ||
* @default false | ||
*/ | ||
@@ -347,2 +399,3 @@ superUserOnly?: boolean; | ||
* Whether or not to type in channel during execution. | ||
* @default false | ||
*/ | ||
@@ -352,8 +405,5 @@ typing?: boolean; | ||
* Permissions required by the user to run this command. | ||
* @default this.userPermissions | ||
*/ | ||
userPermissions?: PermissionResolvable | PermissionResolvable[] | MissingPermissionSupplier; | ||
/** | ||
* Only allow this command to be used as a slash command. Also makes `slash` `true` | ||
*/ | ||
slashOnly?: boolean; | ||
} | ||
@@ -383,2 +433,7 @@ /** | ||
/** | ||
* A function used to create slash permissions depending on the guild. | ||
* @param guild The guild to create slash permissions for. | ||
*/ | ||
export declare type SlashPermissionsSupplier = (guild: Guild) => ApplicationCommandPermissionData[]; | ||
/** | ||
* A function used to return a regular expression. | ||
@@ -411,2 +466,18 @@ * @param message - Message to get regex for. | ||
} | ||
export interface AkairoApplicationCommandAutocompleteOption extends ApplicationCommandAutocompleteOption { | ||
/** | ||
* Allows you to get a discord resolved object | ||
* | ||
* ex. get the resolved member object when the type is `USER` | ||
*/ | ||
resolve?: SlashResolveTypes; | ||
} | ||
export interface AkairoApplicationCommandNumericOptionData extends ApplicationCommandNumericOptionData { | ||
/** | ||
* Allows you to get a discord resolved object | ||
* | ||
* ex. get the resolved member object when the type is `USER` | ||
*/ | ||
resolve?: SlashResolveTypes; | ||
} | ||
export interface AkairoApplicationCommandNonOptionsData extends ApplicationCommandNonOptionsData { | ||
@@ -428,3 +499,3 @@ /** | ||
} | ||
export declare type AkairoApplicationCommandOptionData = AkairoApplicationCommandSubGroupData | AkairoApplicationCommandNonOptionsData | AkairoApplicationCommandChannelOptionData | AkairoApplicationCommandChoicesData | AkairoApplicationCommandSubCommandData; | ||
export declare type AkairoApplicationCommandOptionData = AkairoApplicationCommandSubGroupData | AkairoApplicationCommandNonOptionsData | AkairoApplicationCommandChannelOptionData | AkairoApplicationCommandChoicesData | AkairoApplicationCommandAutocompleteOption | AkairoApplicationCommandNumericOptionData | AkairoApplicationCommandSubCommandData; | ||
export declare type SlashOption = AkairoApplicationCommandOptionData & { | ||
@@ -431,0 +502,0 @@ /** |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const AkairoError_js_1 = (0, tslib_1.__importDefault)(require("../../util/AkairoError.js")); | ||
const AkairoModule_js_1 = (0, tslib_1.__importDefault)(require("../AkairoModule.js")); | ||
const Argument_js_1 = (0, tslib_1.__importDefault)(require("./arguments/Argument.js")); | ||
const ArgumentRunner_js_1 = (0, tslib_1.__importDefault)(require("./arguments/ArgumentRunner.js")); | ||
const ContentParser_js_1 = (0, tslib_1.__importDefault)(require("./ContentParser.js")); | ||
const AkairoError_js_1 = __importDefault(require("../../util/AkairoError.js")); | ||
const AkairoModule_js_1 = __importDefault(require("../AkairoModule.js")); | ||
const Argument_js_1 = __importDefault(require("./arguments/Argument.js")); | ||
const ArgumentRunner_js_1 = __importDefault(require("./arguments/ArgumentRunner.js")); | ||
const ContentParser_js_1 = __importDefault(require("./ContentParser.js")); | ||
/** | ||
@@ -19,3 +21,3 @@ * Represents a command. | ||
super(id, { category: options?.category }); | ||
const { onlyNsfw = false, aliases = [], args = this._args || this.args || [], quoted = true, separator, channel = null, ownerOnly = false, superUserOnly = false, editable = true, typing = false, cooldown = null, ratelimit = 1, argumentDefaults = {}, description = "", prefix = this.prefix, clientPermissions = this.clientPermissions, userPermissions = this.userPermissions, regex = this.regex, condition = this.condition || (() => false), before = this.before || (() => undefined), lock, ignoreCooldown, ignorePermissions, flags = [], optionFlags = [], slash = false, slashOptions, slashEphemeral = false, slashGuilds = [], slashOnly = false } = options; | ||
const { aliases = [], args = this._args || this.args || [], argumentDefaults = {}, before = this.before || (() => undefined), channel = null, clientPermissions = this.clientPermissions, condition = this.condition || (() => false), cooldown = null, description = "", editable = true, flags = [], ignoreCooldown, ignorePermissions, lock, onlyNsfw = false, optionFlags = [], ownerOnly = false, prefix = this.prefix, quoted = true, ratelimit = 1, regex = this.regex, separator, slash = false, slashDefaultPermission = this.handler.useSlashPermissions ? !this.ownerOnly : true, slashEphemeral = false, slashGuilds = [], slashOnly = false, slashOptions, slashPermissions, superUserOnly = false, typing = false, userPermissions = this.userPermissions } = options; | ||
this.aliases = aliases; | ||
@@ -35,19 +37,19 @@ const { flagWords, optionFlagWords } = Array.isArray(args) | ||
: args.bind(this)); | ||
this.argumentDefaults = argumentDefaults; | ||
this.before = before.bind(this); | ||
this.channel = channel; | ||
this.clientPermissions = typeof clientPermissions === "function" ? clientPermissions.bind(this) : clientPermissions; | ||
this.condition = condition.bind(this); | ||
this.cooldown = cooldown; | ||
this.description = Array.isArray(description) ? description.join("\n") : description; | ||
this.editable = Boolean(editable); | ||
this.lock = lock; | ||
this.onlyNsfw = Boolean(onlyNsfw); | ||
this.channel = channel; | ||
this.ownerOnly = Boolean(ownerOnly); | ||
this.prefix = typeof prefix === "function" ? prefix.bind(this) : prefix; | ||
this.ratelimit = ratelimit; | ||
this.regex = typeof regex === "function" ? regex.bind(this) : regex; | ||
this.superUserOnly = Boolean(superUserOnly); | ||
this.editable = Boolean(editable); | ||
this.typing = Boolean(typing); | ||
this.cooldown = cooldown; | ||
this.ratelimit = ratelimit; | ||
this.argumentDefaults = argumentDefaults; | ||
this.description = Array.isArray(description) ? description.join("\n") : description; | ||
this.prefix = typeof prefix === "function" ? prefix.bind(this) : prefix; | ||
this.clientPermissions = typeof clientPermissions === "function" ? clientPermissions.bind(this) : clientPermissions; | ||
this.userPermissions = typeof userPermissions === "function" ? userPermissions.bind(this) : userPermissions; | ||
this.regex = typeof regex === "function" ? regex.bind(this) : regex; | ||
this.condition = condition.bind(this); | ||
this.before = before.bind(this); | ||
this.lock = lock; | ||
if (typeof lock === "string") { | ||
@@ -64,7 +66,9 @@ this.lock = { | ||
this.ignorePermissions = typeof ignorePermissions === "function" ? ignorePermissions.bind(this) : ignorePermissions; | ||
this.slashOptions = slashOptions; | ||
this.slash = slash; | ||
this.slashDefaultPermission = slashDefaultPermission; | ||
this.slashEphemeral = slashEphemeral; | ||
this.slash = slash; | ||
this.slashGuilds = slashGuilds; | ||
this.slashOnly = slashOnly; | ||
this.slashOptions = slashOptions; | ||
this.slashPermissions = typeof slashPermissions === "function" ? slashPermissions.bind(this) : slashPermissions; | ||
} | ||
@@ -106,2 +110,7 @@ /** | ||
/** | ||
* Respond to autocomplete interactions for this command. | ||
* @param interaction The autocomplete interaction | ||
*/ | ||
autocomplete(interaction) { } | ||
/** | ||
* Parses content using the command's arguments. | ||
@@ -108,0 +117,0 @@ * @param message - Message to use. |
/// <reference types="node" /> | ||
import { Awaitable, Collection, CommandInteraction, Message, Snowflake, TextBasedChannels, User } from "discord.js"; | ||
import { AutocompleteInteraction, Awaitable, Collection, CommandInteraction, Message, Snowflake, TextBasedChannels, User } from "discord.js"; | ||
import type { CommandHandlerEvents as CommandHandlerEventsType } from "../../typings/events"; | ||
@@ -197,2 +197,3 @@ import AkairoMessage from "../../util/AkairoMessage.js"; | ||
handleSlash(interaction: CommandInteraction): Promise<boolean | null>; | ||
handleAutocomplete(interaction: AutocompleteInteraction): void; | ||
/** | ||
@@ -199,0 +200,0 @@ * Handles normal commands. |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const discord_js_1 = require("discord.js"); | ||
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash")); | ||
const AkairoError_js_1 = (0, tslib_1.__importDefault)(require("../../util/AkairoError.js")); | ||
const AkairoMessage_js_1 = (0, tslib_1.__importDefault)(require("../../util/AkairoMessage.js")); | ||
const lodash_1 = __importDefault(require("lodash")); | ||
const AkairoError_js_1 = __importDefault(require("../../util/AkairoError.js")); | ||
const AkairoMessage_js_1 = __importDefault(require("../../util/AkairoMessage.js")); | ||
const Constants_js_1 = require("../../util/Constants.js"); | ||
const Util_js_1 = (0, tslib_1.__importDefault)(require("../../util/Util.js")); | ||
const AkairoHandler_js_1 = (0, tslib_1.__importDefault)(require("../AkairoHandler.js")); | ||
const ContextMenuCommandHandler_js_1 = (0, tslib_1.__importDefault)(require("../contextMenuCommands/ContextMenuCommandHandler.js")); | ||
const TypeResolver_js_1 = (0, tslib_1.__importDefault)(require("./arguments/TypeResolver.js")); | ||
const Command_1 = (0, tslib_1.__importDefault)(require("./Command")); | ||
const CommandUtil_js_1 = (0, tslib_1.__importDefault)(require("./CommandUtil.js")); | ||
const Flag_js_1 = (0, tslib_1.__importDefault)(require("./Flag.js")); | ||
const Util_js_1 = __importDefault(require("../../util/Util.js")); | ||
const AkairoHandler_js_1 = __importDefault(require("../AkairoHandler.js")); | ||
const ContextMenuCommandHandler_js_1 = __importDefault(require("../contextMenuCommands/ContextMenuCommandHandler.js")); | ||
const TypeResolver_js_1 = __importDefault(require("./arguments/TypeResolver.js")); | ||
const Command_1 = __importDefault(require("./Command")); | ||
const CommandUtil_js_1 = __importDefault(require("./CommandUtil.js")); | ||
const Flag_js_1 = __importDefault(require("./Flag.js")); | ||
/** | ||
@@ -115,5 +117,6 @@ * Loads commands and handles messages. | ||
this.client.on("interactionCreate", i => { | ||
if (!i.isCommand()) | ||
return; | ||
this.handleSlash(i); | ||
if (i.isCommand()) | ||
this.handleSlash(i); | ||
if (i.isAutocomplete()) | ||
this.handleAutocomplete(i); | ||
}); | ||
@@ -150,3 +153,3 @@ }); | ||
guilds: data.slashGuilds ?? [], | ||
defaultPermission: !(data.ownerOnly || /* data.superUserOnly || */ false), | ||
defaultPermission: data.slashDefaultPermission, | ||
type: "CHAT_INPUT" | ||
@@ -219,17 +222,25 @@ }); | ||
async updateInteractionPermissions(owners /* superUsers: Snowflake | Snowflake[] */) { | ||
const mapCom = (value) => { | ||
const mapCom = (value, guild) => { | ||
const command = this.modules.find(mod => mod.aliases[0] === value.name); | ||
let allowedUsers = []; | ||
/* if (command.superUserOnly) allowedUsers.push(...Util.intoArray(superUsers)); */ | ||
if (command?.ownerOnly) | ||
allowedUsers.push(...Util_js_1.default.intoArray(owners)); | ||
allowedUsers = [...new Set(allowedUsers)]; // remove duplicates | ||
return { | ||
id: value.id, | ||
permissions: allowedUsers.map(u => ({ | ||
id: u, | ||
type: "USER", | ||
permission: true | ||
})) | ||
}; | ||
if (!command?.slashPermissions) { | ||
let allowedUsers = []; | ||
/* if (command.superUserOnly) allowedUsers.push(...Util.intoArray(superUsers)); */ | ||
if (command?.ownerOnly) | ||
allowedUsers.push(...Util_js_1.default.intoArray(owners)); | ||
allowedUsers = [...new Set(allowedUsers)]; // remove duplicates | ||
return { | ||
id: value.id, | ||
permissions: allowedUsers.map(u => ({ | ||
id: u, | ||
type: "USER", | ||
permission: true | ||
})) | ||
}; | ||
} | ||
else { | ||
return { | ||
id: value.id, | ||
permissions: typeof command.slashPermissions === "function" ? command.slashPermissions(guild) : command.slashPermissions | ||
}; | ||
} | ||
}; | ||
@@ -239,9 +250,8 @@ const globalCommands = (await this.client.application?.commands.fetch())?.filter(value => Boolean(this.modules.find(mod => mod.aliases[0] === value.name))); | ||
?.filter(value => !value.defaultPermission) | ||
.filter(value => Boolean(this.modules.find(mod => mod.aliases[0] === value.name))) | ||
.map(value => mapCom(value)); | ||
.filter(value => Boolean(this.modules.find(mod => mod.aliases[0] === value.name))); | ||
const promises = this.client.guilds.cache.map(async (guild) => { | ||
const perms = new Array(...(fullPermissions ?? [])); | ||
const perms = new Array(...((fullPermissions ?? new discord_js_1.Collection()).map(value => mapCom(value, guild)) ?? [])); | ||
await guild.commands.fetch(); | ||
if (guild.commands.cache.size) | ||
perms.push(...guild.commands.cache.filter(value => !value.defaultPermission).map(value => mapCom(value))); | ||
perms.push(...guild.commands.cache.filter(value => !value.defaultPermission).map(value => mapCom(value, guild))); | ||
if (guild.available) | ||
@@ -565,2 +575,10 @@ return guild.commands.permissions.set({ | ||
} | ||
handleAutocomplete(interaction) { | ||
const commandModule = this.findCommand(interaction.commandName); | ||
if (!commandModule) { | ||
this.emit(Constants_js_1.CommandHandlerEvents.SLASH_NOT_FOUND, interaction); | ||
return; | ||
} | ||
commandModule.autocomplete(interaction); | ||
} | ||
/** | ||
@@ -567,0 +585,0 @@ * Handles normal commands. |
@@ -0,0 +0,0 @@ import { APIMessage } from "discord-api-types"; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const discord_js_1 = require("discord.js"); | ||
const AkairoMessage_js_1 = (0, tslib_1.__importDefault)(require("../../util/AkairoMessage.js")); | ||
const CommandHandler_js_1 = (0, tslib_1.__importDefault)(require("./CommandHandler.js")); | ||
const AkairoMessage_js_1 = __importDefault(require("../../util/AkairoMessage.js")); | ||
const CommandHandler_js_1 = __importDefault(require("./CommandHandler.js")); | ||
/** | ||
@@ -8,0 +10,0 @@ * Command utilities. |
@@ -0,0 +0,0 @@ import type { ArgumentOptions } from "./arguments/Argument.js"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import type { Message } from "discord.js"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import type { ContextMenuInteraction, Snowflake } from "discord.js"; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const AkairoError_js_1 = (0, tslib_1.__importDefault)(require("../../util/AkairoError.js")); | ||
const AkairoModule_js_1 = (0, tslib_1.__importDefault)(require("../AkairoModule.js")); | ||
const AkairoError_js_1 = __importDefault(require("../../util/AkairoError.js")); | ||
const AkairoModule_js_1 = __importDefault(require("../AkairoModule.js")); | ||
/** | ||
@@ -7,0 +9,0 @@ * Represents a context menu command. |
@@ -0,0 +0,0 @@ import type { Awaitable, Collection, ContextMenuInteraction } from "discord.js"; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const AkairoError_js_1 = (0, tslib_1.__importDefault)(require("../../util/AkairoError.js")); | ||
const AkairoError_js_1 = __importDefault(require("../../util/AkairoError.js")); | ||
const Constants_js_1 = require("../../util/Constants.js"); | ||
const AkairoHandler_js_1 = (0, tslib_1.__importDefault)(require("../AkairoHandler.js")); | ||
const ContextMenuCommand_js_1 = (0, tslib_1.__importDefault)(require("./ContextMenuCommand.js")); | ||
const AkairoHandler_js_1 = __importDefault(require("../AkairoHandler.js")); | ||
const ContextMenuCommand_js_1 = __importDefault(require("./ContextMenuCommand.js")); | ||
/** | ||
@@ -9,0 +11,0 @@ * Loads context menu commands and handles them. |
@@ -0,0 +0,0 @@ import type { Message } from "discord.js"; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const AkairoError_js_1 = (0, tslib_1.__importDefault)(require("../../util/AkairoError.js")); | ||
const AkairoModule_js_1 = (0, tslib_1.__importDefault)(require("../AkairoModule.js")); | ||
const AkairoError_js_1 = __importDefault(require("../../util/AkairoError.js")); | ||
const AkairoModule_js_1 = __importDefault(require("../AkairoModule.js")); | ||
/** | ||
@@ -7,0 +9,0 @@ * Represents an inhibitor. |
@@ -0,0 +0,0 @@ import type { Awaitable, Collection, Message } from "discord.js"; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const AkairoError_js_1 = (0, tslib_1.__importDefault)(require("../../util/AkairoError.js")); | ||
const Util_js_1 = (0, tslib_1.__importDefault)(require("../../util/Util.js")); | ||
const AkairoHandler_js_1 = (0, tslib_1.__importDefault)(require("../AkairoHandler.js")); | ||
const Inhibitor_js_1 = (0, tslib_1.__importDefault)(require("./Inhibitor.js")); | ||
const AkairoError_js_1 = __importDefault(require("../../util/AkairoError.js")); | ||
const Util_js_1 = __importDefault(require("../../util/Util.js")); | ||
const AkairoHandler_js_1 = __importDefault(require("../AkairoHandler.js")); | ||
const Inhibitor_js_1 = __importDefault(require("./Inhibitor.js")); | ||
/** | ||
@@ -9,0 +11,0 @@ * Loads inhibitors and checks messages. |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const AkairoError_js_1 = (0, tslib_1.__importDefault)(require("../../util/AkairoError.js")); | ||
const AkairoModule_js_1 = (0, tslib_1.__importDefault)(require("../AkairoModule.js")); | ||
const AkairoError_js_1 = __importDefault(require("../../util/AkairoError.js")); | ||
const AkairoModule_js_1 = __importDefault(require("../AkairoModule.js")); | ||
/** | ||
@@ -7,0 +9,0 @@ * Represents a listener. |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const discord_js_1 = require("discord.js"); | ||
const AkairoError_js_1 = (0, tslib_1.__importDefault)(require("../../util/AkairoError.js")); | ||
const Util_js_1 = (0, tslib_1.__importDefault)(require("../../util/Util.js")); | ||
const AkairoHandler_js_1 = (0, tslib_1.__importDefault)(require("../AkairoHandler.js")); | ||
const Listener_js_1 = (0, tslib_1.__importDefault)(require("./Listener.js")); | ||
const AkairoError_js_1 = __importDefault(require("../../util/AkairoError.js")); | ||
const Util_js_1 = __importDefault(require("../../util/Util.js")); | ||
const AkairoHandler_js_1 = __importDefault(require("../AkairoHandler.js")); | ||
const Listener_js_1 = __importDefault(require("./Listener.js")); | ||
/** | ||
@@ -10,0 +12,0 @@ * Loads listeners and registers them with EventEmitters. |
@@ -0,0 +0,0 @@ import type Category from "../../util/Category.js"; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
/* eslint-disable func-names, @typescript-eslint/no-unused-vars */ | ||
const AkairoError_js_1 = (0, tslib_1.__importDefault)(require("../../util/AkairoError.js")); | ||
const AkairoModule_js_1 = (0, tslib_1.__importDefault)(require("../AkairoModule.js")); | ||
const AkairoError_js_1 = __importDefault(require("../../util/AkairoError.js")); | ||
const AkairoModule_js_1 = __importDefault(require("../AkairoModule.js")); | ||
/** | ||
@@ -8,0 +10,0 @@ * Represents a task. |
@@ -0,0 +0,0 @@ import type { Awaitable, Collection } from "discord.js"; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const AkairoError_js_1 = (0, tslib_1.__importDefault)(require("../../util/AkairoError.js")); | ||
const AkairoHandler_js_1 = (0, tslib_1.__importDefault)(require("../AkairoHandler.js")); | ||
const Task_js_1 = (0, tslib_1.__importDefault)(require("./Task.js")); | ||
const AkairoError_js_1 = __importDefault(require("../../util/AkairoError.js")); | ||
const AkairoHandler_js_1 = __importDefault(require("../AkairoHandler.js")); | ||
const Task_js_1 = __importDefault(require("./Task.js")); | ||
/** | ||
@@ -8,0 +10,0 @@ * Loads tasks. |
@@ -0,0 +0,0 @@ import type { ClientEvents, CommandInteraction, ContextMenuInteraction, Message } from "discord.js"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=events.js.map |
import type { DMChannel, PartialDMChannel, TextBasedChannels } from "discord.js"; | ||
export declare type GuildTextBasedChannels = Exclude<TextBasedChannels, PartialDMChannel | DMChannel>; | ||
//# sourceMappingURL=guildTextBasedChannels.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=guildTextBasedChannels.js.map |
@@ -0,0 +0,0 @@ declare const Messages: { |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import type { APIInteractionGuildMember, APIMessage } from "discord-api-types/v9"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { Collection } from "discord.js"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export declare enum ArgumentMatches { |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "@notenoughupdates/discord-akairo", | ||
"version": "9.0.8-dev.1636663997.73c25d1", | ||
"version": "9.0.8", | ||
"description": "A highly customizable bot framework for Discord.js.", | ||
@@ -38,21 +38,22 @@ "main": "./dist/src/index.js", | ||
"lodash": "^4.17.21", | ||
"source-map-support": "^0.5.20" | ||
"source-map-support": "^0.5.21" | ||
}, | ||
"devDependencies": { | ||
"@discordjs/voice": "^0.7.1", | ||
"@discordjs/voice": "^0.7.5", | ||
"@favware/npm-deprecate": "^1.0.4", | ||
"@types/lodash": "^4.14.176", | ||
"@types/node": "^16.11.6", | ||
"@types/lodash": "^4.14.177", | ||
"@types/node": "^16.11.10", | ||
"@types/source-map-support": "^0.5.4", | ||
"@typescript-eslint/eslint-plugin": "^5.2.0", | ||
"@typescript-eslint/parser": "^5.2.0", | ||
"@typescript-eslint/eslint-plugin": "^5.4.0", | ||
"@typescript-eslint/parser": "^5.4.0", | ||
"discord-api-types": "0.24.0", | ||
"discord.js": "npm:@notenoughupdates/discord.js@dev", | ||
"discord.js-docgen": "discordjs/docgen", | ||
"eslint": "^8.1.0", | ||
"eslint": "^8.3.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"jsdoc": "^3.6.7", | ||
"prettier": "^2.4.1", | ||
"prettier": "^2.5.0", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.4.4" | ||
"typedoc": "^0.22.10", | ||
"typescript": "^4.5.2" | ||
}, | ||
@@ -85,6 +86,3 @@ "prettier": { | ||
"sourceType": "module", | ||
"project": "./tsconfig-eslint.json", | ||
"extraFileExtensions": [ | ||
".mjs" | ||
] | ||
"project": "./tsconfig-eslint.json" | ||
}, | ||
@@ -91,0 +89,0 @@ "env": { |
@@ -15,2 +15,3 @@ import "source-map-support/register"; | ||
ArgumentTypeCaster_, | ||
BaseArgumentType, | ||
DefaultArgumentOptions, | ||
@@ -25,7 +26,10 @@ DefaultValueSupplier, | ||
} from "./struct/commands/arguments/Argument"; | ||
import ArgumentRunner, { ArgumentRunnerState } from "./struct/commands/arguments/ArgumentRunner"; | ||
import TypeResolver from "./struct/commands/arguments/TypeResolver"; | ||
import Command, { | ||
AkairoApplicationCommandAutocompleteOption, | ||
AkairoApplicationCommandChannelOptionData, | ||
AkairoApplicationCommandChoicesData, | ||
AkairoApplicationCommandNonOptionsData, | ||
AkairoApplicationCommandNumericOptionData, | ||
AkairoApplicationCommandOptionData, | ||
@@ -41,3 +45,4 @@ AkairoApplicationCommandSubCommandData, | ||
RegexSupplier, | ||
SlashOption | ||
SlashOption, | ||
SlashPermissionsSupplier | ||
} from "./struct/commands/Command"; | ||
@@ -54,2 +59,8 @@ import CommandHandler, { | ||
import CommandUtil from "./struct/commands/CommandUtil"; | ||
import ContentParser, { | ||
ContentParserOptions, | ||
ContentParserResult, | ||
ExtractedFlags, | ||
StringData | ||
} from "./struct/commands/ContentParser"; | ||
import Flag from "./struct/commands/Flag"; | ||
@@ -60,3 +71,3 @@ import ContextMenuCommand, { ContextMenuCommandOptions } from "./struct/contextMenuCommands/ContextMenuCommand"; | ||
import InhibitorHandler from "./struct/inhibitors/InhibitorHandler"; | ||
import Listener, { ListenerOptions } from "./struct/listeners/Listener"; | ||
import Listener, { ListenerOptions, ListenerType } from "./struct/listeners/Listener"; | ||
import ListenerHandler from "./struct/listeners/ListenerHandler"; | ||
@@ -69,2 +80,3 @@ import Task, { TaskOptions } from "./struct/tasks/Task"; | ||
CommandHandlerEvents, | ||
ContextMenuCommandHandlerEvents, | ||
InhibitorHandlerEvents, | ||
@@ -80,2 +92,3 @@ ListenerHandlerEvents, | ||
import Util from "./util/Util"; | ||
const version = packageJSON.version; | ||
@@ -103,2 +116,4 @@ | ||
Argument, | ||
ArgumentRunner, | ||
ArgumentRunnerState, | ||
Category, | ||
@@ -110,2 +125,4 @@ ClientUtil, | ||
Constants, | ||
ContentParser, | ||
ContentParserResult, | ||
ContextMenuCommand, | ||
@@ -126,5 +143,7 @@ ContextMenuCommandHandler, | ||
export type { | ||
AkairoApplicationCommandAutocompleteOption, | ||
AkairoApplicationCommandChannelOptionData, | ||
AkairoApplicationCommandChoicesData, | ||
AkairoApplicationCommandNonOptionsData, | ||
AkairoApplicationCommandNumericOptionData, | ||
AkairoApplicationCommandOptionData, | ||
@@ -146,2 +165,3 @@ AkairoApplicationCommandSubCommandData, | ||
ArgumentTypeCaster, | ||
BaseArgumentType, | ||
BeforeAction, | ||
@@ -151,2 +171,4 @@ CommandHandlerEvents, | ||
CommandOptions, | ||
ContentParserOptions, | ||
ContextMenuCommandHandlerEvents, | ||
ContextMenuCommandOptions, | ||
@@ -157,2 +179,3 @@ CooldownData, | ||
ExecutionPredicate, | ||
ExtractedFlags, | ||
FailureData, | ||
@@ -166,2 +189,3 @@ GuildTextBasedChannels, | ||
ListenerOptions, | ||
ListenerType, | ||
LoadPredicate, | ||
@@ -178,5 +202,7 @@ MentionPrefixPredicate, | ||
SlashOption, | ||
SlashPermissionsSupplier, | ||
SlashResolveTypes, | ||
StringData, | ||
TaskHandlerEvents, | ||
TaskOptions | ||
}; |
@@ -867,2 +867,48 @@ import type { Message, MessageOptions, MessagePayload } from "discord.js"; | ||
/** | ||
* * - `string` does not cast to any type. | ||
* - `lowercase` makes the input lowercase. | ||
* - `uppercase` makes the input uppercase. | ||
* - `charCodes` transforms the input to an array of char codes. | ||
* - `number` casts to a number. | ||
* - `integer` casts to an integer. | ||
* - `bigint` casts to a big integer. | ||
* - `url` casts to an `URL` object. | ||
* - `date` casts to a `Date` object. | ||
* - `color` casts a hex code to an integer. | ||
* - `commandAlias` tries to resolve to a command from an alias. | ||
* - `command` matches the ID of a command. | ||
* - `inhibitor` matches the ID of an inhibitor. | ||
* - `listener` matches the ID of a listener. | ||
* - `task` matches the ID of a task. | ||
* - `contextMenuCommand` matches the ID of a context menu command. | ||
* | ||
* Possible Discord-related types. | ||
* These types can be plural (add an 's' to the end) and a collection of matching objects will be used. | ||
* - `user` tries to resolve to a user. | ||
* - `member` tries to resolve to a member. | ||
* - `relevant` tries to resolve to a relevant user, works in both guilds and DMs. | ||
* - `channel` tries to resolve to a channel. | ||
* - `textChannel` tries to resolve to a text channel. | ||
* - `voiceChannel` tries to resolve to a voice channel. | ||
* - `categoryChannel` tries to resolve to a category channel. | ||
* - `newsChannel` tries to resolve to a news channel. | ||
* - `storeChannel` tries to resolve to a store channel. | ||
* - `stageChannel` tries to resolve to a stage channel. | ||
* - `threadChannel` tries to resolve a thread channel. | ||
* - `role` tries to resolve to a role. | ||
* - `emoji` tries to resolve to a custom emoji. | ||
* - `guild` tries to resolve to a guild. | ||
* | ||
* Other Discord-related types: | ||
* - `message` tries to fetch a message from an ID within the channel. | ||
* - `guildMessage` tries to fetch a message from an ID within the guild. | ||
* - `relevantMessage` is a combination of the above, works in both guilds and DMs. | ||
* - `invite` tries to fetch an invite object from a link. | ||
* - `userMention` matches a mention of a user. | ||
* - `memberMention` matches a mention of a guild member. | ||
* - `channelMention` matches a mention of a channel. | ||
* - `roleMention` matches a mention of a role. | ||
* - `emojiMention` matches a mention of an emoji. | ||
*/ | ||
export type BaseArgumentType = | ||
@@ -926,47 +972,3 @@ | "string" | ||
* The type that the argument should be cast to. | ||
* - `string` does not cast to any type. | ||
* - `lowercase` makes the input lowercase. | ||
* - `uppercase` makes the input uppercase. | ||
* - `charCodes` transforms the input to an array of char codes. | ||
* - `number` casts to a number. | ||
* - `integer` casts to an integer. | ||
* - `bigint` casts to a big integer. | ||
* - `url` casts to an `URL` object. | ||
* - `date` casts to a `Date` object. | ||
* - `color` casts a hex code to an integer. | ||
* - `commandAlias` tries to resolve to a command from an alias. | ||
* - `command` matches the ID of a command. | ||
* - `inhibitor` matches the ID of an inhibitor. | ||
* - `listener` matches the ID of a listener. | ||
* - `task` matches the ID of a task. | ||
* - `contextMenuCommand` matches the ID of a context menu command. | ||
* | ||
* Possible Discord-related types. | ||
* These types can be plural (add an 's' to the end) and a collection of matching objects will be used. | ||
* - `user` tries to resolve to a user. | ||
* - `member` tries to resolve to a member. | ||
* - `relevant` tries to resolve to a relevant user, works in both guilds and DMs. | ||
* - `channel` tries to resolve to a channel. | ||
* - `textChannel` tries to resolve to a text channel. | ||
* - `voiceChannel` tries to resolve to a voice channel. | ||
* - `categoryChannel` tries to resolve to a category channel. | ||
* - `newsChannel` tries to resolve to a news channel. | ||
* - `storeChannel` tries to resolve to a store channel. | ||
* - `stageChannel` tries to resolve to a stage channel. | ||
* - `threadChannel` tries to resolve a thread channel. | ||
* - `role` tries to resolve to a role. | ||
* - `emoji` tries to resolve to a custom emoji. | ||
* - `guild` tries to resolve to a guild. | ||
* | ||
* Other Discord-related types: | ||
* - `message` tries to fetch a message from an ID within the channel. | ||
* - `guildMessage` tries to fetch a message from an ID within the guild. | ||
* - `relevantMessage` is a combination of the above, works in both guilds and DMs. | ||
* - `invite` tries to fetch an invite object from a link. | ||
* - `userMention` matches a mention of a user. | ||
* - `memberMention` matches a mention of a guild member. | ||
* - `channelMention` matches a mention of a channel. | ||
* - `roleMention` matches a mention of a role. | ||
* - `emojiMention` matches a mention of an emoji. | ||
* | ||
* An array of strings can be used to restrict input to only those strings, case insensitive. | ||
@@ -973,0 +975,0 @@ * The array can also contain an inner array of strings, for aliases. |
/* eslint-disable func-names, @typescript-eslint/no-unused-vars */ | ||
import { | ||
ApplicationCommandAutocompleteOption, | ||
ApplicationCommandChannelOptionData, | ||
ApplicationCommandChoicesData, | ||
ApplicationCommandNonOptionsData, | ||
ApplicationCommandNumericOptionData, | ||
ApplicationCommandPermissionData, | ||
ApplicationCommandSubCommandData, | ||
ApplicationCommandSubGroupData, | ||
AutocompleteInteraction, | ||
Guild, | ||
Message, | ||
@@ -33,2 +38,7 @@ PermissionResolvable, | ||
/** | ||
* Argument options or generator. | ||
*/ | ||
public declare _args?: ArgumentOptions[] | ArgumentGenerator; | ||
/** | ||
* Default prompt options. | ||
@@ -39,2 +49,7 @@ */ | ||
/** | ||
* The argument runner. | ||
*/ | ||
public declare argumentRunner: ArgumentRunner; | ||
/** | ||
* Category the command belongs to. | ||
@@ -62,8 +77,13 @@ */ | ||
*/ | ||
public declare cooldown?: number; | ||
public declare cooldown: number | null; | ||
/** | ||
* The content parser. | ||
*/ | ||
public declare contentParser: ContentParser; | ||
/** | ||
* Description of the command. | ||
*/ | ||
public declare description: any; | ||
public declare description: string | any | any[]; | ||
@@ -146,2 +166,9 @@ /** | ||
/** | ||
* The default permission to set when creating the slash command. | ||
* | ||
* **Note:** Requires the useSlashPermissions to be enabled in the command handler | ||
*/ | ||
public declare slashDefaultPermission: boolean; | ||
/** | ||
* Whether slash command responses for this command should be ephemeral or not. | ||
@@ -162,2 +189,12 @@ */ | ||
/** | ||
* The slash permissions to set in each guild for this command. | ||
*/ | ||
public declare slashPermissions?: ApplicationCommandPermissionData[] | SlashPermissionsSupplier; | ||
/** | ||
* Only allows this command to be executed as a slash command. | ||
*/ | ||
public declare slashOnly: boolean; | ||
/** | ||
* Whether or not to allow client superUsers(s) only. | ||
@@ -178,22 +215,2 @@ */ | ||
/** | ||
* Argument options or generator. | ||
*/ | ||
public declare _args?: ArgumentOptions[] | ArgumentGenerator; | ||
/** | ||
* The content parser. | ||
*/ | ||
public declare contentParser: ContentParser; | ||
/** | ||
* The argument runner. | ||
*/ | ||
public declare argumentRunner: ArgumentRunner; | ||
/** | ||
* Only allows this command to be executed as a slash command. | ||
*/ | ||
public declare slashOnly: boolean; | ||
/** | ||
* Generator for arguments. | ||
@@ -211,32 +228,34 @@ */ | ||
const { | ||
onlyNsfw = false, | ||
aliases = [], | ||
args = this._args || this.args || [], | ||
quoted = true, | ||
separator, | ||
channel = null!, | ||
ownerOnly = false, | ||
superUserOnly = false, | ||
editable = true, | ||
typing = false, | ||
cooldown = null!, | ||
ratelimit = 1, | ||
argumentDefaults = {}, | ||
description = "", | ||
prefix = this.prefix, | ||
before = this.before || (() => undefined), | ||
channel = null, | ||
clientPermissions = this.clientPermissions, | ||
userPermissions = this.userPermissions, | ||
regex = this.regex, | ||
condition = this.condition || (() => false), | ||
before = this.before || (() => undefined), | ||
lock, | ||
cooldown = null, | ||
description = "", | ||
editable = true, | ||
flags = [], | ||
ignoreCooldown, | ||
ignorePermissions, | ||
flags = [], | ||
lock, | ||
onlyNsfw = false, | ||
optionFlags = [], | ||
ownerOnly = false, | ||
prefix = this.prefix, | ||
quoted = true, | ||
ratelimit = 1, | ||
regex = this.regex, | ||
separator, | ||
slash = false, | ||
slashOptions, | ||
slashDefaultPermission = this.handler.useSlashPermissions ? !this.ownerOnly : true, | ||
slashEphemeral = false, | ||
slashGuilds = [], | ||
slashOnly = false | ||
slashOnly = false, | ||
slashOptions, | ||
slashPermissions, | ||
superUserOnly = false, | ||
typing = false, | ||
userPermissions = this.userPermissions | ||
} = options; | ||
@@ -259,19 +278,19 @@ this.aliases = aliases; | ||
) as ArgumentGenerator; | ||
this.argumentDefaults = argumentDefaults; | ||
this.before = before.bind(this); | ||
this.channel = channel!; | ||
this.clientPermissions = typeof clientPermissions === "function" ? clientPermissions.bind(this) : clientPermissions; | ||
this.condition = condition.bind(this); | ||
this.cooldown = cooldown!; | ||
this.description = Array.isArray(description) ? description.join("\n") : description; | ||
this.editable = Boolean(editable); | ||
this.lock = lock; | ||
this.onlyNsfw = Boolean(onlyNsfw); | ||
this.channel = channel!; | ||
this.ownerOnly = Boolean(ownerOnly); | ||
this.prefix = typeof prefix === "function" ? prefix.bind(this) : prefix; | ||
this.ratelimit = ratelimit; | ||
this.regex = typeof regex === "function" ? regex.bind(this) : regex; | ||
this.superUserOnly = Boolean(superUserOnly); | ||
this.editable = Boolean(editable); | ||
this.typing = Boolean(typing); | ||
this.cooldown = cooldown!; | ||
this.ratelimit = ratelimit; | ||
this.argumentDefaults = argumentDefaults; | ||
this.description = Array.isArray(description) ? description.join("\n") : description; | ||
this.prefix = typeof prefix === "function" ? prefix.bind(this) : prefix; | ||
this.clientPermissions = typeof clientPermissions === "function" ? clientPermissions.bind(this) : clientPermissions; | ||
this.userPermissions = typeof userPermissions === "function" ? userPermissions.bind(this) : userPermissions; | ||
this.regex = typeof regex === "function" ? regex.bind(this) : regex; | ||
this.condition = condition.bind(this); | ||
this.before = before.bind(this); | ||
this.lock = lock; | ||
if (typeof lock === "string") { | ||
@@ -287,7 +306,9 @@ this.lock = { | ||
this.ignorePermissions = typeof ignorePermissions === "function" ? ignorePermissions.bind(this) : ignorePermissions; | ||
this.slashOptions = slashOptions; | ||
this.slash = slash; | ||
this.slashDefaultPermission = slashDefaultPermission; | ||
this.slashEphemeral = slashEphemeral; | ||
this.slash = slash; | ||
this.slashGuilds = slashGuilds; | ||
this.slashOnly = slashOnly; | ||
this.slashOptions = slashOptions; | ||
this.slashPermissions = typeof slashPermissions === "function" ? slashPermissions.bind(this) : slashPermissions; | ||
} | ||
@@ -346,2 +367,8 @@ | ||
/** | ||
* Respond to autocomplete interactions for this command. | ||
* @param interaction The autocomplete interaction | ||
*/ | ||
public autocomplete(interaction: AutocompleteInteraction): any {} | ||
/** | ||
* Parses content using the command's arguments. | ||
@@ -375,2 +402,3 @@ * @param message - Message to use. | ||
* Command names. | ||
* @default [] | ||
*/ | ||
@@ -381,2 +409,3 @@ aliases?: string[]; | ||
* Argument options or generator. | ||
* @default this._args || this.args || [] | ||
*/ | ||
@@ -387,2 +416,3 @@ args?: ArgumentOptions[] | ArgumentGenerator; | ||
* The default argument options. | ||
* @default {} | ||
*/ | ||
@@ -393,2 +423,3 @@ argumentDefaults?: DefaultArgumentOptions; | ||
* Function to run before argument parsing and execution. | ||
* @default this.before || (() => undefined) | ||
*/ | ||
@@ -399,2 +430,3 @@ before?: BeforeAction; | ||
* Restricts channel to either 'guild' or 'dm'. | ||
* @default null | ||
*/ | ||
@@ -405,2 +437,3 @@ channel?: "guild" | "dm"; | ||
* Permissions required by the client to run this command. | ||
* @default this.clientPermissions | ||
*/ | ||
@@ -411,2 +444,3 @@ clientPermissions?: PermissionResolvable | PermissionResolvable[] | MissingPermissionSupplier; | ||
* Whether or not to run on messages that are not directly commands. | ||
* @default this.condition || (() => false) | ||
*/ | ||
@@ -417,2 +451,3 @@ condition?: ExecutionPredicate; | ||
* The command cooldown in milliseconds. | ||
* @default null | ||
*/ | ||
@@ -423,2 +458,3 @@ cooldown?: number; | ||
* Description of the command. | ||
* @default "" | ||
*/ | ||
@@ -429,2 +465,3 @@ description?: string | any | any[]; | ||
* Whether or not message edits will run this command. | ||
* @default true | ||
*/ | ||
@@ -435,2 +472,3 @@ editable?: boolean; | ||
* Flags to use when using an ArgumentGenerator | ||
* @default [] | ||
*/ | ||
@@ -456,2 +494,3 @@ flags?: string[]; | ||
* Whether or not to only allow the command to be run in NSFW channels. | ||
* @default false | ||
*/ | ||
@@ -462,2 +501,3 @@ onlyNsfw?: boolean; | ||
* Option flags to use when using an ArgumentGenerator. | ||
* @default [] | ||
*/ | ||
@@ -468,2 +508,3 @@ optionFlags?: string[]; | ||
* Whether or not to allow client owner(s) only. | ||
* @default false | ||
*/ | ||
@@ -474,2 +515,3 @@ ownerOnly?: boolean; | ||
* The prefix(es) to overwrite the global one for this command. | ||
* @default this.prefix | ||
*/ | ||
@@ -480,2 +522,3 @@ prefix?: string | string[] | PrefixSupplier; | ||
* Whether or not to consider quotes. | ||
* @default true | ||
*/ | ||
@@ -486,2 +529,3 @@ quoted?: boolean; | ||
* Amount of command uses allowed until cooldown. | ||
* @default 1 | ||
*/ | ||
@@ -492,2 +536,3 @@ ratelimit?: number; | ||
* A regex to match in messages that are not directly commands. The args object will have `match` and `matches` properties. | ||
* @default this.regex | ||
*/ | ||
@@ -503,2 +548,3 @@ regex?: RegExp | RegexSupplier; | ||
* Mark command as slash command and set information. | ||
* @default false | ||
*/ | ||
@@ -508,3 +554,12 @@ slash?: boolean; | ||
/** | ||
* The default permission to set when creating the slash command. | ||
* | ||
* **Note:** Requires `useSlashPermissions` to be enabled in the command handler | ||
* @default this.handler.useSlashPermissions ? !this.ownerOnly : true | ||
*/ | ||
slashDefaultPermission?: boolean; | ||
/** | ||
* Whether slash command responses for this command should be ephemeral or not. | ||
* @default false | ||
*/ | ||
@@ -515,2 +570,3 @@ slashEphemeral?: boolean; | ||
* Assign slash commands to Specific guilds. This option will make the commands not register globally, but only to the chosen servers. | ||
* @default [] | ||
*/ | ||
@@ -525,3 +581,14 @@ slashGuilds?: string[]; | ||
/** | ||
* The slash permissions to set in each guild for this command. | ||
*/ | ||
slashPermissions?: ApplicationCommandPermissionData[] | SlashPermissionsSupplier; | ||
/** | ||
* Only allow this command to be used as a slash command. Also makes `slash` `true` | ||
*/ | ||
slashOnly?: boolean; | ||
/** | ||
* Whether or not to allow client superUsers(s) only. | ||
* @default false | ||
*/ | ||
@@ -532,2 +599,3 @@ superUserOnly?: boolean; | ||
* Whether or not to type in channel during execution. | ||
* @default false | ||
*/ | ||
@@ -538,9 +606,5 @@ typing?: boolean; | ||
* Permissions required by the user to run this command. | ||
* @default this.userPermissions | ||
*/ | ||
userPermissions?: PermissionResolvable | PermissionResolvable[] | MissingPermissionSupplier; | ||
/** | ||
* Only allow this command to be used as a slash command. Also makes `slash` `true` | ||
*/ | ||
slashOnly?: boolean; | ||
} | ||
@@ -575,2 +639,8 @@ | ||
/** | ||
* A function used to create slash permissions depending on the guild. | ||
* @param guild The guild to create slash permissions for. | ||
*/ | ||
export type SlashPermissionsSupplier = (guild: Guild) => ApplicationCommandPermissionData[]; | ||
/** | ||
* A function used to return a regular expression. | ||
@@ -616,2 +686,20 @@ * @param message - Message to get regex for. | ||
export interface AkairoApplicationCommandAutocompleteOption extends ApplicationCommandAutocompleteOption { | ||
/** | ||
* Allows you to get a discord resolved object | ||
* | ||
* ex. get the resolved member object when the type is `USER` | ||
*/ | ||
resolve?: SlashResolveTypes; | ||
} | ||
export interface AkairoApplicationCommandNumericOptionData extends ApplicationCommandNumericOptionData { | ||
/** | ||
* Allows you to get a discord resolved object | ||
* | ||
* ex. get the resolved member object when the type is `USER` | ||
*/ | ||
resolve?: SlashResolveTypes; | ||
} | ||
export interface AkairoApplicationCommandNonOptionsData extends ApplicationCommandNonOptionsData { | ||
@@ -640,2 +728,4 @@ /** | ||
| AkairoApplicationCommandChoicesData | ||
| AkairoApplicationCommandAutocompleteOption | ||
| AkairoApplicationCommandNumericOptionData | ||
| AkairoApplicationCommandSubCommandData; | ||
@@ -642,0 +732,0 @@ |
import { | ||
ApplicationCommand, | ||
ApplicationCommandOptionData, | ||
AutocompleteInteraction, | ||
Awaitable, | ||
@@ -9,2 +10,3 @@ Collection, | ||
CommandInteractionOptionResolver, | ||
Guild, | ||
GuildApplicationCommandPermissionData, | ||
@@ -346,4 +348,4 @@ GuildResolvable, | ||
this.client.on("interactionCreate", i => { | ||
if (!i.isCommand()) return; | ||
this.handleSlash(i); | ||
if (i.isCommand()) this.handleSlash(i); | ||
if (i.isAutocomplete()) this.handleAutocomplete(i); | ||
}); | ||
@@ -395,3 +397,3 @@ }); | ||
guilds: data.slashGuilds ?? [], | ||
defaultPermission: !(data.ownerOnly || /* data.superUserOnly || */ false), | ||
defaultPermission: data.slashDefaultPermission, | ||
type: "CHAT_INPUT" | ||
@@ -483,20 +485,28 @@ }); | ||
const mapCom = ( | ||
value: ApplicationCommand<{ | ||
guild: GuildResolvable; | ||
}> | ||
): { id: string; permissions: { id: string; type: "USER"; permission: boolean }[] } => { | ||
value: ApplicationCommand<{ guild: GuildResolvable }>, | ||
guild: Guild | ||
): GuildApplicationCommandPermissionData => { | ||
const command = this.modules.find(mod => mod.aliases[0] === value.name); | ||
let allowedUsers: string[] = []; | ||
/* if (command.superUserOnly) allowedUsers.push(...Util.intoArray(superUsers)); */ | ||
if (command?.ownerOnly) allowedUsers.push(...Util.intoArray(owners)); | ||
allowedUsers = [...new Set(allowedUsers)]; // remove duplicates | ||
return { | ||
id: value.id, | ||
permissions: allowedUsers.map(u => ({ | ||
id: u, | ||
type: "USER", | ||
permission: true | ||
})) | ||
}; | ||
if (!command?.slashPermissions) { | ||
let allowedUsers: string[] = []; | ||
/* if (command.superUserOnly) allowedUsers.push(...Util.intoArray(superUsers)); */ | ||
if (command?.ownerOnly) allowedUsers.push(...Util.intoArray(owners)); | ||
allowedUsers = [...new Set(allowedUsers)]; // remove duplicates | ||
return { | ||
id: value.id, | ||
permissions: allowedUsers.map(u => ({ | ||
id: u, | ||
type: "USER", | ||
permission: true | ||
})) | ||
}; | ||
} else { | ||
return { | ||
id: value.id, | ||
permissions: | ||
typeof command.slashPermissions === "function" ? command.slashPermissions(guild) : command.slashPermissions | ||
}; | ||
} | ||
}; | ||
@@ -507,12 +517,13 @@ | ||
); | ||
const fullPermissions: GuildApplicationCommandPermissionData[] | undefined = globalCommands | ||
const fullPermissions = globalCommands | ||
?.filter(value => !value.defaultPermission) | ||
.filter(value => Boolean(this.modules.find(mod => mod.aliases[0] === value.name))) | ||
.map(value => mapCom(value)); | ||
.filter(value => Boolean(this.modules.find(mod => mod.aliases[0] === value.name))); | ||
const promises = this.client.guilds.cache.map(async guild => { | ||
const perms = new Array(...(fullPermissions ?? [])); | ||
const perms = new Array(...((fullPermissions ?? new Collection()).map(value => mapCom(value, guild)) ?? [])); | ||
await guild.commands.fetch(); | ||
if (guild.commands.cache.size) | ||
perms.push(...guild.commands.cache.filter(value => !value.defaultPermission).map(value => mapCom(value))); | ||
perms.push( | ||
...guild.commands.cache.filter(value => !value.defaultPermission).map(value => mapCom(value, guild)) | ||
); | ||
if (guild.available) | ||
@@ -865,2 +876,13 @@ return guild.commands.permissions.set({ | ||
public handleAutocomplete(interaction: AutocompleteInteraction): void { | ||
const commandModule = this.findCommand(interaction.commandName); | ||
if (!commandModule) { | ||
this.emit(CommandHandlerEvents.SLASH_NOT_FOUND, interaction); | ||
return; | ||
} | ||
commandModule.autocomplete(interaction); | ||
} | ||
/** | ||
@@ -867,0 +889,0 @@ * Handles normal commands. |
@@ -13,4 +13,4 @@ { | ||
}, | ||
"include": ["src/**/*.ts"], | ||
"include": ["src/**/*.ts", "test/**/*.ts", "test/**/*.js"], | ||
"exclude": ["node_modules", "dist"] | ||
} |
@@ -17,4 +17,4 @@ { | ||
"sourceMap": true, | ||
"noEmitHelpers": true, | ||
"importHelpers": true | ||
"noEmitHelpers": false, | ||
"importHelpers": false | ||
}, | ||
@@ -21,0 +21,0 @@ "include": ["src/**/*.ts"], |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
903512
184
16038
0
0
1
93
17
Updatedsource-map-support@^0.5.21