trivious 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/client/trivious.client.d.ts +1 -2
- package/dist/core/client/trivious.client.js.map +1 -1
- package/dist/core/commands/methods.command.d.ts +1 -2
- package/dist/core/commands/methods.command.js.map +1 -1
- package/dist/core/events/clientReady.d.ts +2 -2
- package/dist/core/events/clientReady.js +1 -0
- package/dist/core/events/clientReady.js.map +1 -1
- package/dist/core/events/interactionCreate.d.ts +1 -2
- package/dist/core/events/interactionCreate.js.map +1 -1
- package/dist/core/registry/command.registry.d.ts +1 -2
- package/dist/core/registry/command.registry.js.map +1 -1
- package/dist/core/registry/component.registry.d.ts +1 -2
- package/dist/core/registry/component.registry.js +2 -2
- package/dist/core/registry/component.registry.js.map +1 -1
- package/dist/core/registry/event.registry.d.ts +1 -2
- package/dist/core/registry/index.d.ts +1 -2
- package/dist/core/registry/module.registry.d.ts +1 -2
- package/dist/{index-D9od1fzU.d.ts → index-C2iWCQmv.d.ts} +118 -84
- package/dist/index.d.ts +1 -2
- package/dist/index.js +0 -1
- package/dist/shared/typings/commands.d.ts +2 -3
- package/dist/shared/typings/components.d.ts +6 -40
- package/dist/shared/typings/components.js.map +1 -1
- package/dist/shared/typings/events.d.ts +1 -2
- package/dist/shared/typings/index.d.ts +1 -2
- package/dist/shared/typings/module.d.ts +1 -2
- package/dist/shared/utility/components.utility.d.ts +5 -1
- package/dist/shared/utility/functions.d.ts +1 -2
- package/dist/shared/utility/permissions.utility.d.ts +1 -2
- package/package.json +1 -1
- package/dist/core/builders/util.builders.cjs +0 -15
- package/dist/core/builders/util.builders.cjs.map +0 -1
- package/dist/core/builders/util.builders.d.cts +0 -21
- package/dist/core/client/trivious.client.cjs +0 -119
- package/dist/core/client/trivious.client.cjs.map +0 -1
- package/dist/core/client/trivious.client.d.cts +0 -7
- package/dist/core/commands/command.base.cjs +0 -4
- package/dist/core/commands/command.base.cjs.map +0 -1
- package/dist/core/commands/command.base.d.cts +0 -7
- package/dist/core/commands/command.base.d.ts +0 -7
- package/dist/core/commands/command.base.js +0 -3
- package/dist/core/commands/command.base.js.map +0 -1
- package/dist/core/commands/methods.command.cjs +0 -55
- package/dist/core/commands/methods.command.cjs.map +0 -1
- package/dist/core/commands/methods.command.d.cts +0 -45
- package/dist/core/components/component.base.cjs +0 -4
- package/dist/core/components/component.base.cjs.map +0 -1
- package/dist/core/components/component.base.d.cts +0 -7
- package/dist/core/components/component.base.d.ts +0 -7
- package/dist/core/components/component.base.js +0 -3
- package/dist/core/components/component.base.js.map +0 -1
- package/dist/core/events/clientReady.cjs +0 -12
- package/dist/core/events/clientReady.cjs.map +0 -1
- package/dist/core/events/clientReady.d.cts +0 -14
- package/dist/core/events/interactionCreate.cjs +0 -90
- package/dist/core/events/interactionCreate.cjs.map +0 -1
- package/dist/core/events/interactionCreate.d.cts +0 -15
- package/dist/core/registry/command.registry.cjs +0 -60
- package/dist/core/registry/command.registry.cjs.map +0 -1
- package/dist/core/registry/command.registry.d.cts +0 -7
- package/dist/core/registry/component.registry.cjs +0 -47
- package/dist/core/registry/component.registry.cjs.map +0 -1
- package/dist/core/registry/component.registry.d.cts +0 -7
- package/dist/core/registry/event.registry.cjs +0 -77
- package/dist/core/registry/event.registry.cjs.map +0 -1
- package/dist/core/registry/event.registry.d.cts +0 -7
- package/dist/core/registry/index.cjs +0 -49
- package/dist/core/registry/index.cjs.map +0 -1
- package/dist/core/registry/index.d.cts +0 -23
- package/dist/core/registry/module.registry.cjs +0 -61
- package/dist/core/registry/module.registry.cjs.map +0 -1
- package/dist/core/registry/module.registry.d.cts +0 -7
- package/dist/index-C56Y6_f-.d.cts +0 -342
- package/dist/index.cjs +0 -63
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -7
- package/dist/shared/typings/client.cjs +0 -4
- package/dist/shared/typings/client.cjs.map +0 -1
- package/dist/shared/typings/client.d.cts +0 -74
- package/dist/shared/typings/commands.cjs +0 -4
- package/dist/shared/typings/commands.cjs.map +0 -1
- package/dist/shared/typings/commands.d.cts +0 -7
- package/dist/shared/typings/components.cjs +0 -12
- package/dist/shared/typings/components.cjs.map +0 -1
- package/dist/shared/typings/components.d.cts +0 -40
- package/dist/shared/typings/events.cjs +0 -4
- package/dist/shared/typings/events.cjs.map +0 -1
- package/dist/shared/typings/events.d.cts +0 -7
- package/dist/shared/typings/index.cjs +0 -56
- package/dist/shared/typings/index.cjs.map +0 -1
- package/dist/shared/typings/index.d.cts +0 -7
- package/dist/shared/typings/module.cjs +0 -4
- package/dist/shared/typings/module.cjs.map +0 -1
- package/dist/shared/typings/module.d.cts +0 -7
- package/dist/shared/typings/permissions.cjs +0 -15
- package/dist/shared/typings/permissions.cjs.map +0 -1
- package/dist/shared/typings/permissions.d.cts +0 -16
- package/dist/shared/typings/registry.cjs +0 -63
- package/dist/shared/typings/registry.cjs.map +0 -1
- package/dist/shared/typings/registry.d.cts +0 -51
- package/dist/shared/utility/components.utility.cjs +0 -20
- package/dist/shared/utility/components.utility.cjs.map +0 -1
- package/dist/shared/utility/components.utility.d.cts +0 -19
- package/dist/shared/utility/functions.cjs +0 -89
- package/dist/shared/utility/functions.cjs.map +0 -1
- package/dist/shared/utility/functions.d.cts +0 -61
- package/dist/shared/utility/permissions.utility.cjs +0 -14
- package/dist/shared/utility/permissions.utility.cjs.map +0 -1
- package/dist/shared/utility/permissions.utility.d.cts +0 -17
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { T as default } from '../../index-
|
|
1
|
+
export { T as default } from '../../index-C2iWCQmv.js';
|
|
2
2
|
import 'discord.js';
|
|
3
3
|
import '../../shared/typings/permissions.js';
|
|
4
4
|
import '../../shared/typings/client.js';
|
|
5
5
|
import '../../shared/typings/registry.js';
|
|
6
|
-
import '../../shared/typings/components.js';
|
|
7
6
|
import '../builders/util.builders.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/client/trivious.client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,IAAmB,EAAC;AAAA,EAC1C;AACD","file":"trivious.client.js","sourcesContent":["import { Client, REST, Routes } from \"discord.js\";\nimport { registries } from \"../registry/index.js\";\nimport {\n\tTriviousClientOptions,\n\tPermissionLevel,\n\tSlashCommand,\n\tContextMenuCommand,\n} from \"src/shared/typings/index.js\";\nimport { exists } from \"src/shared/utility/functions.js\";\nimport path from \"node:path\";\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { createHash } from \"node:crypto\";\n\n/**\n * Trivious base client.\n *\n * @export\n * @class TriviousClient\n * @typedef {TriviousClient}\n * @extends {Client}\n */\nexport default class TriviousClient extends Client {\n\t/**\n\t * Client registries.\n\t *\n\t * @public\n\t * @readonly\n\t * @type {*}\n\t */\n\treadonly registries = registries();\n\t/**\n\t * Client copy of the constructor options.\n\t *\n\t * @private\n\t * @type {TriviousClientOptions}\n\t */\n\treadonly _options: TriviousClientOptions;\n\n\t/**\n\t * Creates an instance of TriviousClient.\n\t *\n\t * @constructor\n\t * @param {TriviousClientOptions} options\n\t */\n\tconstructor(options: TriviousClientOptions) {\n\t\tsuper(options);\n\t\tthis._options = options;\n\t}\n\n\t/**\n\t * Load all registries.\n\t *\n\t * @async\n\t * @returns {*}\n\t */\n\tasync register() {\n\t\tconst { registries } = this;\n\t\tawait registries.loadAll(this._options);\n\t\tconsole.log(\n\t\t\t`[Trivious] Loaded all registries (${registries.commands.get().size} commands, ${registries.events.get().size} events, ${registries.components.get().size} components, ${registries.modules.get().size} modules)`\n\t\t);\n\t}\n\n\t/**\n\t * Login and start the bot.\n\t *\n\t * @async\n\t * @returns {*}\n\t */\n\tasync start() {\n\t\tif (!process.env[this._options.tokenReference]) {\n\t\t\tif (process.env.NODE_ENV !== \"production\") return;\n\t\t\telse throw new Error(\"[Trivious] Invalid token reference\");\n\t\t}\n\n\t\tthis.registries.bind(this);\n\t\tawait this.login(process.env[this._options.tokenReference]);\n\t}\n\n\t/**\n\t * Deploy all commands.\n\t *\n\t * @async\n\t * @returns {*}\n\t */\n\tasync deploy() {\n\t\tconst { commandHashConfig } = this._options;\n\t\tconst clientId = process.env[this._options.clientIdReference];\n\t\tconst token = process.env[this._options.tokenReference];\n\t\tif (!clientId || !token) throw new Error(\"[Trivious] Invalid clientId or token reference\");\n\n\t\tconst commands = Array.from(this.registries.commands.get().values());\n\t\tconst body = [\n\t\t\t...commands.map(command =>\n\t\t\t\t\"data\" in command ? (command as SlashCommand | ContextMenuCommand).data.toJSON() : null\n\t\t\t),\n\t\t].filter(c => c !== null);\n\n\t\tif (commandHashConfig && commandHashConfig.enabled) {\n\t\t\tconst hashFile = path.join(commandHashConfig.filePath || \"data\", \"commands.hash\");\n\t\t\tconst newHash = createHash(\"sha256\")\n\t\t\t\t.update(JSON.stringify(body.sort((a, b) => a.name.localeCompare(b.name))).toString())\n\t\t\t\t.digest(\"hex\");\n\n\t\t\tlet oldHash = \"\";\n\n\t\t\tif (await exists(hashFile)) oldHash = readFileSync(hashFile, \"utf-8\");\n\t\t\tif (newHash === oldHash) {\n\t\t\t\tconsole.debug(`[Trivious] No changes in commands found, skipping deployment`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst hashDirectory = path.dirname(hashFile);\n\t\t\tif (!existsSync(hashDirectory)) {\n\t\t\t\tmkdirSync(hashDirectory, { recursive: true });\n\t\t\t}\n\n\t\t\twriteFileSync(hashFile, newHash, { encoding: \"utf-8\" });\n\t\t\tconsole.debug(`[Trivious] Created new command hash: ${hashFile}`);\n\t\t}\n\n\t\tconst rest = new REST({ version: \"10\" }).setToken(token);\n\t\tawait rest.put(Routes.applicationCommands(clientId), { body });\n\t\tconsole.log(`[Trivious] Deployed ${body.length} commands`);\n\t}\n\n\t/**\n\t * Set the roles tied to a permission level.\n\t *\n\t * @param {Record<string, PermissionLevel>} roles\n\t */\n\tsetRolePermissions(roles: Record<string, PermissionLevel>) {\n\t\tthis._options.rolePermissions = roles;\n\t}\n\n\tget rolePermissions() {\n\t\treturn this._options.rolePermissions ?? {};\n\t}\n}\n"]}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { MessagePayload, InteractionEditReplyOptions, InteractionReplyOptions } from 'discord.js';
|
|
2
|
-
import { C as Command, a as ChatInputCommandInteraction, b as ContextMenuCommandInteraction, T as TriviousClient, S as SlashCommand } from '../../index-
|
|
2
|
+
import { C as Command, a as ChatInputCommandInteraction, b as ContextMenuCommandInteraction, T as TriviousClient, S as SlashCommand } from '../../index-C2iWCQmv.js';
|
|
3
3
|
import { PermissionLevel } from '../../shared/typings/permissions.js';
|
|
4
4
|
import '../../shared/typings/registry.js';
|
|
5
|
-
import '../../shared/typings/components.js';
|
|
6
5
|
import '../../shared/typings/client.js';
|
|
7
6
|
import '../builders/util.builders.js';
|
|
8
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/commands/methods.command.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../../../src/core/commands/methods.command.ts"],"names":[],"mappings":";;;AA2BA,eAAsB,YAAA,CACrB,OAAA,EACA,WAAA,EACA,OAAA,EACC;AACD,EAAA,IAAI,WAAA,CAAY,OAAA,IAAW,WAAA,CAAY,QAAA,EAAU;AAChD,IAAA,MAAM,WAAA,CAAY,UAAU,OAAsC,CAAA;AAClE,IAAA;AAAA,EACD;AAEA,EAAA,MAAM,UAAA,GAAa,EAAE,GAAG,OAAA,EAAQ;AAChC,EAAA,IAAI,OAAA,CAAQ,KAAA,IAAS,OAAA,CAAQ,KAAA,CAAM,QAAA,CAAS,gBAAgB,CAAA,EAAG,UAAA,CAAW,KAAA,GAAQ,CAAC,WAAW,CAAA;AAE9F,EAAA,MAAM,WAAA,CAAY,MAAM,UAAU,CAAA;AACnC;AAcA,eAAsB,sBACrB,MAAA,EACA,WAAA,EACA,OAAA,EACA,kBAAA,EACA,UAAmB,IAAA,EAClB;AACD,EAAA,IAAI,CAAC,WAAA,CAAY,OAAA,EAAQ,EAAG,OAAO,IAA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MAAM,UAAA,CAAW,OAAA,CAAQ,MAAA,EAAQ,WAAW,CAAA;AAC7C","file":"methods.command.js","sourcesContent":["import {\n\tGuildMember,\n\tInteractionEditReplyOptions,\n\tInteractionReplyOptions,\n\tMessagePayload,\n} from \"discord.js\";\nimport {\n\tChatInputCommandInteraction,\n\tCommand,\n\tContextMenuCommandInteraction,\n\tPermissionLevel,\n\tSlashCommand,\n\tSlashSubcommand,\n\tTriviousClient,\n} from \"src/index.js\";\nimport { hasPermission } from \"src/shared/utility/functions.js\";\n\n/**\n * Reply to a command, respecting whether it has been deferred or already replied to.\n *\n * @export\n * @async\n * @param {Command} command\n * @param {ChatInputCommandInteraction | ContextMenuCommandInteraction} interaction\n * @param {(MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions)} options\n * @returns {*}\n */\nexport async function commandReply(\n\tcommand: Command,\n\tinteraction: ChatInputCommandInteraction | ContextMenuCommandInteraction,\n\toptions: MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions\n) {\n\tif (interaction.replied || interaction.deferred) {\n\t\tawait interaction.editReply(options as InteractionEditReplyOptions);\n\t\treturn;\n\t}\n\n\tconst newOptions = { ...options } as InteractionReplyOptions;\n\tif (command.flags && command.flags.includes(\"EphemeralReply\")) newOptions.flags = [\"Ephemeral\"];\n\n\tawait interaction.reply(newOptions);\n}\n\n/**\n * Compare a permission level to the guild member's permission level.\n *\n * @export\n * @async\n * @param {TriviousClient} client\n * @param {ChatInputCommandInteraction | ContextMenuCommandInteraction} interaction\n * @param {Command} command\n * @param {PermissionLevel} requiredPermission\n * @param {boolean} [doReply=true]\n * @returns {unknown}\n */\nexport async function verifyGuildPermission(\n\tclient: TriviousClient,\n\tinteraction: ChatInputCommandInteraction | ContextMenuCommandInteraction,\n\tcommand: Command,\n\trequiredPermission: PermissionLevel,\n\tdoReply: boolean = true\n) {\n\tif (!interaction.inGuild()) return true;\n\n\tconst member = interaction.member as GuildMember;\n\tconst memberHasPermission = hasPermission(client, { permission: requiredPermission, member });\n\n\tif (!memberHasPermission && doReply) {\n\t\tawait commandReply(command, interaction, {\n\t\t\tcontent: `You do not have permission to run this command, required permission: \\`${PermissionLevel[requiredPermission]}\\``,\n\t\t});\n\t}\n\n\treturn memberHasPermission;\n}\n\n/**\n * Handle execution of a slash command.\n *\n * @export\n * @async\n * @param {TriviousClient} client\n * @param {(SlashCommand | SlashSubcommand)} command\n * @param {ChatInputCommandInteraction} interaction\n * @returns {*}\n */\nexport async function handleSlashCommand(\n\tclient: TriviousClient,\n\tcommand: SlashCommand,\n\tinteraction: ChatInputCommandInteraction\n) {\n\tconst { options } = interaction;\n\n\tconst hasPerm = await verifyGuildPermission(\n\t\tclient,\n\t\tinteraction,\n\t\tcommand,\n\t\tcommand.permission || PermissionLevel.USER,\n\t\ttrue\n\t);\n\n\tif (\"run\" in command && command.run && hasPerm) {\n\t\tawait command.run(client, interaction);\n\t}\n\n\tif (!hasPerm) return;\n\tif (!options.getSubcommand(false) || !(\"subcommands\" in command)) return;\n\n\tconst subcommandName = options.getSubcommand();\n\tconst subcommand = command.subcommands!.get(subcommandName) as SlashSubcommand | undefined;\n\n\tif (!subcommand) {\n\t\tawait commandReply(command, interaction, {\n\t\t\tcontent: \"This subcommand no longer exists or is not registered.\",\n\t\t});\n\t\treturn;\n\t}\n\n\tawait subcommand.execute(client, interaction);\n}\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { T as TriviousClient } from '../../index-
|
|
2
|
+
import { T as TriviousClient } from '../../index-C2iWCQmv.js';
|
|
3
3
|
import '../../shared/typings/permissions.js';
|
|
4
4
|
import '../../shared/typings/registry.js';
|
|
5
|
-
import '../../shared/typings/components.js';
|
|
6
5
|
import '../../shared/typings/client.js';
|
|
7
6
|
import '../builders/util.builders.js';
|
|
8
7
|
|
|
9
8
|
declare const _default: {
|
|
10
9
|
name: "clientReady";
|
|
10
|
+
once: true;
|
|
11
11
|
execute: (client: TriviousClient, _: discord_js.Client<true>) => Promise<void>;
|
|
12
12
|
};
|
|
13
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/events/clientReady.ts"],"names":[],"mappings":"AAEA,IAAO,mBAAA,GAAQ;AAAA,EACd,IAAA,EAAM,aAAA;AAAA,EACN,OAAA,EAAS,OAAO,MAAA,EAAQ,CAAA,KAAM;AAC7B,IAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,yBAAA,EAA4B,MAAA,CAAO,IAAA,EAAM,QAAQ,CAAA,CAAE,CAAA;AAAA,EAChE;AACD","file":"clientReady.js","sourcesContent":["import { Event } from \"src/shared/typings/index.js\";\n\nexport default {\n\tname: \"clientReady\",\n\texecute: async (client, _) => {\n\t\tconsole.log(`Successfully logged into ${client.user?.username}`);\n\t},\n} satisfies Event<\"clientReady\">;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/core/events/clientReady.ts"],"names":[],"mappings":"AAEA,IAAO,mBAAA,GAAQ;AAAA,EACd,IAAA,EAAM,aAAA;AAAA,EACN,IAAA,EAAM,IAAA;AAAA,EACN,OAAA,EAAS,OAAO,MAAA,EAAQ,CAAA,KAAM;AAC7B,IAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,yBAAA,EAA4B,MAAA,CAAO,IAAA,EAAM,QAAQ,CAAA,CAAE,CAAA;AAAA,EAChE;AACD","file":"clientReady.js","sourcesContent":["import { Event } from \"src/shared/typings/index.js\";\n\nexport default {\n\tname: \"clientReady\",\n\tonce: true,\n\texecute: async (client, _) => {\n\t\tconsole.log(`Successfully logged into ${client.user?.username}`);\n\t},\n} satisfies Event<\"clientReady\">;\n"]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
2
|
import { CacheType } from 'discord.js';
|
|
3
|
-
import { T as TriviousClient } from '../../index-
|
|
3
|
+
import { T as TriviousClient } from '../../index-C2iWCQmv.js';
|
|
4
4
|
import '../../shared/typings/permissions.js';
|
|
5
5
|
import '../../shared/typings/registry.js';
|
|
6
|
-
import '../../shared/typings/components.js';
|
|
7
6
|
import '../../shared/typings/client.js';
|
|
8
7
|
import '../builders/util.builders.js';
|
|
9
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/events/interactionCreate.ts"],"names":["hasPermission"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/core/events/interactionCreate.ts"],"names":["hasPermission"],"mappings":";;;;;;AA0BA,eAAe,gCAAA,CACd,MAAA,EACA,WAAA,EACA,UAAA,EACC;AACD,EAAA,IAAI,YAAY,KAAA,EAAO;AACtB,IAAA,MAAM,SAAS,WAAA,CAAY,MAAA;AAC3B,IAAA,MAAM,sBAAsB,aAAA,CAAc,MAAA,EAAQ,EAAE,UAAA,EAAY,QAAQ,CAAA;AACxE,IAAA,OAAO,mBAAA;AAAA,EACR;AAEA,EAAA,OAAO,KAAA;AACR;AAEA,IAAO,yBAAA,GAAQ;AAAA,EACd,IAAA,EAAM,mBAAA;AAAA,EACN,OAAA,EAAS,OAAO,MAAA,EAAQ,WAAA,KAAgB;AACvC,IAAA,IAAI,WAAA,CAAY,kBAAA,EAAmB,IAAK,WAAA,CAAY,sBAAqB,EAAG;AAC3E,MAAA,MAAM,EAAE,aAAY,GAAI,WAAA;AAExB,MAAA,MAAM,kBAAA,GAAqB,MAAA,CAAO,UAAA,CAAW,QAAA,CAAS,GAAA,EAAI;AAC1D,MAAA,MAAM,OAAA,GAAU,kBAAA,CAAmB,GAAA,CAAI,WAAW,CAAA;AAClD,MAAA,IAAI,CAAC,OAAA,EAAS;AACb,QAAA,MAAM,YAAY,KAAA,CAAM;AAAA,UACvB,OAAA,EAAS,CAAA,yDAAA,CAAA;AAAA,UACT,KAAA,EAAO,CAAC,WAAW;AAAA,SACnB,CAAA;AACD,QAAA;AAAA,MACD;AAEA,MAAA,MAAM,qBAAqB,OAAA,CAAQ,UAAA;AACnC,MAAA,MAAMA,iBA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tC,MAAA,MAAM,oBAAA,GAAuB,MAAA,CAAO,UAAA,CAAW,UAAA,CAAW,GAAA,EAAI;AAC9D,MAAA,MAAM,SAAA,GAAY,oBAAA,CAAqB,GAAA,CAAI,IAAI,CAAA;AAC/C,MAAA,IAAI,CAAC,SAAA,EAAW;AACf,QAAA,MAAM,YAAY,KAAA,CAAM;AAAA,UACvB,OAAA,EAAS,CAAA,yDAAA,CAAA;AAAA,UACT,KAAA,EAAO,CAAC,WAAW;AAAA,SACnB,CAAA;AACD,QAAA;AAAA,MACD;AAEA,MAAA,MAAM,qBAAqB,SAAA,CAAU,UAAA;AACrC,MAAA,MAAMA,iBAAgB,MAAM,gCAAA;AAAA,QAC3B,MAAA;AAAA,QACA,WAAA;AAAA,QACA;AAAA,OACD;AACA,MAAA,IAAI,CAACA,cAAAA,EAAe;AAEpB,MAAA,IAAI,CAAC,WAAA,CAAY,aAAA,EAAc,EAAG,MAAM,YAAY,WAAA,EAAY;AAChE,MAAA,MAAM,SAAA,CAAU,OAAA,CAAQ,MAAA,EAAQ,WAAW,CAAA;AAAA,IAC5C;AAAA,EACD;AACD","file":"interactionCreate.js","sourcesContent":["import {\n\tButtonInteraction,\n\tCacheType,\n\tGuildMember,\n\tMessageContextMenuCommandInteraction,\n\tModalSubmitInteraction,\n\tUserContextMenuCommandInteraction,\n} from \"discord.js\";\nimport {\n\tComponentInteraction,\n\tComponentType,\n\tContextMenuCommand,\n\tEvent,\n\tPermissionLevel,\n\tSlashCommand,\n} from \"src/shared/typings/index.js\";\nimport { hasPermission } from \"src/shared/utility/functions.js\";\nimport {\n\tcommandReply,\n\thandleSlashCommand,\n\tverifyGuildPermission,\n} from \"../commands/methods.command.js\";\nimport { ChatInputCommandInteraction } from \"src/index.js\";\nimport { deconstructCustomId } from \"src/shared/utility/components.utility.js\";\nimport TriviousClient from \"../client/trivious.client.js\";\n\nasync function validateComponentGuildPermission(\n\tclient: TriviousClient,\n\tinteraction: ComponentInteraction,\n\tpermission: PermissionLevel\n) {\n\tif (interaction.guild) {\n\t\tconst member = interaction.member as GuildMember;\n\t\tconst memberHasPermission = hasPermission(client, { permission, member });\n\t\treturn memberHasPermission;\n\t}\n\n\treturn false;\n}\n\nexport default {\n\tname: \"interactionCreate\",\n\texecute: async (client, interaction) => {\n\t\tif (interaction.isChatInputCommand() || interaction.isContextMenuCommand()) {\n\t\t\tconst { commandName } = interaction;\n\n\t\t\tconst registeredCommands = client.registries.commands.get();\n\t\t\tconst command = registeredCommands.get(commandName);\n\t\t\tif (!command) {\n\t\t\t\tawait interaction.reply({\n\t\t\t\t\tcontent: `Command is outdated, inactive or does not have a handler!`,\n\t\t\t\t\tflags: [\"Ephemeral\"],\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst requiredPermission = command.permission;\n\t\t\tconst hasPermission = await verifyGuildPermission(\n\t\t\t\tclient,\n\t\t\t\tinteraction,\n\t\t\t\tcommand,\n\t\t\t\trequiredPermission || PermissionLevel.USER\n\t\t\t);\n\t\t\tif (!hasPermission) return;\n\n\t\t\tif (!(\"execute\" in command)) {\n\t\t\t\tawait commandReply(command, interaction, {\n\t\t\t\t\tcontent:\n\t\t\t\t\t\t\"Command does not have a way to execute! Ensure the command is a SlashCommand or ContextMenuCommand!\",\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (command.flags?.includes(\"DeferReply\")) {\n\t\t\t\tawait commandReply(command, interaction, { content: \"Processing command...\" });\n\t\t\t}\n\n\t\t\tif (command.context === \"SlashCommand\" && \"data\" in command) {\n\t\t\t\tawait handleSlashCommand(\n\t\t\t\t\tclient,\n\t\t\t\t\tcommand as SlashCommand,\n\t\t\t\t\tinteraction as ChatInputCommandInteraction\n\t\t\t\t);\n\t\t\t} else if (command.context === \"ContextMenu\") {\n\t\t\t\tawait (command as ContextMenuCommand).execute(\n\t\t\t\t\tclient,\n\t\t\t\t\tinteraction as\n\t\t\t\t\t\t| UserContextMenuCommandInteraction<CacheType>\n\t\t\t\t\t\t| MessageContextMenuCommandInteraction<CacheType>\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (interaction.isMessageComponent() || interaction.isModalSubmit()) {\n\t\t\tconst { compType, tags, data } = deconstructCustomId(interaction.customId);\n\n\t\t\tif (compType === ComponentType.Button && !(interaction instanceof ButtonInteraction)) return;\n\t\t\tif (compType === ComponentType.Modal && !(interaction instanceof ModalSubmitInteraction))\n\t\t\t\treturn;\n\n\t\t\tif (tags && tags.includes(\"awaited\")) return;\n\n\t\t\tconst registeredComponents = client.registries.components.get();\n\t\t\tconst component = registeredComponents.get(data);\n\t\t\tif (!component) {\n\t\t\t\tawait interaction.reply({\n\t\t\t\t\tcontent: `Command is outdated, inactive or does not have a handler!`,\n\t\t\t\t\tflags: [\"Ephemeral\"],\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst requiredPermission = component.permission;\n\t\t\tconst hasPermission = await validateComponentGuildPermission(\n\t\t\t\tclient,\n\t\t\t\tinteraction,\n\t\t\t\trequiredPermission\n\t\t\t);\n\t\t\tif (!hasPermission) return;\n\n\t\t\tif (!interaction.isModalSubmit()) await interaction.deferUpdate();\n\t\t\tawait component.execute(client, interaction);\n\t\t}\n\t},\n} satisfies Event<\"interactionCreate\">;\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
2
|
import '../../shared/typings/registry.js';
|
|
3
|
-
export { c as default } from '../../index-
|
|
3
|
+
export { c as default } from '../../index-C2iWCQmv.js';
|
|
4
4
|
import '../../shared/typings/permissions.js';
|
|
5
|
-
import '../../shared/typings/components.js';
|
|
6
5
|
import '../../shared/typings/client.js';
|
|
7
6
|
import '../builders/util.builders.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/registry/command.registry.ts"],"names":["fs"],"mappings":";;;;;;AAoBA,MAAO,wBAAsC,YAAA,CAAsB;AAAA,EACxD,KAAA,GAAQ,IAAI,UAA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AA,MAAM,aAAa,MAAM,IAAA,CAAK,WAA4B,IAAA,CAAK,QAAA,EAAU,IAAI,CAAC,CAAA;AAC9E,UAAA,IAAI,CAAC,UAAA,EAAY;AACjB,UAAA,IAAI,CAAC,UAAA,CAAW,IAAA,CAAK,IAAA,IAAQ,EAAE,WAAW,IAAA,YAAgB,6BAAA,CAAA;AACzD,YAAA;AAED,UAAA,IAAI,CAAC,OAAA,CAAQ,WAAA,EAAa,OAAA,CAAQ,WAAA,GAAc,IAAI,UAAA,EAAoC;AACxF,UAAA,OAAA,CAAQ,WAAA,CAAY,GAAA,CAAI,UAAA,CAAW,IAAA,CAAK,MAAM,UAAU,CAAA;AACxD,UAAA,OAAA,CAAQ,IAAA,CAAK,aAAA,CAAc,UAAA,CAAW,IAAI,CAAA;AAAA,QAC3C;AAAA,MACD;AAEA,MAAA,IAAA,CAAK,KAAA,CAAM,GAAA,CAAI,OAAA,CAAQ,IAAA,CAAK,MAAM,OAAO,CAAA;AAAA,IAC1C;AAEA,IAAA,OAAO,IAAA;AAAA,EACR;AACD","file":"command.registry.js","sourcesContent":["import { Collection, SlashCommandSubcommandBuilder } from \"discord.js\";\nimport {\n\tBaseRegistry,\n\tCommand,\n\tContextMenuCommand,\n\tSlashCommand,\n\tSlashSubcommand,\n} from \"src/shared/typings/index.js\";\nimport { exists, resolveUserPath } from \"src/shared/utility/functions.js\";\nimport { promises as fs } from \"fs\";\nimport path, { join } from \"node:path\";\n\n/**\n * Registry to load and get all commands.\n *\n * @export\n * @class CommandRegistry\n * @typedef {CommandRegistry}\n * @extends {BaseRegistry<AnyCommand>}\n */\nexport default class CommandRegistry extends BaseRegistry<Command> {\n\tprotected items = new Collection<string, Command>();\n\n\t/**\n\t * Load all commands and their subcommands\n\t *\n\t * @async\n\t * @param {string} [directory=getCorePath({ coreDirectory: \"commands\" })]\n\t * @returns {unknown}\n\t */\n\tasync load(directory: string = resolveUserPath(path.join(\"src\", \"commands\"))) {\n\t\tif (!(await exists(directory))) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst entries = await fs.readdir(directory, { withFileTypes: true });\n\n\t\tfor (const entry of entries) {\n\t\t\tconst fullPath = join(directory, entry.name);\n\t\t\tif (!entry.isDirectory()) continue;\n\n\t\t\tconst indexFile = join(fullPath, \"index.ts\");\n\t\t\tconst indexJs = join(fullPath, \"index.js\");\n\n\t\t\tlet commandFile = \"\";\n\t\t\tif (await exists(indexFile)) commandFile = indexFile;\n\t\t\telse if (await exists(indexJs)) commandFile = indexJs;\n\t\t\telse continue;\n\n\t\t\tconst command = (await this.importFile<Command>(commandFile)) as\n\t\t\t\t| SlashCommand\n\t\t\t\t| ContextMenuCommand\n\t\t\t\t| null;\n\t\t\tif (!command || !command.active || !(\"data\" in command)) continue;\n\n\t\t\tif (\"subcommands\" in command) {\n\t\t\t\tconst subcommandFiles = (await fs.readdir(fullPath)).filter(\n\t\t\t\t\tfile =>\n\t\t\t\t\t\t(file.endsWith(\".ts\") || file.endsWith(\".js\")) &&\n\t\t\t\t\t\t!file.startsWith(\"index.\") &&\n\t\t\t\t\t\t!file.endsWith(\".d.ts\")\n\t\t\t\t);\n\n\t\t\t\tfor (const file of subcommandFiles) {\n\t\t\t\t\tconst subcommand = await this.importFile<SlashSubcommand>(join(fullPath, file));\n\t\t\t\t\tif (!subcommand) continue;\n\t\t\t\t\tif (!subcommand.data.name || !(subcommand.data instanceof SlashCommandSubcommandBuilder))\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tif (!command.subcommands) command.subcommands = new Collection<string, SlashSubcommand>();\n\t\t\t\t\tcommand.subcommands.set(subcommand.data.name, subcommand);\n\t\t\t\t\tcommand.data.addSubcommand(subcommand.data);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.items.set(command.data.name, command);\n\t\t}\n\n\t\treturn this;\n\t}\n}\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
2
|
import '../../shared/typings/registry.js';
|
|
3
|
-
export { d as default } from '../../index-
|
|
3
|
+
export { d as default } from '../../index-C2iWCQmv.js';
|
|
4
4
|
import '../../shared/typings/permissions.js';
|
|
5
|
-
import '../../shared/typings/components.js';
|
|
6
5
|
import '../../shared/typings/client.js';
|
|
7
6
|
import '../builders/util.builders.js';
|
|
@@ -10,10 +10,10 @@ class ComponentRegistry extends BaseRegistry {
|
|
|
10
10
|
* Load all components.
|
|
11
11
|
*
|
|
12
12
|
* @async
|
|
13
|
-
* @param {string} [directory=getCorePath({ coreDirectory: "
|
|
13
|
+
* @param {string} [directory=getCorePath({ coreDirectory: "components" })]
|
|
14
14
|
* @returns {Promise<this>}
|
|
15
15
|
*/
|
|
16
|
-
async load(directory = resolveUserPath(path.join("src", "
|
|
16
|
+
async load(directory = resolveUserPath(path.join("src", "components"))) {
|
|
17
17
|
if (!await exists(directory)) return this;
|
|
18
18
|
const entries = await promises.readdir(directory, { withFileTypes: true });
|
|
19
19
|
for (const entry of entries) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/registry/component.registry.ts"],"names":["fs"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/core/registry/component.registry.ts"],"names":["fs"],"mappings":";;;;;;AAcA,MAAO,0BAAwC,YAAA,CAAwB;AAAA,EAC5D,KAAA,GAAQ,IAAI,UAAA,EAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASpD,MAAM,KAAK,SAAA,GAAoB,eAAA,CAAgB,KAAK,IAAA,CAAK,KAAA,EAAO,YAAY,CAAC,CAAA,EAAkB;AAC9F,IAAA,IAAI,CAAE,MAAM,MAAA,CAAO,SAAS,GAAI,OAAO,IAAA;AAEvC,IAAA,MAAM,OAAA,GAAU,MAAMA,QAAA,CAAG,OAAA,CAAQ,WAAW,EAAE,aAAA,EAAe,MAAM,CAAA;AACnE,IAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC5B,MAAA,MAAM,QAAA,GAAW,IAAA,CAAK,SAAA,EAAW,KAAA,CAAM,IAAI,CAAA;AAE3C,MAAA,IAAI,KAAA,CAAM,aAAY,EAAG;AACxB,QAAA,MAAM,IAAA,CAAK,KAAK,QAAQ,CAAA;AACxB,QAAA;AAAA,MACD;AAEA,MAAA,IAAI,MAAM,MAAA,EAAO,IAAK,MAAM,IAAA,CAAK,QAAA,CAAS,KAAK,CAAA,EAAG;AACjD,QAAA,MAAM,KAAA,GAAQ,MAAM,IAAA,CAAK,UAAA,CAAsB,QAAQ,CAAA;AACvD,QAAA,IAAI,CAAC,KAAA,EAAO;AAEZ,QAAA,IAAI,EAAE,KAAA,CAAM,QAAA,IAAY,KAAA,CAAM,YAAA,CAAA,EAAe;AAC5C,UAAA,OAAA,CAAQ,KAAA,CAAM,CAAA,eAAA,EAAkB,KAAA,CAAM,IAAI,CAAA,2CAAA,CAA6C,CAAA;AACvF,UAAA;AAAA,QACD;AAEA,QAAA,IAAA,CAAK,MAAM,GAAA,CAAK,KAAA,CAAM,QAAA,IAAY,KAAA,CAAM,cAAyB,KAAK,CAAA;AAAA,MACvE;AAAA,IACD;AAEA,IAAA,OAAO,IAAA;AAAA,EACR;AACD","file":"component.registry.js","sourcesContent":["import { Collection } from \"discord.js\";\nimport { BaseRegistry, Component } from \"src/shared/typings/index.js\";\nimport { exists, resolveUserPath } from \"src/shared/utility/functions.js\";\nimport { promises as fs } from \"fs\";\nimport path, { join } from \"node:path\";\n\n/**\n * Registry to load and get all components.\n *\n * @export\n * @class ComponentRegistry\n * @typedef {ComponentRegistry}\n * @extends {BaseRegistry<Component>}\n */\nexport default class ComponentRegistry extends BaseRegistry<Component> {\n\tprotected items = new Collection<string, Component>();\n\n\t/**\n\t * Load all components.\n\t *\n\t * @async\n\t * @param {string} [directory=getCorePath({ coreDirectory: \"components\" })]\n\t * @returns {Promise<this>}\n\t */\n\tasync load(directory: string = resolveUserPath(path.join(\"src\", \"components\"))): Promise<this> {\n\t\tif (!(await exists(directory))) return this;\n\n\t\tconst entries = await fs.readdir(directory, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tconst fullPath = join(directory, entry.name);\n\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tawait this.load(fullPath);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (entry.isFile() && entry.name.endsWith(\".js\")) {\n\t\t\t\tconst event = await this.importFile<Component>(fullPath);\n\t\t\t\tif (!event) continue;\n\n\t\t\t\tif (!(event.customId || event.customIdData)) {\n\t\t\t\t\tconsole.error(`Component from ${entry.name} does not return customId nor customIdData!`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tthis.items.set((event.customId || event.customIdData) as string, event);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n}\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
2
|
import '../../shared/typings/registry.js';
|
|
3
|
-
export { E as default } from '../../index-
|
|
3
|
+
export { E as default } from '../../index-C2iWCQmv.js';
|
|
4
4
|
import '../../shared/typings/permissions.js';
|
|
5
|
-
import '../../shared/typings/components.js';
|
|
6
5
|
import '../../shared/typings/client.js';
|
|
7
6
|
import '../builders/util.builders.js';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { TriviousClientOptions } from '../../shared/typings/client.js';
|
|
2
|
-
import { c as CommandRegistry, d as ComponentRegistry, E as EventRegistry, M as ModuleRegistry, T as TriviousClient } from '../../index-
|
|
2
|
+
import { c as CommandRegistry, d as ComponentRegistry, E as EventRegistry, M as ModuleRegistry, T as TriviousClient } from '../../index-C2iWCQmv.js';
|
|
3
3
|
import 'discord.js';
|
|
4
4
|
import '../../shared/typings/permissions.js';
|
|
5
5
|
import '../../shared/typings/registry.js';
|
|
6
|
-
import '../../shared/typings/components.js';
|
|
7
6
|
import '../builders/util.builders.js';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
2
|
import '../../shared/typings/registry.js';
|
|
3
|
-
export { M as default } from '../../index-
|
|
3
|
+
export { M as default } from '../../index-C2iWCQmv.js';
|
|
4
4
|
import '../../shared/typings/permissions.js';
|
|
5
|
-
import '../../shared/typings/components.js';
|
|
6
5
|
import '../../shared/typings/client.js';
|
|
7
6
|
import '../builders/util.builders.js';
|
|
@@ -1,10 +1,124 @@
|
|
|
1
1
|
import { PermissionLevel } from './shared/typings/permissions.js';
|
|
2
2
|
import { BaseRegistry } from './shared/typings/registry.js';
|
|
3
|
-
import { ComponentInteraction } from './shared/typings/components.js';
|
|
4
3
|
import { TriviousClientOptions } from './shared/typings/client.js';
|
|
5
|
-
import {
|
|
4
|
+
import { AnySelectMenuInteraction, CacheType, ButtonInteraction as ButtonInteraction$1, ModalSubmitInteraction as ModalSubmitInteraction$1, SlashCommandBuilder, Collection, SlashCommandSubcommandBuilder, ContextMenuCommandBuilder, MessageContextMenuCommandInteraction, UserContextMenuCommandInteraction, ClientEvents, Client, ChatInputCommandInteraction as ChatInputCommandInteraction$1, StringSelectMenuInteraction as StringSelectMenuInteraction$1, ContextMenuCommandInteraction as ContextMenuCommandInteraction$1 } from 'discord.js';
|
|
6
5
|
import './core/builders/util.builders.js';
|
|
7
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Base component interface.
|
|
9
|
+
*
|
|
10
|
+
* @export
|
|
11
|
+
* @interface Component
|
|
12
|
+
* @typedef {Component}
|
|
13
|
+
*/
|
|
14
|
+
interface Component {
|
|
15
|
+
component: ComponentType;
|
|
16
|
+
permission: PermissionLevel;
|
|
17
|
+
/**
|
|
18
|
+
* The full constructed customId.
|
|
19
|
+
*
|
|
20
|
+
* @type {?string}
|
|
21
|
+
*/
|
|
22
|
+
customId?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The 'data' part of a constructed customId.
|
|
25
|
+
*
|
|
26
|
+
* @type {?string}
|
|
27
|
+
*/
|
|
28
|
+
customIdData?: string;
|
|
29
|
+
ephemeralReply?: boolean;
|
|
30
|
+
execute: (client: TriviousClient, interaction: ComponentInteraction) => Promise<void> | void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Tags for component customIds.
|
|
34
|
+
*
|
|
35
|
+
* @export
|
|
36
|
+
* @typedef {ComponentCustomIdTag}
|
|
37
|
+
*/
|
|
38
|
+
type ComponentCustomIdTag = "awaited";
|
|
39
|
+
/**
|
|
40
|
+
* Interaction types for components.
|
|
41
|
+
*
|
|
42
|
+
* @export
|
|
43
|
+
* @typedef {ComponentInteraction}
|
|
44
|
+
*/
|
|
45
|
+
type ComponentInteraction = AnySelectMenuInteraction<CacheType> | ButtonInteraction$1<CacheType> | ModalSubmitInteraction$1<CacheType>;
|
|
46
|
+
/**
|
|
47
|
+
* What type of component is the componenty.
|
|
48
|
+
*
|
|
49
|
+
* @export
|
|
50
|
+
* @enum {number}
|
|
51
|
+
*/
|
|
52
|
+
declare enum ComponentType {
|
|
53
|
+
Button = "button",
|
|
54
|
+
SelectMenu = "select",
|
|
55
|
+
Modal = "modal"
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Component customId construct options.
|
|
59
|
+
*
|
|
60
|
+
* @export
|
|
61
|
+
* @typedef {CustomIdConstructOptions}
|
|
62
|
+
*/
|
|
63
|
+
type CustomIdConstructOptions = {
|
|
64
|
+
compType: ComponentType;
|
|
65
|
+
data: string;
|
|
66
|
+
tags?: ComponentCustomIdTag[];
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Base command interface.
|
|
71
|
+
*
|
|
72
|
+
* @export
|
|
73
|
+
* @interface Command
|
|
74
|
+
* @typedef {Command}
|
|
75
|
+
*/
|
|
76
|
+
interface Command {
|
|
77
|
+
readonly context: CommandContext;
|
|
78
|
+
readonly active: boolean;
|
|
79
|
+
readonly flags?: CommandFlags[];
|
|
80
|
+
readonly permission?: PermissionLevel;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Slash command interface.
|
|
84
|
+
*
|
|
85
|
+
* @export
|
|
86
|
+
* @interface SlashCommand
|
|
87
|
+
* @typedef {SlashCommand}
|
|
88
|
+
* @extends {Command}
|
|
89
|
+
*/
|
|
90
|
+
interface SlashCommand extends Command {
|
|
91
|
+
readonly context: "SlashCommand";
|
|
92
|
+
readonly data: SlashCommandBuilder;
|
|
93
|
+
subcommands?: Collection<string, Command>;
|
|
94
|
+
readonly run?: (client: TriviousClient, interaction: ChatInputCommandInteraction) => Promise<void>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Slash command subcommand interface.
|
|
98
|
+
*
|
|
99
|
+
* @export
|
|
100
|
+
* @interface SlashSubcommand
|
|
101
|
+
* @typedef {SlashSubcommand}
|
|
102
|
+
* @extends {Command}
|
|
103
|
+
*/
|
|
104
|
+
interface SlashSubcommand extends Command {
|
|
105
|
+
readonly context: "SlashSubcommand";
|
|
106
|
+
readonly data: SlashCommandSubcommandBuilder;
|
|
107
|
+
readonly execute: (client: TriviousClient, interaction: ChatInputCommandInteraction) => Promise<void>;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Context menu command interface.
|
|
111
|
+
*
|
|
112
|
+
* @export
|
|
113
|
+
* @interface ContextMenuCommand
|
|
114
|
+
* @typedef {ContextMenuCommand}
|
|
115
|
+
* @extends {Command}
|
|
116
|
+
*/
|
|
117
|
+
interface ContextMenuCommand extends Command {
|
|
118
|
+
readonly context: "ContextMenu";
|
|
119
|
+
readonly data: ContextMenuCommandBuilder;
|
|
120
|
+
readonly execute: (client: TriviousClient, interaction: MessageContextMenuCommandInteraction<CacheType> | UserContextMenuCommandInteraction<CacheType>) => Promise<void>;
|
|
121
|
+
}
|
|
8
122
|
/**
|
|
9
123
|
* Literal type for possible CommandInteractions.
|
|
10
124
|
*
|
|
@@ -145,32 +259,6 @@ declare class EventRegistry extends BaseRegistry<Event> {
|
|
|
145
259
|
bind(client: TriviousClient): void;
|
|
146
260
|
}
|
|
147
261
|
|
|
148
|
-
/**
|
|
149
|
-
* Base component interface.
|
|
150
|
-
*
|
|
151
|
-
* @export
|
|
152
|
-
* @interface Component
|
|
153
|
-
* @typedef {Component}
|
|
154
|
-
*/
|
|
155
|
-
interface Component {
|
|
156
|
-
component: ComponentType;
|
|
157
|
-
permission: PermissionLevel;
|
|
158
|
-
/**
|
|
159
|
-
* The full constructed customId.
|
|
160
|
-
*
|
|
161
|
-
* @type {?string}
|
|
162
|
-
*/
|
|
163
|
-
customId?: string;
|
|
164
|
-
/**
|
|
165
|
-
* The 'data' part of a constructed customId.
|
|
166
|
-
*
|
|
167
|
-
* @type {?string}
|
|
168
|
-
*/
|
|
169
|
-
customIdData?: string;
|
|
170
|
-
ephemeralReply?: boolean;
|
|
171
|
-
execute: (client: TriviousClient, interaction: ComponentInteraction) => Promise<void> | void;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
262
|
/**
|
|
175
263
|
* Registry to load and get all components.
|
|
176
264
|
*
|
|
@@ -185,66 +273,12 @@ declare class ComponentRegistry extends BaseRegistry<Component> {
|
|
|
185
273
|
* Load all components.
|
|
186
274
|
*
|
|
187
275
|
* @async
|
|
188
|
-
* @param {string} [directory=getCorePath({ coreDirectory: "
|
|
276
|
+
* @param {string} [directory=getCorePath({ coreDirectory: "components" })]
|
|
189
277
|
* @returns {Promise<this>}
|
|
190
278
|
*/
|
|
191
279
|
load(directory?: string): Promise<this>;
|
|
192
280
|
}
|
|
193
281
|
|
|
194
|
-
/**
|
|
195
|
-
* Base command interface.
|
|
196
|
-
*
|
|
197
|
-
* @export
|
|
198
|
-
* @interface Command
|
|
199
|
-
* @typedef {Command}
|
|
200
|
-
*/
|
|
201
|
-
interface Command {
|
|
202
|
-
readonly context: CommandContext;
|
|
203
|
-
readonly active: boolean;
|
|
204
|
-
readonly flags?: CommandFlags[];
|
|
205
|
-
readonly permission?: PermissionLevel;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Slash command interface.
|
|
209
|
-
*
|
|
210
|
-
* @export
|
|
211
|
-
* @interface SlashCommand
|
|
212
|
-
* @typedef {SlashCommand}
|
|
213
|
-
* @extends {Command}
|
|
214
|
-
*/
|
|
215
|
-
interface SlashCommand extends Command {
|
|
216
|
-
readonly context: "SlashCommand";
|
|
217
|
-
readonly data: SlashCommandBuilder;
|
|
218
|
-
subcommands?: Collection<string, Command>;
|
|
219
|
-
readonly run?: (client: TriviousClient, interaction: ChatInputCommandInteraction) => Promise<void>;
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Slash command subcommand interface.
|
|
223
|
-
*
|
|
224
|
-
* @export
|
|
225
|
-
* @interface SlashSubcommand
|
|
226
|
-
* @typedef {SlashSubcommand}
|
|
227
|
-
* @extends {Command}
|
|
228
|
-
*/
|
|
229
|
-
interface SlashSubcommand extends Command {
|
|
230
|
-
readonly context: "SlashSubcommand";
|
|
231
|
-
readonly data: SlashCommandSubcommandBuilder;
|
|
232
|
-
readonly execute: (client: TriviousClient, interaction: ChatInputCommandInteraction) => Promise<void>;
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Context menu command interface.
|
|
236
|
-
*
|
|
237
|
-
* @export
|
|
238
|
-
* @interface ContextMenuCommand
|
|
239
|
-
* @typedef {ContextMenuCommand}
|
|
240
|
-
* @extends {Command}
|
|
241
|
-
*/
|
|
242
|
-
interface ContextMenuCommand extends Command {
|
|
243
|
-
readonly context: "ContextMenu";
|
|
244
|
-
readonly data: ContextMenuCommandBuilder;
|
|
245
|
-
readonly execute: (client: TriviousClient, interaction: MessageContextMenuCommandInteraction<CacheType> | UserContextMenuCommandInteraction<CacheType>) => Promise<void>;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
282
|
/**
|
|
249
283
|
* Registry to load and get all commands.
|
|
250
284
|
*
|
|
@@ -339,4 +373,4 @@ type StringSelectMenuInteraction = StringSelectMenuInteraction$1<CacheType>;
|
|
|
339
373
|
type ModalSubmitInteraction = ModalSubmitInteraction$1<CacheType>;
|
|
340
374
|
type ContextMenuCommandInteraction = ContextMenuCommandInteraction$1<CacheType>;
|
|
341
375
|
|
|
342
|
-
export { type ButtonInteraction as B, type Command as C, EventRegistry as E, ModuleRegistry as M, type SlashCommand as S, TriviousClient as T, type ChatInputCommandInteraction as a, type ContextMenuCommandInteraction as b, CommandRegistry as c, ComponentRegistry as d, type
|
|
376
|
+
export { type ButtonInteraction as B, type Command as C, EventRegistry as E, ModuleRegistry as M, type SlashCommand as S, TriviousClient as T, type ChatInputCommandInteraction as a, type ContextMenuCommandInteraction as b, CommandRegistry as c, ComponentRegistry as d, type CustomIdConstructOptions as e, type Component as f, type ComponentCustomIdTag as g, type ComponentInteraction as h, ComponentType as i, type SlashSubcommand as j, type ContextMenuCommand as k, type CommandInteraction as l, type CommandFlags as m, type CommandContext as n, type Event as o, type Module as p, type StringSelectMenuInteraction as q, type ModalSubmitInteraction as r };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export { B as ButtonInteraction, a as ChatInputCommandInteraction, C as Command,
|
|
2
|
+
export { B as ButtonInteraction, a as ChatInputCommandInteraction, C as Command, n as CommandContext, m as CommandFlags, l as CommandInteraction, c as CommandRegistry, f as Component, g as ComponentCustomIdTag, h as ComponentInteraction, d as ComponentRegistry, i as ComponentType, k as ContextMenuCommand, b as ContextMenuCommandInteraction, e as CustomIdConstructOptions, o as Event, r as ModalSubmitInteraction, p as Module, S as SlashCommand, j as SlashSubcommand, q as StringSelectMenuInteraction, T as TriviousClient } from './index-C2iWCQmv.js';
|
|
3
3
|
export { createActionRow, createEmbed } from './core/builders/util.builders.js';
|
|
4
4
|
export { PermissionLevel } from './shared/typings/permissions.js';
|
|
5
5
|
export { BaseRegistry } from './shared/typings/registry.js';
|
|
6
|
-
export { ComponentCustomIdTag, ComponentInteraction, ComponentType, CustomIdConstructOptions } from './shared/typings/components.js';
|
|
7
6
|
export { TriviousClientOptions } from './shared/typings/client.js';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import 'dotenv/config';
|
|
2
2
|
import 'node:util';
|
|
3
3
|
export { default as TriviousClient } from './core/client/trivious.client.js';
|
|
4
|
-
export { Command, ContextMenuCommand, SlashCommand, SlashSubcommand } from './core/commands/command.base.js';
|
|
5
4
|
export { default as CommandRegistry } from './core/registry/command.registry.js';
|
|
6
5
|
export { default as ComponentRegistry } from './core/registry/component.registry.js';
|
|
7
6
|
export { createActionRow, createEmbed } from './core/builders/util.builders.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { g as CommandContext, f as CommandFlags, e as CommandInteraction } from '../../index-D9od1fzU.js';
|
|
2
1
|
import './permissions.js';
|
|
3
|
-
import './registry.js';
|
|
4
2
|
import 'discord.js';
|
|
5
|
-
|
|
3
|
+
export { C as Command, n as CommandContext, m as CommandFlags, l as CommandInteraction, k as ContextMenuCommand, S as SlashCommand, j as SlashSubcommand } from '../../index-C2iWCQmv.js';
|
|
4
|
+
import './registry.js';
|
|
6
5
|
import './client.js';
|
|
7
6
|
import '../../core/builders/util.builders.js';
|
|
@@ -1,40 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @typedef {ComponentCustomIdTag}
|
|
8
|
-
*/
|
|
9
|
-
type ComponentCustomIdTag = "awaited";
|
|
10
|
-
/**
|
|
11
|
-
* Interaction types for components.
|
|
12
|
-
*
|
|
13
|
-
* @export
|
|
14
|
-
* @typedef {ComponentInteraction}
|
|
15
|
-
*/
|
|
16
|
-
type ComponentInteraction = AnySelectMenuInteraction<CacheType> | ButtonInteraction<CacheType> | ModalSubmitInteraction<CacheType>;
|
|
17
|
-
/**
|
|
18
|
-
* What type of component is the componenty.
|
|
19
|
-
*
|
|
20
|
-
* @export
|
|
21
|
-
* @enum {number}
|
|
22
|
-
*/
|
|
23
|
-
declare enum ComponentType {
|
|
24
|
-
Button = "button",
|
|
25
|
-
SelectMenu = "select",
|
|
26
|
-
Modal = "modal"
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Component customId construct options.
|
|
30
|
-
*
|
|
31
|
-
* @export
|
|
32
|
-
* @typedef {CustomIdConstructOptions}
|
|
33
|
-
*/
|
|
34
|
-
type CustomIdConstructOptions = {
|
|
35
|
-
compType: ComponentType;
|
|
36
|
-
data: string;
|
|
37
|
-
tags?: ComponentCustomIdTag[];
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export { type ComponentCustomIdTag, type ComponentInteraction, ComponentType, type CustomIdConstructOptions };
|
|
1
|
+
import 'discord.js';
|
|
2
|
+
import './permissions.js';
|
|
3
|
+
export { f as Component, g as ComponentCustomIdTag, h as ComponentInteraction, i as ComponentType, e as CustomIdConstructOptions } from '../../index-C2iWCQmv.js';
|
|
4
|
+
import './registry.js';
|
|
5
|
+
import './client.js';
|
|
6
|
+
import '../../core/builders/util.builders.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/typings/components.ts"],"names":["ComponentType"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/typings/components.ts"],"names":["ComponentType"],"mappings":"AA0DO,IAAK,aAAA,qBAAAA,cAAAA,KAAL;AACN,EAAAA,eAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,eAAA,YAAA,CAAA,GAAa,QAAA;AACb,EAAAA,eAAA,OAAA,CAAA,GAAQ,OAAA;AAHG,EAAA,OAAAA,cAAAA;AAAA,CAAA,EAAA,aAAA,IAAA,EAAA","file":"components.js","sourcesContent":["import {\n\tAnySelectMenuInteraction,\n\tButtonInteraction,\n\tCacheType,\n\tModalSubmitInteraction,\n} from \"discord.js\";\nimport { PermissionLevel } from \"./permissions.js\";\nimport TriviousClient from \"src/core/client/trivious.client.js\";\n\n/**\n * Base component interface.\n *\n * @export\n * @interface Component\n * @typedef {Component}\n */\nexport interface Component {\n\tcomponent: ComponentType;\n\tpermission: PermissionLevel;\n\t/**\n\t * The full constructed customId.\n\t *\n\t * @type {?string}\n\t */\n\tcustomId?: string;\n\t/**\n\t * The 'data' part of a constructed customId.\n\t *\n\t * @type {?string}\n\t */\n\tcustomIdData?: string;\n\tephemeralReply?: boolean;\n\texecute: (client: TriviousClient, interaction: ComponentInteraction) => Promise<void> | void;\n}\n\n/**\n * Tags for component customIds.\n *\n * @export\n * @typedef {ComponentCustomIdTag}\n */\nexport type ComponentCustomIdTag = \"awaited\";\n/**\n * Interaction types for components.\n *\n * @export\n * @typedef {ComponentInteraction}\n */\nexport type ComponentInteraction =\n\t| AnySelectMenuInteraction<CacheType>\n\t| ButtonInteraction<CacheType>\n\t| ModalSubmitInteraction<CacheType>;\n/**\n * What type of component is the componenty.\n *\n * @export\n * @enum {number}\n */\nexport enum ComponentType {\n\tButton = \"button\",\n\tSelectMenu = \"select\",\n\tModal = \"modal\",\n}\n\n/**\n * Component customId construct options.\n *\n * @export\n * @typedef {CustomIdConstructOptions}\n */\nexport type CustomIdConstructOptions = {\n\tcompType: ComponentType;\n\tdata: string;\n\ttags?: ComponentCustomIdTag[];\n};\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export {
|
|
2
|
+
export { o as Event } from '../../index-C2iWCQmv.js';
|
|
3
3
|
import './permissions.js';
|
|
4
4
|
import './registry.js';
|
|
5
|
-
import './components.js';
|
|
6
5
|
import './client.js';
|
|
7
6
|
import '../../core/builders/util.builders.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { PermissionLevel } from './permissions.js';
|
|
2
2
|
export { BaseRegistry } from './registry.js';
|
|
3
|
-
export { ComponentCustomIdTag, ComponentInteraction, ComponentType, CustomIdConstructOptions } from '
|
|
4
|
-
export { g as CommandContext, f as CommandFlags, e as CommandInteraction, h as Event, i as Module } from '../../index-D9od1fzU.js';
|
|
3
|
+
export { C as Command, n as CommandContext, m as CommandFlags, l as CommandInteraction, f as Component, g as ComponentCustomIdTag, h as ComponentInteraction, i as ComponentType, k as ContextMenuCommand, e as CustomIdConstructOptions, o as Event, p as Module, S as SlashCommand, j as SlashSubcommand } from '../../index-C2iWCQmv.js';
|
|
5
4
|
export { TriviousClientOptions } from './client.js';
|
|
6
5
|
import 'discord.js';
|
|
7
6
|
import '../../core/builders/util.builders.js';
|