trivious 2.2.5 → 2.3.1
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/features/builders/utility.builders.js +8 -5
- package/dist/features/builders/utility.builders.js.map +1 -1
- package/dist/features/client/client.types.d.ts +1 -0
- package/dist/features/client/client.types.js +0 -2
- package/dist/features/client/client.types.js.map +1 -1
- package/dist/features/client/deploy.client.d.ts +2 -1
- package/dist/features/client/deploy.client.js +8 -9
- package/dist/features/client/deploy.client.js.map +1 -1
- package/dist/features/client/logger.d.ts +11 -0
- package/dist/features/client/logger.js +24 -0
- package/dist/features/client/logger.js.map +1 -0
- package/dist/features/client/trivious.client.d.ts +2 -1
- package/dist/features/client/trivious.client.js +11 -9
- package/dist/features/client/trivious.client.js.map +1 -1
- package/dist/features/commands/builders.commands.d.ts +6 -5
- package/dist/features/commands/builders.commands.js +10 -5
- package/dist/features/commands/builders.commands.js.map +1 -1
- package/dist/features/commands/commands.types.d.ts +2 -1
- package/dist/features/commands/commands.types.js +0 -2
- package/dist/features/commands/commands.types.js.map +1 -1
- package/dist/features/commands/methods.commands.d.ts +2 -1
- package/dist/features/commands/methods.commands.js +4 -3
- package/dist/features/commands/methods.commands.js.map +1 -1
- package/dist/features/commands/registry.commands.d.ts +2 -1
- package/dist/features/commands/registry.commands.js +91 -79
- package/dist/features/commands/registry.commands.js.map +1 -1
- package/dist/features/components/builders.components.d.ts +2 -1
- package/dist/features/components/builders.components.js +7 -5
- package/dist/features/components/builders.components.js.map +1 -1
- package/dist/features/components/components.types.d.ts +2 -1
- package/dist/features/components/components.types.js +3 -3
- package/dist/features/components/components.types.js.map +1 -1
- package/dist/features/components/registry.components.d.ts +2 -1
- package/dist/features/components/registry.components.js +9 -10
- package/dist/features/components/registry.components.js.map +1 -1
- package/dist/features/customId/customid.types.d.ts +2 -1
- package/dist/features/customId/customid.types.js +0 -2
- package/dist/features/customId/customid.types.js.map +1 -1
- package/dist/features/customId/methods.customid.d.ts +2 -1
- package/dist/features/customId/methods.customid.js +4 -5
- package/dist/features/customId/methods.customid.js.map +1 -1
- package/dist/features/events/builders.events.d.ts +2 -1
- package/dist/features/events/builders.events.js +4 -3
- package/dist/features/events/builders.events.js.map +1 -1
- package/dist/features/events/events.types.d.ts +2 -1
- package/dist/features/events/events.types.js +0 -2
- package/dist/features/events/events.types.js.map +1 -1
- package/dist/features/events/presets/clientReady.d.ts +2 -1
- package/dist/features/events/presets/clientReady.js +3 -3
- package/dist/features/events/presets/clientReady.js.map +1 -1
- package/dist/features/events/presets/interactionCreate.d.ts +2 -1
- package/dist/features/events/presets/interactionCreate.js +14 -9
- package/dist/features/events/presets/interactionCreate.js.map +1 -1
- package/dist/features/events/registry.events.d.ts +2 -1
- package/dist/features/events/registry.events.js +10 -10
- package/dist/features/events/registry.events.js.map +1 -1
- package/dist/features/modules/builders.modules.d.ts +2 -1
- package/dist/features/modules/builders.modules.js +3 -3
- package/dist/features/modules/builders.modules.js.map +1 -1
- package/dist/features/modules/modules.types.d.ts +2 -1
- package/dist/features/modules/modules.types.js +0 -2
- package/dist/features/modules/modules.types.js.map +1 -1
- package/dist/features/modules/registry.modules.d.ts +2 -1
- package/dist/features/modules/registry.modules.js +9 -9
- package/dist/features/modules/registry.modules.js.map +1 -1
- package/dist/features/permissions/methods.permissions.d.ts +2 -1
- package/dist/features/permissions/methods.permissions.js +4 -3
- package/dist/features/permissions/methods.permissions.js.map +1 -1
- package/dist/features/permissions/permissions.types.js +0 -2
- package/dist/features/permissions/permissions.types.js.map +1 -1
- package/dist/features/structure/index.structure.js +11 -12
- package/dist/features/structure/index.structure.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +11 -9
- package/dist/index.js.map +1 -1
- package/dist/{modules.types-lYoNHt-m.d.ts → modules.types-hjAYMYut.d.ts} +14 -6
- package/dist/shared/registries.d.ts +2 -1
- package/dist/shared/registries.js +7 -8
- package/dist/shared/registries.js.map +1 -1
- package/dist/shared/typings.d.ts +2 -1
- package/dist/shared/typings.js +11 -9
- package/dist/shared/typings.js.map +1 -1
- package/dist/utility/errors.d.ts +2 -1
- package/dist/utility/errors.js +4 -3
- package/dist/utility/errors.js.map +1 -1
- package/dist/utility/functions.js +7 -7
- package/dist/utility/functions.js.map +1 -1
- package/package.json +10 -5
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { GuildMember, User } from 'discord.js';
|
|
2
|
-
import { T as TriviousClient, a as BaseCommandData,
|
|
2
|
+
import { T as TriviousClient, a as BaseCommandData, f as Component } from '../../modules.types-hjAYMYut.js';
|
|
3
3
|
import '../client/client.types.js';
|
|
4
4
|
import './permissions.types.js';
|
|
5
|
+
import '../client/logger.js';
|
|
5
6
|
|
|
6
7
|
declare function canMemberRunCommand(client: TriviousClient, command: BaseCommandData | Component, member: GuildMember): [boolean, string];
|
|
7
8
|
declare function canUserRunCommand(client: TriviousClient, command: BaseCommandData | Component, user: User): [boolean, string];
|
|
@@ -36,7 +36,8 @@ function canUserRunCommand(client, command, user) {
|
|
|
36
36
|
if (!userIds) return [true, "No permissions set"];
|
|
37
37
|
return userIds.includes(user.id) ? [true, "User can run command"] : [false, "User cannot run command"];
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
export {
|
|
40
|
+
canMemberRunCommand,
|
|
41
|
+
canUserRunCommand
|
|
42
|
+
};
|
|
42
43
|
//# sourceMappingURL=methods.permissions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/features/permissions/methods.permissions.ts"],"
|
|
1
|
+
{"version":3,"sources":["../../../src/features/permissions/methods.permissions.ts"],"sourcesContent":["import { BaseCommandData, Component, TriviousClient } from \"@typings\";\nimport { GuildMember, User } from \"discord.js\";\n\nexport function canMemberRunCommand(\n\tclient: TriviousClient,\n\tcommand: BaseCommandData | Component,\n\tmember: GuildMember\n): [boolean, string] {\n\tconst { permissions } = command;\n\tif (!permissions) return [true, \"No permissions set\"];\n\n\tif (client.trivious.ownerUserIds && client.trivious.ownerUserIds.includes(member.user.id))\n\t\treturn [true, \"User can run command\"];\n\n\tconst { requiredMemberPermissions, requiredRoleIds, userIds } = permissions;\n\tif (userIds) return canUserRunCommand(client, command, member.user);\n\n\tlet memberHasPermission = false;\n\tlet memberHasRole = false;\n\n\tif (requiredMemberPermissions) {\n\t\tfor (const bit of requiredMemberPermissions) {\n\t\t\tif (member.permissions.has(bit)) {\n\t\t\t\tmemberHasPermission = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (requiredRoleIds) {\n\t\tfor (const roleId of requiredRoleIds) {\n\t\t\tif (member.roles.cache.has(roleId)) {\n\t\t\t\tmemberHasRole = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn memberHasPermission || memberHasRole\n\t\t? [true, \"User can run command\"]\n\t\t: [false, \"User cannot run command\"];\n}\n\nexport function canUserRunCommand(\n\tclient: TriviousClient,\n\tcommand: BaseCommandData | Component,\n\tuser: User\n): [boolean, string] {\n\tconst { permissions } = command;\n\tif (!permissions) return [true, \"No permissions set\"];\n\n\tif (client.trivious.ownerUserIds && client.trivious.ownerUserIds.includes(user.id))\n\t\treturn [true, \"User can run command\"];\n\n\tconst { requiredMemberPermissions, requiredRoleIds, userIds } = permissions;\n\n\tif (!userIds && (requiredMemberPermissions || requiredRoleIds))\n\t\treturn [false, \"Cannot validate permissions; use canMemberRunCommand instead\"];\n\n\tif (!userIds) return [true, \"No permissions set\"];\n\treturn userIds.includes(user.id)\n\t\t? [true, \"User can run command\"]\n\t\t: [false, \"User cannot run command\"];\n}\n"],"mappings":"AAGO,SAAS,oBACf,QACA,SACA,QACoB;AACpB,QAAM,EAAE,YAAY,IAAI;AACxB,MAAI,CAAC,YAAa,QAAO,CAAC,MAAM,oBAAoB;AAEpD,MAAI,OAAO,SAAS,gBAAgB,OAAO,SAAS,aAAa,SAAS,OAAO,KAAK,EAAE;AACvF,WAAO,CAAC,MAAM,sBAAsB;AAErC,QAAM,EAAE,2BAA2B,iBAAiB,QAAQ,IAAI;AAChE,MAAI,QAAS,QAAO,kBAAkB,QAAQ,SAAS,OAAO,IAAI;AAElE,MAAI,sBAAsB;AAC1B,MAAI,gBAAgB;AAEpB,MAAI,2BAA2B;AAC9B,eAAW,OAAO,2BAA2B;AAC5C,UAAI,OAAO,YAAY,IAAI,GAAG,GAAG;AAChC,8BAAsB;AACtB;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,MAAI,iBAAiB;AACpB,eAAW,UAAU,iBAAiB;AACrC,UAAI,OAAO,MAAM,MAAM,IAAI,MAAM,GAAG;AACnC,wBAAgB;AAChB;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,SAAO,uBAAuB,gBAC3B,CAAC,MAAM,sBAAsB,IAC7B,CAAC,OAAO,yBAAyB;AACrC;AAEO,SAAS,kBACf,QACA,SACA,MACoB;AACpB,QAAM,EAAE,YAAY,IAAI;AACxB,MAAI,CAAC,YAAa,QAAO,CAAC,MAAM,oBAAoB;AAEpD,MAAI,OAAO,SAAS,gBAAgB,OAAO,SAAS,aAAa,SAAS,KAAK,EAAE;AAChF,WAAO,CAAC,MAAM,sBAAsB;AAErC,QAAM,EAAE,2BAA2B,iBAAiB,QAAQ,IAAI;AAEhE,MAAI,CAAC,YAAY,6BAA6B;AAC7C,WAAO,CAAC,OAAO,8DAA8D;AAE9E,MAAI,CAAC,QAAS,QAAO,CAAC,MAAM,oBAAoB;AAChD,SAAO,QAAQ,SAAS,KAAK,EAAE,IAC5B,CAAC,MAAM,sBAAsB,IAC7B,CAAC,OAAO,yBAAyB;AACrC;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { existsSync } from
|
|
2
|
-
import { dirname, join, resolve } from
|
|
3
|
-
import { fileURLToPath } from
|
|
4
|
-
import { Collection } from
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const __dirname$1 = dirname(__filename$1);
|
|
1
|
+
import { existsSync } from "fs";
|
|
2
|
+
import { dirname, join, resolve } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { Collection } from "discord.js";
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = dirname(__filename);
|
|
8
7
|
const structure = {
|
|
9
8
|
getPackageRoot() {
|
|
10
|
-
let dir = __dirname
|
|
9
|
+
let dir = __dirname;
|
|
11
10
|
while (dir !== dirname(dir)) {
|
|
12
11
|
if (existsSync(join(dir, "package.json")) || existsSync(join(dir, "node_modules"))) {
|
|
13
12
|
return dir;
|
|
14
13
|
}
|
|
15
14
|
dir = dirname(dir);
|
|
16
15
|
}
|
|
17
|
-
return __dirname
|
|
16
|
+
return __dirname;
|
|
18
17
|
},
|
|
19
18
|
resolveRelativePath(relativePath) {
|
|
20
19
|
const workingDir = process.cwd();
|
|
@@ -45,7 +44,7 @@ const structure = {
|
|
|
45
44
|
}
|
|
46
45
|
};
|
|
47
46
|
var index_structure_default = structure;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
export {
|
|
48
|
+
index_structure_default as default
|
|
49
|
+
};
|
|
51
50
|
//# sourceMappingURL=index.structure.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/features/structure/index.structure.ts"],"
|
|
1
|
+
{"version":3,"sources":["../../../src/features/structure/index.structure.ts"],"sourcesContent":["import { existsSync } from \"fs\";\nimport { dirname, join, resolve } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { Collection } from \"discord.js\";\n\ntype ClientStores = \"commands\" | \"components\" | \"events\" | \"modules\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\nconst structure = {\n\tgetPackageRoot() {\n\t\tlet dir = __dirname;\n\n\t\twhile (dir !== dirname(dir)) {\n\t\t\tif (existsSync(join(dir, \"package.json\")) || existsSync(join(dir, \"node_modules\"))) {\n\t\t\t\treturn dir;\n\t\t\t}\n\n\t\t\tdir = dirname(dir);\n\t\t}\n\n\t\treturn __dirname;\n\t},\n\n\tresolveRelativePath(relativePath: string) {\n\t\tconst workingDir = process.cwd();\n\t\tconst packageRoot = this.getPackageRoot();\n\n\t\tconst candidates = [\n\t\t\tjoin(workingDir, \"lib\", relativePath),\n\t\t\tjoin(workingDir, \"dist\", relativePath),\n\t\t\tjoin(packageRoot, \"lib\", relativePath),\n\t\t\tjoin(packageRoot, \"dist\", relativePath),\n\n\t\t\tjoin(packageRoot, relativePath),\n\t\t\tjoin(workingDir, relativePath),\n\t\t];\n\n\t\tfor (const candidate of candidates) {\n\t\t\tconst full = resolve(candidate);\n\t\t\tif (existsSync(full)) return full;\n\t\t}\n\n\t\treturn join(workingDir, relativePath);\n\t},\n\n\tresolveTypeBasedStructure(corePath: string) {\n\t\tconst resolved = new Collection<ClientStores, string>();\n\t\tconst directoriesToCheck: ClientStores[] = [\"commands\", \"components\", \"events\", \"modules\"];\n\n\t\tfor (const dir of directoriesToCheck) {\n\t\t\tconst fullPath = structure.resolveRelativePath(join(corePath, dir));\n\t\t\tif (!existsSync(fullPath)) continue;\n\t\t\tresolved.set(dir, fullPath);\n\t\t}\n\n\t\treturn resolved;\n\t},\n};\n\nexport default structure;\n"],"mappings":"AAAA,SAAS,kBAAkB;AAC3B,SAAS,SAAS,MAAM,eAAe;AACvC,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AAI3B,MAAM,aAAa,cAAc,YAAY,GAAG;AAChD,MAAM,YAAY,QAAQ,UAAU;AAEpC,MAAM,YAAY;AAAA,EACjB,iBAAiB;AAChB,QAAI,MAAM;AAEV,WAAO,QAAQ,QAAQ,GAAG,GAAG;AAC5B,UAAI,WAAW,KAAK,KAAK,cAAc,CAAC,KAAK,WAAW,KAAK,KAAK,cAAc,CAAC,GAAG;AACnF,eAAO;AAAA,MACR;AAEA,YAAM,QAAQ,GAAG;AAAA,IAClB;AAEA,WAAO;AAAA,EACR;AAAA,EAEA,oBAAoB,cAAsB;AACzC,UAAM,aAAa,QAAQ,IAAI;AAC/B,UAAM,cAAc,KAAK,eAAe;AAExC,UAAM,aAAa;AAAA,MAClB,KAAK,YAAY,OAAO,YAAY;AAAA,MACpC,KAAK,YAAY,QAAQ,YAAY;AAAA,MACrC,KAAK,aAAa,OAAO,YAAY;AAAA,MACrC,KAAK,aAAa,QAAQ,YAAY;AAAA,MAEtC,KAAK,aAAa,YAAY;AAAA,MAC9B,KAAK,YAAY,YAAY;AAAA,IAC9B;AAEA,eAAW,aAAa,YAAY;AACnC,YAAM,OAAO,QAAQ,SAAS;AAC9B,UAAI,WAAW,IAAI,EAAG,QAAO;AAAA,IAC9B;AAEA,WAAO,KAAK,YAAY,YAAY;AAAA,EACrC;AAAA,EAEA,0BAA0B,UAAkB;AAC3C,UAAM,WAAW,IAAI,WAAiC;AACtD,UAAM,qBAAqC,CAAC,YAAY,cAAc,UAAU,SAAS;AAEzF,eAAW,OAAO,oBAAoB;AACrC,YAAM,WAAW,UAAU,oBAAoB,KAAK,UAAU,GAAG,CAAC;AAClE,UAAI,CAAC,WAAW,QAAQ,EAAG;AAC3B,eAAS,IAAI,KAAK,QAAQ;AAAA,IAC3B;AAEA,WAAO;AAAA,EACR;AACD;AAEA,IAAO,0BAAQ;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { CommandHashConfiguration, FeatureBasedStructure, TriviousClientCredentials, TriviousClientOptions, TriviousStructure, TypeBasedStructure } from './features/client/client.types.js';
|
|
2
|
-
export { B as BaseChatInputCommandData, a as BaseCommandData, C as ChatInputCommandContext, b as
|
|
2
|
+
export { B as BaseChatInputCommandData, a as BaseCommandData, C as ChatInputCommandContext, b as CollatedCommandData, c as CommandFlags, d as CommandFunction, e as CommandSetData, f as Component, g as ComponentContext, h as ComponentFlags, i as ComponentInteraction, j as ContextCommandData, E as Event, M as Module, S as SlashCommandData, k as SlashSubcommandData, l as SlashSubcommandGroupData, T as TriviousClient } from './modules.types-hjAYMYut.js';
|
|
3
3
|
export { ComponentCustomId, ComponentTag } from './features/customId/customid.types.js';
|
|
4
4
|
export { CommandPermissionValues } from './features/permissions/permissions.types.js';
|
|
5
5
|
export { createActionRow, createEmbed } from './features/builders/utility.builders.js';
|
|
@@ -10,3 +10,4 @@ export { createButtonComponent, createComponent, createModalComponent, createSel
|
|
|
10
10
|
export { createEvent, createOnceEvent } from './features/events/builders.events.js';
|
|
11
11
|
export { createModule } from './features/modules/builders.modules.js';
|
|
12
12
|
import 'discord.js';
|
|
13
|
+
import './features/client/logger.js';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
|
|
1
|
+
export * from "./shared/typings.js";
|
|
2
|
+
export * from "./features/builders/utility.builders.js";
|
|
3
|
+
export * from "./features/commands/methods.commands.js";
|
|
4
|
+
import { default as default2 } from "./features/customId/methods.customid.js";
|
|
5
|
+
export * from "./features/commands/builders.commands.js";
|
|
6
|
+
export * from "./features/components/builders.components.js";
|
|
7
|
+
export * from "./features/events/builders.events.js";
|
|
8
|
+
export * from "./features/modules/builders.modules.js";
|
|
9
|
+
export {
|
|
10
|
+
default2 as customId
|
|
11
|
+
};
|
|
10
12
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Types\nexport * from \"@typings\";\n\n// Methods\nexport * from \"@feature/builders/utility.builders.js\";\nexport * from \"@feature/commands/methods.commands.js\";\nexport { default as customId } from \"@feature/customId/methods.customid.js\";\n\n// Builders\nexport * from \"@feature/commands/builders.commands.js\";\nexport * from \"@feature/components/builders.components.js\";\nexport * from \"@feature/events/builders.events.js\";\nexport * from \"@feature/modules/builders.modules.js\";\n"],"mappings":"AACA,cAAc;AAGd,cAAc;AACd,cAAc;AACd,SAAoB,WAAXA,gBAA2B;AAGpC,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":["default"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Client, Collection, ApplicationCommandType,
|
|
1
|
+
import { Client, Collection, ApplicationCommandType, SlashCommandBuilder, SlashCommandOptionsOnlyBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandSubcommandBuilder, Interaction, ContextMenuCommandBuilder, MessageContextMenuCommandInteraction, UserContextMenuCommandInteraction, ChatInputCommandInteraction, SlashCommandSubcommandGroupBuilder, ButtonInteraction, AnySelectMenuInteraction, ModalSubmitInteraction, ClientEvents } from 'discord.js';
|
|
2
2
|
import { TriviousClientOptions } from './features/client/client.types.js';
|
|
3
3
|
import { CommandPermissionValues } from './features/permissions/permissions.types.js';
|
|
4
|
+
import { Logger } from './features/client/logger.js';
|
|
4
5
|
|
|
5
6
|
declare class TriviousClient extends Client {
|
|
6
7
|
trivious: TriviousClientOptions;
|
|
@@ -13,6 +14,7 @@ declare class TriviousClient extends Client {
|
|
|
13
14
|
events: Collection<string, Event>;
|
|
14
15
|
modules: Collection<string, Module>;
|
|
15
16
|
};
|
|
17
|
+
logger: Logger;
|
|
16
18
|
constructor(options: TriviousClientOptions);
|
|
17
19
|
/**
|
|
18
20
|
* Register, deploy and log into the bot.
|
|
@@ -73,7 +75,7 @@ interface ContextCommandData<T extends "Message" | "User" | null = null> extends
|
|
|
73
75
|
interface SlashCommandData extends BaseChatInputCommandData {
|
|
74
76
|
context: "SlashCommand";
|
|
75
77
|
data: SlashCommandBuilder | SlashCommandOptionsOnlyBuilder | SlashCommandSubcommandsOnlyBuilder;
|
|
76
|
-
subcommands?: Collection<string, SlashSubcommandData<
|
|
78
|
+
subcommands?: Collection<string, SlashSubcommandData<true>>;
|
|
77
79
|
subcommandGroups?: Collection<string, SlashSubcommandGroupData<true>>;
|
|
78
80
|
run?: CommandFunction<ChatInputCommandInteraction>;
|
|
79
81
|
}
|
|
@@ -86,7 +88,7 @@ interface SlashCommandData extends BaseChatInputCommandData {
|
|
|
86
88
|
interface SlashSubcommandGroupData<Processed extends boolean = false> {
|
|
87
89
|
context: "SlashSubcommandGroup";
|
|
88
90
|
data: SlashCommandSubcommandGroupBuilder;
|
|
89
|
-
subcommands: Collection<string, SlashSubcommandData
|
|
91
|
+
subcommands: Collection<string, SlashSubcommandData>;
|
|
90
92
|
parent?: Processed extends true ? SlashCommandData : SlashCommandData | undefined;
|
|
91
93
|
}
|
|
92
94
|
/**
|
|
@@ -97,12 +99,18 @@ interface SlashSubcommandGroupData<Processed extends boolean = false> {
|
|
|
97
99
|
* @param data The slash subcommand builder
|
|
98
100
|
* @param execute Function for when the subcommand is executed
|
|
99
101
|
*/
|
|
100
|
-
interface SlashSubcommandData<
|
|
102
|
+
interface SlashSubcommandData<Processed extends boolean = false> extends BaseChatInputCommandData {
|
|
101
103
|
context: "SlashSubcommand";
|
|
102
104
|
data: SlashCommandSubcommandBuilder;
|
|
103
105
|
execute: CommandFunction<ChatInputCommandInteraction>;
|
|
104
|
-
parent?: Processed extends true ?
|
|
106
|
+
parent?: Processed extends true ? SlashCommandData | SlashSubcommandGroupData<true> : SlashCommandData | SlashSubcommandGroupData<false>;
|
|
105
107
|
}
|
|
108
|
+
type CommandSetData<Data> = [Data, directory: string];
|
|
109
|
+
type CollatedCommandData = {
|
|
110
|
+
SlashCommand: Set<CommandSetData<SlashCommandData>>;
|
|
111
|
+
SlashSubcommand: Set<CommandSetData<SlashSubcommandData>>;
|
|
112
|
+
SlashSubcommandGroup: Set<CommandSetData<SlashSubcommandGroupData>>;
|
|
113
|
+
};
|
|
106
114
|
|
|
107
115
|
type ComponentFlags = "Cached" | "DeferReply" | "EphemeralReply" | "ExpectModal";
|
|
108
116
|
type ComponentInteraction = AnySelectMenuInteraction | ButtonInteraction | ModalSubmitInteraction;
|
|
@@ -144,4 +152,4 @@ interface Module {
|
|
|
144
152
|
};
|
|
145
153
|
}
|
|
146
154
|
|
|
147
|
-
export { type BaseChatInputCommandData as B, type ChatInputCommandContext as C, type Event as E, type Module as M, type SlashCommandData as S, TriviousClient as T, type BaseCommandData as a, type
|
|
155
|
+
export { type BaseChatInputCommandData as B, type ChatInputCommandContext as C, type Event as E, type Module as M, type SlashCommandData as S, TriviousClient as T, type BaseCommandData as a, type CollatedCommandData as b, type CommandFlags as c, type CommandFunction as d, type CommandSetData as e, type Component as f, ComponentContext as g, type ComponentFlags as h, type ComponentInteraction as i, type ContextCommandData as j, type SlashSubcommandData as k, type SlashSubcommandGroupData as l };
|
|
@@ -2,10 +2,11 @@ import registerCommands from '../features/commands/registry.commands.js';
|
|
|
2
2
|
import registerComponents from '../features/components/registry.components.js';
|
|
3
3
|
import registerEvents, { bindEvents } from '../features/events/registry.events.js';
|
|
4
4
|
import registerModules, { bindModules } from '../features/modules/registry.modules.js';
|
|
5
|
-
import '../modules.types-
|
|
5
|
+
import '../modules.types-hjAYMYut.js';
|
|
6
6
|
import 'discord.js';
|
|
7
7
|
import '../features/client/client.types.js';
|
|
8
8
|
import '../features/permissions/permissions.types.js';
|
|
9
|
+
import '../features/client/logger.js';
|
|
9
10
|
|
|
10
11
|
declare const _default: {
|
|
11
12
|
readonly commands: {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import registerCommands from
|
|
2
|
-
import registerComponents from
|
|
3
|
-
import registerEvents, { bindEvents } from
|
|
4
|
-
import registerModules, { bindModules } from
|
|
5
|
-
|
|
1
|
+
import registerCommands from "../features/commands/registry.commands.js";
|
|
2
|
+
import registerComponents from "../features/components/registry.components.js";
|
|
3
|
+
import registerEvents, { bindEvents } from "../features/events/registry.events.js";
|
|
4
|
+
import registerModules, { bindModules } from "../features/modules/registry.modules.js";
|
|
6
5
|
var registries_default = {
|
|
7
6
|
commands: {
|
|
8
7
|
register: registerCommands
|
|
@@ -19,7 +18,7 @@ var registries_default = {
|
|
|
19
18
|
bind: bindModules
|
|
20
19
|
}
|
|
21
20
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
export {
|
|
22
|
+
registries_default as default
|
|
23
|
+
};
|
|
25
24
|
//# sourceMappingURL=registries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/shared/registries.ts"],"
|
|
1
|
+
{"version":3,"sources":["../../src/shared/registries.ts"],"sourcesContent":["import registerCommands from \"@feature/commands/registry.commands.js\";\nimport registerComponents from \"@feature/components/registry.components.js\";\nimport registerEvents, { bindEvents } from \"@feature/events/registry.events.js\";\nimport registerModules, { bindModules } from \"@feature/modules/registry.modules.js\";\n\nexport default {\n\tcommands: {\n\t\tregister: registerCommands,\n\t},\n\tcomponents: {\n\t\tregister: registerComponents,\n\t},\n\tevents: {\n\t\tregister: registerEvents,\n\t\tbind: bindEvents,\n\t},\n\tmodules: {\n\t\tregister: registerModules,\n\t\tbind: bindModules,\n\t},\n} as const;\n"],"mappings":"AAAA,OAAO,sBAAsB;AAC7B,OAAO,wBAAwB;AAC/B,OAAO,kBAAkB,kBAAkB;AAC3C,OAAO,mBAAmB,mBAAmB;AAE7C,IAAO,qBAAQ;AAAA,EACd,UAAU;AAAA,IACT,UAAU;AAAA,EACX;AAAA,EACA,YAAY;AAAA,IACX,UAAU;AAAA,EACX;AAAA,EACA,QAAQ;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,EACP;AAAA,EACA,SAAS;AAAA,IACR,UAAU;AAAA,IACV,MAAM;AAAA,EACP;AACD;","names":[]}
|
package/dist/shared/typings.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { CommandHashConfiguration, FeatureBasedStructure, TriviousClientCredentials, TriviousClientOptions, TriviousStructure, TypeBasedStructure } from '../features/client/client.types.js';
|
|
2
|
-
export { B as BaseChatInputCommandData, a as BaseCommandData, C as ChatInputCommandContext, b as
|
|
2
|
+
export { B as BaseChatInputCommandData, a as BaseCommandData, C as ChatInputCommandContext, b as CollatedCommandData, c as CommandFlags, d as CommandFunction, e as CommandSetData, f as Component, g as ComponentContext, h as ComponentFlags, i as ComponentInteraction, j as ContextCommandData, E as Event, M as Module, S as SlashCommandData, k as SlashSubcommandData, l as SlashSubcommandGroupData, T as TriviousClient } from '../modules.types-hjAYMYut.js';
|
|
3
3
|
export { ComponentCustomId, ComponentTag } from '../features/customId/customid.types.js';
|
|
4
4
|
export { CommandPermissionValues } from '../features/permissions/permissions.types.js';
|
|
5
5
|
import 'discord.js';
|
|
6
|
+
import '../features/client/logger.js';
|
package/dist/shared/typings.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
|
|
1
|
+
export * from "../features/client/client.types.js";
|
|
2
|
+
import { default as default2 } from "../features/client/trivious.client.js";
|
|
3
|
+
export * from "../features/commands/commands.types.js";
|
|
4
|
+
export * from "../features/components/components.types.js";
|
|
5
|
+
export * from "../features/customId/customid.types.js";
|
|
6
|
+
export * from "../features/events/events.types.js";
|
|
7
|
+
export * from "../features/modules/modules.types.js";
|
|
8
|
+
export * from "../features/permissions/permissions.types.js";
|
|
9
|
+
export {
|
|
10
|
+
default2 as TriviousClient
|
|
11
|
+
};
|
|
10
12
|
//# sourceMappingURL=typings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":["../../src/shared/typings.ts"],"sourcesContent":["export * from \"@feature/client/client.types.js\";\nexport { default as TriviousClient } from \"@feature/client/trivious.client.js\";\nexport * from \"@feature/commands/commands.types.js\";\nexport * from \"@feature/components/components.types.js\";\nexport * from \"@feature/customId/customid.types.js\";\nexport * from \"@feature/events/events.types.js\";\nexport * from \"@feature/modules/modules.types.js\";\nexport * from \"@feature/permissions/permissions.types.js\";\n"],"mappings":"AAAA,cAAc;AACd,SAAoB,WAAXA,gBAAiC;AAC1C,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":["default"]}
|
package/dist/utility/errors.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { a as BaseCommandData, S as SlashCommandData } from '../modules.types-
|
|
1
|
+
import { a as BaseCommandData, S as SlashCommandData } from '../modules.types-hjAYMYut.js';
|
|
2
2
|
import 'discord.js';
|
|
3
3
|
import '../features/client/client.types.js';
|
|
4
4
|
import '../features/permissions/permissions.types.js';
|
|
5
|
+
import '../features/client/logger.js';
|
|
5
6
|
|
|
6
7
|
declare class TriviousError extends Error {
|
|
7
8
|
readonly field?: string;
|
package/dist/utility/errors.js
CHANGED
|
@@ -18,7 +18,8 @@ class CommandError extends Error {
|
|
|
18
18
|
if ("data" in command) this.commandName = command.data?.name;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
export {
|
|
22
|
+
CommandError,
|
|
23
|
+
TriviousError
|
|
24
|
+
};
|
|
24
25
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utility/errors.ts"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utility/errors.ts"],"sourcesContent":["import { BaseCommandData, SlashCommandData } from \"@feature/commands/commands.types.js\";\n\nexport class TriviousError extends Error {\n\treadonly field?: string;\n\treadonly cause?: string;\n\n\tconstructor(message: string, cause?: string) {\n\t\tmessage = `[Trivious] ${message}`;\n\t\tsuper(message);\n\n\t\tthis.message = message;\n\t\tthis.cause = cause;\n\t\tthis.name = \"TriviousError\";\n\t}\n}\n\nexport class CommandError extends Error {\n\treadonly commandName?: string;\n\n\tconstructor(message: string, command: Partial<BaseCommandData | SlashCommandData>) {\n\t\tmessage = `[Trivious] ${message}`;\n\t\tsuper(message);\n\n\t\tthis.name = \"CommandError\";\n\n\t\tif (\"data\" in command) this.commandName = command.data?.name;\n\t\t// if (this.commandContext && this.commandName)\n\t\t// \tthis.cause = `Error in ${this.commandContext} '${this.commandName}'`;\n\t}\n}\n"],"mappings":"AAEO,MAAM,sBAAsB,MAAM;AAAA,EAC/B;AAAA,EACA;AAAA,EAET,YAAY,SAAiB,OAAgB;AAC5C,cAAU,cAAc,OAAO;AAC/B,UAAM,OAAO;AAEb,SAAK,UAAU;AACf,SAAK,QAAQ;AACb,SAAK,OAAO;AAAA,EACb;AACD;AAEO,MAAM,qBAAqB,MAAM;AAAA,EAC9B;AAAA,EAET,YAAY,SAAiB,SAAsD;AAClF,cAAU,cAAc,OAAO;AAC/B,UAAM,OAAO;AAEb,SAAK,OAAO;AAEZ,QAAI,UAAU,QAAS,MAAK,cAAc,QAAQ,MAAM;AAAA,EAGzD;AACD;","names":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { promises } from
|
|
2
|
-
import { pathToFileURL } from
|
|
3
|
-
|
|
1
|
+
import { promises as fs } from "fs";
|
|
2
|
+
import { pathToFileURL } from "url";
|
|
4
3
|
async function importFile(filePath) {
|
|
5
4
|
try {
|
|
6
5
|
const { default: file } = await import(pathToFileURL(filePath).href);
|
|
@@ -20,13 +19,14 @@ async function importFile(filePath) {
|
|
|
20
19
|
}
|
|
21
20
|
async function exists(path) {
|
|
22
21
|
try {
|
|
23
|
-
await
|
|
22
|
+
await fs.access(path);
|
|
24
23
|
return true;
|
|
25
24
|
} catch {
|
|
26
25
|
return false;
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
export {
|
|
29
|
+
exists,
|
|
30
|
+
importFile
|
|
31
|
+
};
|
|
32
32
|
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utility/functions.ts"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utility/functions.ts"],"sourcesContent":["import { promises as fs } from \"fs\";\nimport { pathToFileURL } from \"url\";\n\nexport async function importFile<T>(filePath: string): Promise<T | null> {\n\ttry {\n\t\tconst { default: file } = await import(pathToFileURL(filePath).href);\n\t\tif (!file) return null;\n\n\t\tconst imports = file.default || file;\n\n\t\tif (typeof imports === \"function\" && imports.prototype) {\n\t\t\treturn new imports() as T;\n\t\t}\n\n\t\tif (typeof imports == \"object\") {\n\t\t\tif (Object.keys(imports).length === 0) return null;\n\t\t\treturn imports as T;\n\t\t}\n\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport async function exists(path: string) {\n\ttry {\n\t\tawait fs.access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n"],"mappings":"AAAA,SAAS,YAAY,UAAU;AAC/B,SAAS,qBAAqB;AAE9B,eAAsB,WAAc,UAAqC;AACxE,MAAI;AACH,UAAM,EAAE,SAAS,KAAK,IAAI,MAAM,OAAO,cAAc,QAAQ,EAAE;AAC/D,QAAI,CAAC,KAAM,QAAO;AAElB,UAAM,UAAU,KAAK,WAAW;AAEhC,QAAI,OAAO,YAAY,cAAc,QAAQ,WAAW;AACvD,aAAO,IAAI,QAAQ;AAAA,IACpB;AAEA,QAAI,OAAO,WAAW,UAAU;AAC/B,UAAI,OAAO,KAAK,OAAO,EAAE,WAAW,EAAG,QAAO;AAC9C,aAAO;AAAA,IACR;AAEA,WAAO;AAAA,EACR,QAAQ;AACP,WAAO;AAAA,EACR;AACD;AAEA,eAAsB,OAAO,MAAc;AAC1C,MAAI;AACH,UAAM,GAAG,OAAO,IAAI;AACpB,WAAO;AAAA,EACR,QAAQ;AACP,WAAO;AAAA,EACR;AACD;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trivious",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"discord-bot",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"lint": "eslint --fix src",
|
|
45
45
|
"format": "prettier --write src",
|
|
46
46
|
"typecheck": "tsc --noEmit",
|
|
47
|
-
"test": "vitest
|
|
47
|
+
"test": "vitest",
|
|
48
|
+
"dev": "tsx dev/index.ts",
|
|
48
49
|
"coverage": "vitest run --coverage",
|
|
49
|
-
"dev": "tsup --watch",
|
|
50
50
|
"release": "semantic-release",
|
|
51
51
|
"prepare": "npm run build"
|
|
52
52
|
},
|
|
@@ -56,10 +56,12 @@
|
|
|
56
56
|
"@semantic-release/git": "^10.0.1",
|
|
57
57
|
"@semantic-release/github": "^12.0.2",
|
|
58
58
|
"@semantic-release/npm": "^13.1.2",
|
|
59
|
+
"@swc/core": "^1.15.40",
|
|
59
60
|
"@types/node": "^24.10.1",
|
|
60
61
|
"@typescript-eslint/eslint-plugin": "^8.57.0",
|
|
61
62
|
"@typescript-eslint/parser": "^8.57.0",
|
|
62
|
-
"@vitest/coverage-v8": "^4.
|
|
63
|
+
"@vitest/coverage-v8": "^4.1.7",
|
|
64
|
+
"chalk": "^5.6.2",
|
|
63
65
|
"dotenv": "^17.2.3",
|
|
64
66
|
"eslint": "^9.39.1",
|
|
65
67
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -70,9 +72,12 @@
|
|
|
70
72
|
"semantic-release": "^25.0.2",
|
|
71
73
|
"tsc-alias": "^1.8.16",
|
|
72
74
|
"tsup": "^8.5.1",
|
|
75
|
+
"tsx": "^4.22.3",
|
|
73
76
|
"typescript": "^5.9.3",
|
|
74
77
|
"typescript-eslint": "^8.57.0",
|
|
75
|
-
"
|
|
78
|
+
"vite": "^8.0.14",
|
|
79
|
+
"vite-tsconfig-paths": "^6.1.1",
|
|
80
|
+
"vitest": "^4.1.7"
|
|
76
81
|
},
|
|
77
82
|
"dependencies": {
|
|
78
83
|
"discord.js": "^14.26.4"
|