trivious 1.5.2 → 1.5.4
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/README.md +38 -19
- package/dist/core/builders/util.builders.cjs.map +1 -1
- package/dist/core/builders/util.builders.d.cts +15 -0
- package/dist/core/builders/util.builders.d.ts +15 -0
- package/dist/core/builders/util.builders.js.map +1 -1
- package/dist/core/client/trivious.client.d.cts +1 -1
- package/dist/core/client/trivious.client.d.ts +1 -1
- package/dist/core/commands/command.base.d.cts +1 -1
- package/dist/core/commands/command.base.d.ts +1 -1
- package/dist/core/commands/subcommand.base.d.cts +1 -1
- package/dist/core/commands/subcommand.base.d.ts +1 -1
- package/dist/core/components/component.base.cjs +1 -2
- package/dist/core/components/component.base.cjs.map +1 -1
- package/dist/core/components/component.base.d.cts +1 -1
- package/dist/core/components/component.base.d.ts +1 -1
- package/dist/core/components/component.base.js +2 -3
- package/dist/core/components/component.base.js.map +1 -1
- package/dist/core/events/clientReady.d.cts +1 -1
- package/dist/core/events/clientReady.d.ts +1 -1
- package/dist/core/events/interactionCreate.d.cts +1 -1
- package/dist/core/events/interactionCreate.d.ts +1 -1
- package/dist/core/registry/command.registry.d.cts +1 -1
- package/dist/core/registry/command.registry.d.ts +1 -1
- package/dist/core/registry/component.registry.d.cts +1 -1
- package/dist/core/registry/component.registry.d.ts +1 -1
- package/dist/core/registry/event.registry.d.cts +1 -1
- package/dist/core/registry/event.registry.d.ts +1 -1
- package/dist/core/registry/index.d.cts +1 -1
- package/dist/core/registry/index.d.ts +1 -1
- package/dist/core/registry/module.registry.d.cts +1 -1
- package/dist/core/registry/module.registry.d.ts +1 -1
- package/dist/{index-ezMHiXmy.d.cts → index-Do60I3dv.d.cts} +9 -7
- package/dist/{index-HF-OBZPh.d.ts → index-JgBW-tT-.d.ts} +9 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/shared/typings/client.d.cts +1 -1
- package/dist/shared/typings/client.d.ts +1 -1
- package/dist/shared/typings/commands.d.cts +1 -1
- package/dist/shared/typings/commands.d.ts +1 -1
- package/dist/shared/typings/components.cjs +5 -0
- package/dist/shared/typings/components.cjs.map +1 -1
- package/dist/shared/typings/components.d.cts +1 -1
- package/dist/shared/typings/components.d.ts +1 -1
- package/dist/shared/typings/components.js +5 -1
- package/dist/shared/typings/components.js.map +1 -1
- package/dist/shared/typings/events.d.cts +1 -1
- package/dist/shared/typings/events.d.ts +1 -1
- package/dist/shared/typings/index.d.cts +1 -1
- package/dist/shared/typings/index.d.ts +1 -1
- package/dist/shared/typings/module.d.cts +1 -1
- package/dist/shared/typings/module.d.ts +1 -1
- package/dist/shared/typings/permissions.d.cts +1 -1
- package/dist/shared/typings/permissions.d.ts +1 -1
- package/dist/shared/utility/functions.d.cts +1 -1
- package/dist/shared/utility/functions.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,28 +47,47 @@ const client = new TriviousClient({
|
|
|
47
47
|
### Creating a Slash Command
|
|
48
48
|
```ts
|
|
49
49
|
// src/core/commands/debug/index.ts
|
|
50
|
-
import { CommandBuilder,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
data = data;
|
|
62
|
-
metadata = metadata;
|
|
63
|
-
|
|
64
|
-
// Optional: run when no subcommand is used
|
|
65
|
-
async run?(client, interaction) {
|
|
66
|
-
await this.reply(interaction, { content: "Use a subcommand!" });
|
|
67
|
-
}
|
|
68
|
-
}
|
|
50
|
+
import { CommandBuilder, SlashCommand } from "trivious"
|
|
51
|
+
|
|
52
|
+
export default class DebugCommand extends SlashCommand {
|
|
53
|
+
constructor() {
|
|
54
|
+
super(new CommandBuilder()
|
|
55
|
+
.setName("debug")
|
|
56
|
+
.setDescription("Debug tools")
|
|
57
|
+
.setGuildOnly()
|
|
58
|
+
.setEphemeralReply())
|
|
59
|
+
}
|
|
60
|
+
};
|
|
69
61
|
```
|
|
70
62
|
> Subcommands go in the same directory as the command file and are auto-detected.
|
|
71
63
|
|
|
64
|
+
### Creating a Subcommand
|
|
65
|
+
```ts
|
|
66
|
+
// src/core/commands/debug/ping.ts
|
|
67
|
+
import { ChatInputCommandInteraction, Subcommand, SubcommandBuilder, TriviousClient } from "trivious";
|
|
68
|
+
|
|
69
|
+
export default class DebugPingSubcommand extends Subcommand {
|
|
70
|
+
constructor() {
|
|
71
|
+
super(new SubcommandBuilder()
|
|
72
|
+
.setName("ping")
|
|
73
|
+
.setDescription("Ping pong!")
|
|
74
|
+
.setOwnerOnly())
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
execute = async (client: TriviousClient, interaction: ChatInputCommandInteraction) => {
|
|
78
|
+
try {
|
|
79
|
+
const sent = await interaction.fetchReply();
|
|
80
|
+
const latency = sent.createdTimestamp - interaction.createdTimestamp;
|
|
81
|
+
const apiLatency = Math.round(interaction.client.ws.ping);
|
|
82
|
+
|
|
83
|
+
await this.reply(interaction, { content: `Pong!\nLatency ${latency}ms API Latency: ${apiLatency}ms` });
|
|
84
|
+
} catch (error: any) {
|
|
85
|
+
console.error(error);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
```
|
|
90
|
+
|
|
72
91
|
---
|
|
73
92
|
|
|
74
93
|
### Permission Levels
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/builders/util.builders.ts"],"names":["ActionRowBuilder","EmbedBuilder"],"mappings":";;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/core/builders/util.builders.ts"],"names":["ActionRowBuilder","EmbedBuilder"],"mappings":";;;;AAUO,SAAS,mBAA+D,QAAA,EAAe;AAC7F,EAAA,OAAO,IAAIA,2BAAA,EAAoB,CAAE,aAAA,CAAc,GAAG,QAAQ,CAAA;AAC3D;AASO,SAAS,YAAY,IAAA,EAA6B;AACxD,EAAA,OAAO,IAAIC,wBAAa,IAAI,CAAA;AAC7B","file":"util.builders.cjs","sourcesContent":["import { ActionRowBuilder, APIEmbed, EmbedBuilder, EmbedData, MessageActionRowComponentBuilder } from \"discord.js\";\n\n/**\n * Utility action row builder\n *\n * @export\n * @template {MessageActionRowComponentBuilder} T\n * @param {...T[]} builders\n * @returns {*}\n */\nexport function createActionRow<T extends MessageActionRowComponentBuilder>(...builders: T[]) {\n\treturn new ActionRowBuilder<T>().setComponents(...builders);\n}\n\n/**\n * Utility embed builder\n *\n * @export\n * @param {?(EmbedData | APIEmbed)} [data]\n * @returns {*}\n */\nexport function createEmbed(data?: EmbedData | APIEmbed) {\n\treturn new EmbedBuilder(data);\n}\n"]}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { MessageActionRowComponentBuilder, ActionRowBuilder, EmbedData, APIEmbed, EmbedBuilder } from 'discord.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Utility action row builder
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @template {MessageActionRowComponentBuilder} T
|
|
8
|
+
* @param {...T[]} builders
|
|
9
|
+
* @returns {*}
|
|
10
|
+
*/
|
|
3
11
|
declare function createActionRow<T extends MessageActionRowComponentBuilder>(...builders: T[]): ActionRowBuilder<T>;
|
|
12
|
+
/**
|
|
13
|
+
* Utility embed builder
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @param {?(EmbedData | APIEmbed)} [data]
|
|
17
|
+
* @returns {*}
|
|
18
|
+
*/
|
|
4
19
|
declare function createEmbed(data?: EmbedData | APIEmbed): EmbedBuilder;
|
|
5
20
|
|
|
6
21
|
export { createActionRow, createEmbed };
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { MessageActionRowComponentBuilder, ActionRowBuilder, EmbedData, APIEmbed, EmbedBuilder } from 'discord.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Utility action row builder
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @template {MessageActionRowComponentBuilder} T
|
|
8
|
+
* @param {...T[]} builders
|
|
9
|
+
* @returns {*}
|
|
10
|
+
*/
|
|
3
11
|
declare function createActionRow<T extends MessageActionRowComponentBuilder>(...builders: T[]): ActionRowBuilder<T>;
|
|
12
|
+
/**
|
|
13
|
+
* Utility embed builder
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @param {?(EmbedData | APIEmbed)} [data]
|
|
17
|
+
* @returns {*}
|
|
18
|
+
*/
|
|
4
19
|
declare function createEmbed(data?: EmbedData | APIEmbed): EmbedBuilder;
|
|
5
20
|
|
|
6
21
|
export { createActionRow, createEmbed };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/builders/util.builders.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"sources":["../../../src/core/builders/util.builders.ts"],"names":[],"mappings":";;AAUO,SAAS,mBAA+D,QAAA,EAAe;AAC7F,EAAA,OAAO,IAAI,gBAAA,EAAoB,CAAE,aAAA,CAAc,GAAG,QAAQ,CAAA;AAC3D;AASO,SAAS,YAAY,IAAA,EAA6B;AACxD,EAAA,OAAO,IAAI,aAAa,IAAI,CAAA;AAC7B","file":"util.builders.js","sourcesContent":["import { ActionRowBuilder, APIEmbed, EmbedBuilder, EmbedData, MessageActionRowComponentBuilder } from \"discord.js\";\n\n/**\n * Utility action row builder\n *\n * @export\n * @template {MessageActionRowComponentBuilder} T\n * @param {...T[]} builders\n * @returns {*}\n */\nexport function createActionRow<T extends MessageActionRowComponentBuilder>(...builders: T[]) {\n\treturn new ActionRowBuilder<T>().setComponents(...builders);\n}\n\n/**\n * Utility embed builder\n *\n * @export\n * @param {?(EmbedData | APIEmbed)} [data]\n * @returns {*}\n */\nexport function createEmbed(data?: EmbedData | APIEmbed) {\n\treturn new EmbedBuilder(data);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export {
|
|
2
|
+
export { l as CommandBuilder, n as ContextMenuBuilder, m as ContextMenuCommand, S as SlashCommand, k as default } from '../../index-Do60I3dv.cjs';
|
|
3
3
|
import '../../shared/typings/registry.cjs';
|
|
4
4
|
import '../builders/util.builders.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export {
|
|
2
|
+
export { l as CommandBuilder, n as ContextMenuBuilder, m as ContextMenuCommand, S as SlashCommand, k as default } from '../../index-JgBW-tT-.js';
|
|
3
3
|
import '../../shared/typings/registry.js';
|
|
4
4
|
import '../builders/util.builders.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export {
|
|
2
|
+
export { p as SubcommandBuilder, o as default } from '../../index-Do60I3dv.cjs';
|
|
3
3
|
import '../../shared/typings/registry.cjs';
|
|
4
4
|
import '../builders/util.builders.cjs';
|
|
@@ -21,8 +21,7 @@ class ComponentBuilder {
|
|
|
21
21
|
* @returns {this}
|
|
22
22
|
*/
|
|
23
23
|
setCustomId(options) {
|
|
24
|
-
|
|
25
|
-
this._customId = `${type}:${data}${tags ? `.${tags.join(".")}` : ""}`;
|
|
24
|
+
this._customId = index_js.constructCustomId(options);
|
|
26
25
|
return this;
|
|
27
26
|
}
|
|
28
27
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/components/component.base.ts"],"names":["PermissionLevel","hasPermission"],"mappings":";;;;;;;AAuBO,MAAM,gBAAA,CAAiB;AAAA,EACrB,SAAA,GAAY,EAAA;AAAA,EACZ,cAAcA,wBAAA,CAAgB,IAAA;AAAA,EAC9B,eAAA,GAAkB,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAanB,YAAY,OAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/core/components/component.base.ts"],"names":["PermissionLevel","constructCustomId","hasPermission"],"mappings":";;;;;;;AAuBO,MAAM,gBAAA,CAAiB;AAAA,EACrB,SAAA,GAAY,EAAA;AAAA,EACZ,cAAcA,wBAAA,CAAgB,IAAA;AAAA,EAC9B,eAAA,GAAkB,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAanB,YAAY,OAAA,EAAyC;AAC3D,IAAA,IAAA,CAAK,SAAA,GAAYC,2BAAkB,OAAO,CAAA;AAC1C,IAAA,OAAO,IAAA;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,cAAc,UAAA,EAAmC;AACvD,IAAA,IAAA,CAAK,WAAA,GAAc,UAAA;AACnB,IAAA,OAAO,IAAA;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,iBAAA,GAA0B;AAChC,IAAA,IAAA,CAAK,eAAA,GAAkB,IAAA;AACvB,IAAA,OAAO,IAAA;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,KAAA,GAAQ;AACd,IAAA,OAAO;AAAA,MACN,QAAA,EAAU;AAAA,QACT,UAAU,IAAA,CAAK,SAAA;AAAA,QACf,YAAY,IAAA,CAAK,WAAA;AAAA,QACjB,gBAAgB,IAAA,CAAK;AAAA;AACtB,KACD;AAAA,EACD;AACD;AAUA,MAAO,SAAA,CAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBvC,MAAM,uBAAA,CACL,MAAA,EACA,WAAA,EACA,UAAA,EACA,UAAmB,IAAA,EAClB;AACD,IAAA,IAAI,YAAY,KAAA,EAAO;AACtB,MAAA,MAAM,SAAS,WAAA,CAAY,MAAA;AAC3B,MAAA,MAAM,sBAAsBC,0BAAA,CAAc,MAAA,EAAQ,EAAE,UAAA,EAAY,QAAQ,CAAA;AAExE,MAAA,IAAI,CAAC,mBAAA,EAAqB;AACzB,QAAA,IAAI,OAAA;AACH,UAAA,MAAM,IAAA,CAAK,MAAM,WAAA,EAAa;AAAA,YAC7B,OAAA,EAAS,CAAA,uEAAA,EAA0EF,wBAAA,CAAgB,UAAU,CAAC,CAAA,EAAA;AAAA,WAC9G,CAAA;AACF,QAAA,OAAO,KAAA;AAAA,MACR;AAAA,IACD;AAEA,IAAA,OAAO,IAAA;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,KAAA,CACL,WAAA,EACA,OAAA,EACC;AACD,IAAA,IAAI,YAAY,OAAA,EAAS;AACxB,MAAA,MAAM,WAAA,CAAY,UAAU,OAAsC,CAAA;AAClE,MAAA;AAAA,IACD;AAEA,IAAA,MAAM,UAAA,GAAa,EAAE,GAAG,OAAA,EAAQ;AAChC,IAAA,IAAI,KAAK,QAAA,CAAS,cAAA,EAAgB,UAAA,CAAW,KAAA,GAAQ,CAAC,WAAW,CAAA;AAEjE,IAAA,MAAM,WAAA,CAAY,MAAM,UAAU,CAAA;AAAA,EACnC;AACD","file":"component.base.cjs","sourcesContent":["import {\n\tGuildMember,\n\tInteractionEditReplyOptions,\n\tInteractionReplyOptions,\n\tMessagePayload,\n} from \"discord.js\";\nimport {\n\tComponentInteraction,\n\tComponentMetadata,\n\tconstructCustomId,\n\tCustomIdConstructOptions,\n\tPermissionLevel,\n} from \"src/shared/typings/index.js\";\nimport { hasPermission } from \"src/shared/utility/functions.js\";\nimport TriviousClient from \"../client/trivious.client.js\";\n\n/**\n * Base ComponentBuilder.\n *\n * @export\n * @class ComponentBuilder\n * @typedef {ComponentBuilder}\n */\nexport class ComponentBuilder {\n\tprivate _customId = \"\";\n\tprivate _permission = PermissionLevel.USER;\n\tprivate _ephemeralReply = false;\n\n\t/**\n\t * Set the customId for the component.\n\t *\n\t * @public\n\t * @param {{\n\t * \t\ttype: ComponentType;\n\t * \t\tdata: string;\n\t * \t\ttags?: ComponentCustomIdTag[];\n\t * \t}} options\n\t * @returns {this}\n\t */\n\tpublic setCustomId(options: CustomIdConstructOptions): this {\n\t\tthis._customId = constructCustomId(options);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the permission required to use the component.\n\t *\n\t * @public\n\t * @param {PermissionLevel} permission\n\t * @returns {this}\n\t */\n\tpublic setPermission(permission: PermissionLevel): this {\n\t\tthis._permission = permission;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the interaction as ephemeral.\n\t *\n\t * @public\n\t * @returns {this}\n\t */\n\tpublic setEphemeralReply(): this {\n\t\tthis._ephemeralReply = true;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Builder the builder.\n\t *\n\t * @public\n\t * @returns {{ metadata: ComponentMetadata; }}\n\t */\n\tpublic build() {\n\t\treturn {\n\t\t\tmetadata: {\n\t\t\t\tcustomId: this._customId,\n\t\t\t\tpermission: this._permission,\n\t\t\t\tephemeralReply: this._ephemeralReply,\n\t\t\t} satisfies ComponentMetadata,\n\t\t};\n\t}\n}\n\n/**\n * Base Component.\n *\n * @export\n * @abstract\n * @class Component\n * @typedef {Component}\n */\nexport default abstract class Component {\n\tabstract metadata: ComponentMetadata;\n\t/**\n\t * Execute the component.\n\t *\n\t * @abstract\n\t * @type {(client: TriviousClient, interaction: ComponentInteraction) => Promise<void>}\n\t */\n\tabstract execute: (client: TriviousClient, interaction: ComponentInteraction) => Promise<void>;\n\n\t/**\n\t * Validate permissions for a user/member in a guild.\n\t *\n\t * @async\n\t * @param {ComponentInteraction} interaction\n\t * @param {PermissionLevel} permission\n\t * @param {boolean} [doReply=true] Defaults to `true`\n\t * @returns {unknown}\n\t */\n\tasync validateGuildPermission(\n\t\tclient: TriviousClient,\n\t\tinteraction: ComponentInteraction,\n\t\tpermission: PermissionLevel,\n\t\tdoReply: boolean = true\n\t) {\n\t\tif (interaction.guild) {\n\t\t\tconst member = interaction.member as GuildMember;\n\t\t\tconst memberHasPermission = hasPermission(client, { permission, member });\n\n\t\t\tif (!memberHasPermission) {\n\t\t\t\tif (doReply)\n\t\t\t\t\tawait this.reply(interaction, {\n\t\t\t\t\t\tcontent: `You do not have permission to run this command, required permission: \\`${PermissionLevel[permission]}\\``,\n\t\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Reply to the interaction respecting command metadata and if the interaction has already been replied to.\n\t *\n\t * @async\n\t * @param {ComponentInteraction} interaction\n\t * @param {(MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions)} options\n\t * @returns {*}\n\t */\n\tasync reply(\n\t\tinteraction: ComponentInteraction,\n\t\toptions: MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions\n\t) {\n\t\tif (interaction.replied) {\n\t\t\tawait interaction.editReply(options as InteractionEditReplyOptions);\n\t\t\treturn;\n\t\t}\n\n\t\tconst newOptions = { ...options } as InteractionReplyOptions;\n\t\tif (this.metadata.ephemeralReply) newOptions.flags = [\"Ephemeral\"];\n\n\t\tawait interaction.reply(newOptions);\n\t}\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export {
|
|
2
|
+
export { z as ComponentBuilder, y as default } from '../../index-Do60I3dv.cjs';
|
|
3
3
|
import '../../shared/typings/registry.cjs';
|
|
4
4
|
import '../builders/util.builders.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PermissionLevel } from '../../shared/typings/index.js';
|
|
1
|
+
import { PermissionLevel, constructCustomId } from '../../shared/typings/index.js';
|
|
2
2
|
import { hasPermission } from '../../shared/utility/functions.js';
|
|
3
3
|
|
|
4
4
|
class ComponentBuilder {
|
|
@@ -17,8 +17,7 @@ class ComponentBuilder {
|
|
|
17
17
|
* @returns {this}
|
|
18
18
|
*/
|
|
19
19
|
setCustomId(options) {
|
|
20
|
-
|
|
21
|
-
this._customId = `${type}:${data}${tags ? `.${tags.join(".")}` : ""}`;
|
|
20
|
+
this._customId = constructCustomId(options);
|
|
22
21
|
return this;
|
|
23
22
|
}
|
|
24
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/components/component.base.ts"],"names":[],"mappings":";;;AAuBO,MAAM,gBAAA,CAAiB;AAAA,EACrB,SAAA,GAAY,EAAA;AAAA,EACZ,cAAc,eAAA,CAAgB,IAAA;AAAA,EAC9B,eAAA,GAAkB,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAanB,YAAY,OAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/core/components/component.base.ts"],"names":[],"mappings":";;;AAuBO,MAAM,gBAAA,CAAiB;AAAA,EACrB,SAAA,GAAY,EAAA;AAAA,EACZ,cAAc,eAAA,CAAgB,IAAA;AAAA,EAC9B,eAAA,GAAkB,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAanB,YAAY,OAAA,EAAyC;AAC3D,IAAA,IAAA,CAAK,SAAA,GAAY,kBAAkB,OAAO,CAAA;AAC1C,IAAA,OAAO,IAAA;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,cAAc,UAAA,EAAmC;AACvD,IAAA,IAAA,CAAK,WAAA,GAAc,UAAA;AACnB,IAAA,OAAO,IAAA;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,iBAAA,GAA0B;AAChC,IAAA,IAAA,CAAK,eAAA,GAAkB,IAAA;AACvB,IAAA,OAAO,IAAA;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,KAAA,GAAQ;AACd,IAAA,OAAO;AAAA,MACN,QAAA,EAAU;AAAA,QACT,UAAU,IAAA,CAAK,SAAA;AAAA,QACf,YAAY,IAAA,CAAK,WAAA;AAAA,QACjB,gBAAgB,IAAA,CAAK;AAAA;AACtB,KACD;AAAA,EACD;AACD;AAUA,MAAO,SAAA,CAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBvC,MAAM,uBAAA,CACL,MAAA,EACA,WAAA,EACA,UAAA,EACA,UAAmB,IAAA,EAClB;AACD,IAAA,IAAI,YAAY,KAAA,EAAO;AACtB,MAAA,MAAM,SAAS,WAAA,CAAY,MAAA;AAC3B,MAAA,MAAM,sBAAsB,aAAA,CAAc,MAAA,EAAQ,EAAE,UAAA,EAAY,QAAQ,CAAA;AAExE,MAAA,IAAI,CAAC,mBAAA,EAAqB;AACzB,QAAA,IAAI,OAAA;AACH,UAAA,MAAM,IAAA,CAAK,MAAM,WAAA,EAAa;AAAA,YAC7B,OAAA,EAAS,CAAA,uEAAA,EAA0E,eAAA,CAAgB,UAAU,CAAC,CAAA,EAAA;AAAA,WAC9G,CAAA;AACF,QAAA,OAAO,KAAA;AAAA,MACR;AAAA,IACD;AAEA,IAAA,OAAO,IAAA;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,KAAA,CACL,WAAA,EACA,OAAA,EACC;AACD,IAAA,IAAI,YAAY,OAAA,EAAS;AACxB,MAAA,MAAM,WAAA,CAAY,UAAU,OAAsC,CAAA;AAClE,MAAA;AAAA,IACD;AAEA,IAAA,MAAM,UAAA,GAAa,EAAE,GAAG,OAAA,EAAQ;AAChC,IAAA,IAAI,KAAK,QAAA,CAAS,cAAA,EAAgB,UAAA,CAAW,KAAA,GAAQ,CAAC,WAAW,CAAA;AAEjE,IAAA,MAAM,WAAA,CAAY,MAAM,UAAU,CAAA;AAAA,EACnC;AACD","file":"component.base.js","sourcesContent":["import {\n\tGuildMember,\n\tInteractionEditReplyOptions,\n\tInteractionReplyOptions,\n\tMessagePayload,\n} from \"discord.js\";\nimport {\n\tComponentInteraction,\n\tComponentMetadata,\n\tconstructCustomId,\n\tCustomIdConstructOptions,\n\tPermissionLevel,\n} from \"src/shared/typings/index.js\";\nimport { hasPermission } from \"src/shared/utility/functions.js\";\nimport TriviousClient from \"../client/trivious.client.js\";\n\n/**\n * Base ComponentBuilder.\n *\n * @export\n * @class ComponentBuilder\n * @typedef {ComponentBuilder}\n */\nexport class ComponentBuilder {\n\tprivate _customId = \"\";\n\tprivate _permission = PermissionLevel.USER;\n\tprivate _ephemeralReply = false;\n\n\t/**\n\t * Set the customId for the component.\n\t *\n\t * @public\n\t * @param {{\n\t * \t\ttype: ComponentType;\n\t * \t\tdata: string;\n\t * \t\ttags?: ComponentCustomIdTag[];\n\t * \t}} options\n\t * @returns {this}\n\t */\n\tpublic setCustomId(options: CustomIdConstructOptions): this {\n\t\tthis._customId = constructCustomId(options);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the permission required to use the component.\n\t *\n\t * @public\n\t * @param {PermissionLevel} permission\n\t * @returns {this}\n\t */\n\tpublic setPermission(permission: PermissionLevel): this {\n\t\tthis._permission = permission;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the interaction as ephemeral.\n\t *\n\t * @public\n\t * @returns {this}\n\t */\n\tpublic setEphemeralReply(): this {\n\t\tthis._ephemeralReply = true;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Builder the builder.\n\t *\n\t * @public\n\t * @returns {{ metadata: ComponentMetadata; }}\n\t */\n\tpublic build() {\n\t\treturn {\n\t\t\tmetadata: {\n\t\t\t\tcustomId: this._customId,\n\t\t\t\tpermission: this._permission,\n\t\t\t\tephemeralReply: this._ephemeralReply,\n\t\t\t} satisfies ComponentMetadata,\n\t\t};\n\t}\n}\n\n/**\n * Base Component.\n *\n * @export\n * @abstract\n * @class Component\n * @typedef {Component}\n */\nexport default abstract class Component {\n\tabstract metadata: ComponentMetadata;\n\t/**\n\t * Execute the component.\n\t *\n\t * @abstract\n\t * @type {(client: TriviousClient, interaction: ComponentInteraction) => Promise<void>}\n\t */\n\tabstract execute: (client: TriviousClient, interaction: ComponentInteraction) => Promise<void>;\n\n\t/**\n\t * Validate permissions for a user/member in a guild.\n\t *\n\t * @async\n\t * @param {ComponentInteraction} interaction\n\t * @param {PermissionLevel} permission\n\t * @param {boolean} [doReply=true] Defaults to `true`\n\t * @returns {unknown}\n\t */\n\tasync validateGuildPermission(\n\t\tclient: TriviousClient,\n\t\tinteraction: ComponentInteraction,\n\t\tpermission: PermissionLevel,\n\t\tdoReply: boolean = true\n\t) {\n\t\tif (interaction.guild) {\n\t\t\tconst member = interaction.member as GuildMember;\n\t\t\tconst memberHasPermission = hasPermission(client, { permission, member });\n\n\t\t\tif (!memberHasPermission) {\n\t\t\t\tif (doReply)\n\t\t\t\t\tawait this.reply(interaction, {\n\t\t\t\t\t\tcontent: `You do not have permission to run this command, required permission: \\`${PermissionLevel[permission]}\\``,\n\t\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Reply to the interaction respecting command metadata and if the interaction has already been replied to.\n\t *\n\t * @async\n\t * @param {ComponentInteraction} interaction\n\t * @param {(MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions)} options\n\t * @returns {*}\n\t */\n\tasync reply(\n\t\tinteraction: ComponentInteraction,\n\t\toptions: MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions\n\t) {\n\t\tif (interaction.replied) {\n\t\t\tawait interaction.editReply(options as InteractionEditReplyOptions);\n\t\t\treturn;\n\t\t}\n\n\t\tconst newOptions = { ...options } as InteractionReplyOptions;\n\t\tif (this.metadata.ephemeralReply) newOptions.flags = [\"Ephemeral\"];\n\n\t\tawait interaction.reply(newOptions);\n\t}\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CommandRegistry, a as ComponentRegistry, E as EventRegistry, M as ModuleRegistry, b as TriviousClientOptions, T as TriviousClient } from '../../index-
|
|
1
|
+
import { C as CommandRegistry, a as ComponentRegistry, E as EventRegistry, M as ModuleRegistry, b as TriviousClientOptions, T as TriviousClient } from '../../index-Do60I3dv.cjs';
|
|
2
2
|
import '../../shared/typings/registry.cjs';
|
|
3
3
|
import 'discord.js';
|
|
4
4
|
import '../builders/util.builders.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CommandRegistry, a as ComponentRegistry, E as EventRegistry, M as ModuleRegistry, b as TriviousClientOptions, T as TriviousClient } from '../../index-
|
|
1
|
+
import { C as CommandRegistry, a as ComponentRegistry, E as EventRegistry, M as ModuleRegistry, b as TriviousClientOptions, T as TriviousClient } from '../../index-JgBW-tT-.js';
|
|
2
2
|
import '../../shared/typings/registry.js';
|
|
3
3
|
import 'discord.js';
|
|
4
4
|
import '../builders/util.builders.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseRegistry } from './shared/typings/registry.cjs';
|
|
2
2
|
import * as discord_js from 'discord.js';
|
|
3
|
-
import { GuildMember, AnySelectMenuInteraction, CacheType, ButtonInteraction as ButtonInteraction$1, ModalSubmitInteraction as ModalSubmitInteraction$1, SlashCommandBuilder, ContextMenuCommandBuilder, Collection, MessagePayload, InteractionEditReplyOptions, InteractionReplyOptions, SlashCommandSubcommandBuilder, ChatInputCommandInteraction as ChatInputCommandInteraction$1, ClientOptions, ClientEvents,
|
|
3
|
+
import { GuildMember, AnySelectMenuInteraction, CacheType, ButtonInteraction as ButtonInteraction$1, ModalSubmitInteraction as ModalSubmitInteraction$1, SlashCommandBuilder, ContextMenuCommandBuilder, Collection, MessagePayload, InteractionEditReplyOptions, InteractionReplyOptions, SlashCommandSubcommandBuilder, ChatInputCommandInteraction as ChatInputCommandInteraction$1, ClientOptions, ClientEvents, Client, StringSelectMenuInteraction as StringSelectMenuInteraction$1, ContextMenuCommandInteraction as ContextMenuCommandInteraction$1 } from 'discord.js';
|
|
4
4
|
import './core/builders/util.builders.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -88,6 +88,12 @@ declare const deconstructCustomId: (customId: string) => {
|
|
|
88
88
|
data: string;
|
|
89
89
|
tags: "awaited"[];
|
|
90
90
|
};
|
|
91
|
+
type CustomIdConstructOptions = {
|
|
92
|
+
type: ComponentType;
|
|
93
|
+
data: string;
|
|
94
|
+
tags?: ComponentCustomIdTag[];
|
|
95
|
+
};
|
|
96
|
+
declare const constructCustomId: (options: CustomIdConstructOptions) => string;
|
|
91
97
|
|
|
92
98
|
/**
|
|
93
99
|
* Base class for a Command.
|
|
@@ -763,11 +769,7 @@ declare class ComponentBuilder {
|
|
|
763
769
|
* }} options
|
|
764
770
|
* @returns {this}
|
|
765
771
|
*/
|
|
766
|
-
setCustomId(options:
|
|
767
|
-
type: ComponentType$1;
|
|
768
|
-
data: string;
|
|
769
|
-
tags?: ComponentCustomIdTag[];
|
|
770
|
-
}): this;
|
|
772
|
+
setCustomId(options: CustomIdConstructOptions): this;
|
|
771
773
|
/**
|
|
772
774
|
* Set the permission required to use the component.
|
|
773
775
|
*
|
|
@@ -949,4 +951,4 @@ type StringSelectMenuInteraction = StringSelectMenuInteraction$1<CacheType>;
|
|
|
949
951
|
type ModalSubmitInteraction = ModalSubmitInteraction$1<CacheType>;
|
|
950
952
|
type ContextMenuCommandInteraction = ContextMenuCommandInteraction$1<CacheType>;
|
|
951
953
|
|
|
952
|
-
export { type AnyCommand as A, type
|
|
954
|
+
export { type AnyCommand as A, type ChatInputCommandInteraction as B, CommandRegistry as C, type ButtonInteraction as D, EventRegistry as E, type StringSelectMenuInteraction as F, type ModalSubmitInteraction as G, type ContextMenuCommandInteraction as H, ModuleRegistry as M, PermissionLevel as P, SlashCommand as S, TriviousClient as T, ComponentRegistry as a, type TriviousClientOptions as b, type ComponentCustomIdTag as c, type ComponentInteraction as d, ComponentType as e, type ComponentMetadata as f, getPermissionLevel as g, deconstructCustomId as h, type CustomIdConstructOptions as i, constructCustomId as j, Command as k, CommandBuilder as l, ContextMenuCommand as m, ContextMenuBuilder as n, Subcommand as o, SubcommandBuilder as p, type CommandInteraction as q, type CommandMetadata as r, type SubcommandMetadata as s, type ContextMenuMetadata as t, type AnyCommandBuilder as u, type AnyCommandMetadata as v, type Event as w, type Module as x, Component as y, ComponentBuilder as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseRegistry } from './shared/typings/registry.js';
|
|
2
2
|
import * as discord_js from 'discord.js';
|
|
3
|
-
import { GuildMember, AnySelectMenuInteraction, CacheType, ButtonInteraction as ButtonInteraction$1, ModalSubmitInteraction as ModalSubmitInteraction$1, SlashCommandBuilder, ContextMenuCommandBuilder, Collection, MessagePayload, InteractionEditReplyOptions, InteractionReplyOptions, SlashCommandSubcommandBuilder, ChatInputCommandInteraction as ChatInputCommandInteraction$1, ClientOptions, ClientEvents,
|
|
3
|
+
import { GuildMember, AnySelectMenuInteraction, CacheType, ButtonInteraction as ButtonInteraction$1, ModalSubmitInteraction as ModalSubmitInteraction$1, SlashCommandBuilder, ContextMenuCommandBuilder, Collection, MessagePayload, InteractionEditReplyOptions, InteractionReplyOptions, SlashCommandSubcommandBuilder, ChatInputCommandInteraction as ChatInputCommandInteraction$1, ClientOptions, ClientEvents, Client, StringSelectMenuInteraction as StringSelectMenuInteraction$1, ContextMenuCommandInteraction as ContextMenuCommandInteraction$1 } from 'discord.js';
|
|
4
4
|
import './core/builders/util.builders.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -88,6 +88,12 @@ declare const deconstructCustomId: (customId: string) => {
|
|
|
88
88
|
data: string;
|
|
89
89
|
tags: "awaited"[];
|
|
90
90
|
};
|
|
91
|
+
type CustomIdConstructOptions = {
|
|
92
|
+
type: ComponentType;
|
|
93
|
+
data: string;
|
|
94
|
+
tags?: ComponentCustomIdTag[];
|
|
95
|
+
};
|
|
96
|
+
declare const constructCustomId: (options: CustomIdConstructOptions) => string;
|
|
91
97
|
|
|
92
98
|
/**
|
|
93
99
|
* Base class for a Command.
|
|
@@ -763,11 +769,7 @@ declare class ComponentBuilder {
|
|
|
763
769
|
* }} options
|
|
764
770
|
* @returns {this}
|
|
765
771
|
*/
|
|
766
|
-
setCustomId(options:
|
|
767
|
-
type: ComponentType$1;
|
|
768
|
-
data: string;
|
|
769
|
-
tags?: ComponentCustomIdTag[];
|
|
770
|
-
}): this;
|
|
772
|
+
setCustomId(options: CustomIdConstructOptions): this;
|
|
771
773
|
/**
|
|
772
774
|
* Set the permission required to use the component.
|
|
773
775
|
*
|
|
@@ -949,4 +951,4 @@ type StringSelectMenuInteraction = StringSelectMenuInteraction$1<CacheType>;
|
|
|
949
951
|
type ModalSubmitInteraction = ModalSubmitInteraction$1<CacheType>;
|
|
950
952
|
type ContextMenuCommandInteraction = ContextMenuCommandInteraction$1<CacheType>;
|
|
951
953
|
|
|
952
|
-
export { type AnyCommand as A, type
|
|
954
|
+
export { type AnyCommand as A, type ChatInputCommandInteraction as B, CommandRegistry as C, type ButtonInteraction as D, EventRegistry as E, type StringSelectMenuInteraction as F, type ModalSubmitInteraction as G, type ContextMenuCommandInteraction as H, ModuleRegistry as M, PermissionLevel as P, SlashCommand as S, TriviousClient as T, ComponentRegistry as a, type TriviousClientOptions as b, type ComponentCustomIdTag as c, type ComponentInteraction as d, ComponentType as e, type ComponentMetadata as f, getPermissionLevel as g, deconstructCustomId as h, type CustomIdConstructOptions as i, constructCustomId as j, Command as k, CommandBuilder as l, ContextMenuCommand as m, ContextMenuBuilder as n, Subcommand as o, SubcommandBuilder as p, type CommandInteraction as q, type CommandMetadata as r, type SubcommandMetadata as s, type ContextMenuMetadata as t, type AnyCommandBuilder as u, type AnyCommandMetadata as v, type Event as w, type Module as x, Component as y, ComponentBuilder as z };
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export { A as AnyCommand,
|
|
2
|
+
export { A as AnyCommand, u as AnyCommandBuilder, v as AnyCommandMetadata, D as ButtonInteraction, B as ChatInputCommandInteraction, k as Command, l as CommandBuilder, q as CommandInteraction, r as CommandMetadata, C as CommandRegistry, y as Component, z as ComponentBuilder, c as ComponentCustomIdTag, d as ComponentInteraction, f as ComponentMetadata, a as ComponentRegistry, e as ComponentType, n as ContextMenuBuilder, m as ContextMenuCommand, H as ContextMenuCommandInteraction, t as ContextMenuMetadata, i as CustomIdConstructOptions, w as Event, G as ModalSubmitInteraction, x as Module, P as PermissionLevel, S as SlashCommand, F as StringSelectMenuInteraction, o as Subcommand, p as SubcommandBuilder, s as SubcommandMetadata, T as TriviousClient, b as TriviousClientOptions, j as constructCustomId, h as deconstructCustomId, g as getPermissionLevel } from './index-Do60I3dv.cjs';
|
|
3
3
|
export { createActionRow, createEmbed } from './core/builders/util.builders.cjs';
|
|
4
4
|
export { BaseRegistry } from './shared/typings/registry.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export { A as AnyCommand,
|
|
2
|
+
export { A as AnyCommand, u as AnyCommandBuilder, v as AnyCommandMetadata, D as ButtonInteraction, B as ChatInputCommandInteraction, k as Command, l as CommandBuilder, q as CommandInteraction, r as CommandMetadata, C as CommandRegistry, y as Component, z as ComponentBuilder, c as ComponentCustomIdTag, d as ComponentInteraction, f as ComponentMetadata, a as ComponentRegistry, e as ComponentType, n as ContextMenuBuilder, m as ContextMenuCommand, H as ContextMenuCommandInteraction, t as ContextMenuMetadata, i as CustomIdConstructOptions, w as Event, G as ModalSubmitInteraction, x as Module, P as PermissionLevel, S as SlashCommand, F as StringSelectMenuInteraction, o as Subcommand, p as SubcommandBuilder, s as SubcommandMetadata, T as TriviousClient, b as TriviousClientOptions, j as constructCustomId, h as deconstructCustomId, g as getPermissionLevel } from './index-JgBW-tT-.js';
|
|
3
3
|
export { createActionRow, createEmbed } from './core/builders/util.builders.js';
|
|
4
4
|
export { BaseRegistry } from './shared/typings/registry.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AnyCommand,
|
|
1
|
+
export { A as AnyCommand, u as AnyCommandBuilder, v as AnyCommandMetadata, q as CommandInteraction, r as CommandMetadata, t as ContextMenuMetadata, s as SubcommandMetadata } from '../../index-Do60I3dv.cjs';
|
|
2
2
|
import 'discord.js';
|
|
3
3
|
import './registry.cjs';
|
|
4
4
|
import '../../core/builders/util.builders.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AnyCommand,
|
|
1
|
+
export { A as AnyCommand, u as AnyCommandBuilder, v as AnyCommandMetadata, q as CommandInteraction, r as CommandMetadata, t as ContextMenuMetadata, s as SubcommandMetadata } from '../../index-JgBW-tT-.js';
|
|
2
2
|
import 'discord.js';
|
|
3
3
|
import './registry.js';
|
|
4
4
|
import '../../core/builders/util.builders.js';
|
|
@@ -15,8 +15,13 @@ const deconstructCustomId = (customId) => {
|
|
|
15
15
|
tags
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
+
const constructCustomId = (options) => {
|
|
19
|
+
const { data, type, tags } = options;
|
|
20
|
+
return `${type}:${data}${tags ? `.${tags.join(".")}` : ""}`;
|
|
21
|
+
};
|
|
18
22
|
|
|
19
23
|
exports.ComponentType = ComponentType;
|
|
24
|
+
exports.constructCustomId = constructCustomId;
|
|
20
25
|
exports.deconstructCustomId = deconstructCustomId;
|
|
21
26
|
//# sourceMappingURL=components.cjs.map
|
|
22
27
|
//# sourceMappingURL=components.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/typings/components.ts"],"names":["ComponentType"],"mappings":";;AA+BO,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;AAwCL,MAAM,mBAAA,GAAsB,CAAC,QAAA,KAAqB;AACxD,EAAA,MAAM,CAAC,aAAA,EAAe,QAAQ,CAAA,GAAI,QAAA,CAAS,MAAM,GAAG,CAAA;AACpD,EAAA,MAAM,CAAC,IAAA,EAAM,GAAG,IAAI,CAAA,GAAI,QAAA,CAAS,MAAM,GAAG,CAAA;AAE1C,EAAA,OAAO;AAAA,IACN,aAAA;AAAA,IACA,IAAA;AAAA,IACA;AAAA,GACD;AACD","file":"components.cjs","sourcesContent":["import {\n\tAnySelectMenuInteraction,\n\tButtonInteraction,\n\tCacheType,\n\tModalSubmitInteraction,\n} from \"discord.js\";\nimport { PermissionLevel } from \"./permissions.js\";\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 * Metadata for Components.\n *\n * @export\n * @interface ComponentMetadata\n * @typedef {ComponentMetadata}\n */\nexport interface ComponentMetadata {\n\t/**\n\t * The customId of the component.\n\t *\n\t * @type {string}\n\t */\n\tcustomId: string;\n\t/**\n\t * The permission level required to use the component.\n\t *\n\t * @type {PermissionLevel}\n\t */\n\tpermission: PermissionLevel;\n\t/**\n\t * Whether the interaction reply is ephemeral.\n\t *\n\t * @type {boolean}\n\t */\n\tephemeralReply: boolean;\n}\n\n/**\n * Deconstruct a component customId into its parts.\n *\n * @param {string} customId\n * @returns {{ componentType: ComponentType; data: string; tags: {}; }}\n */\nexport const deconstructCustomId = (customId: string) => {\n\tconst [componentType, dataTags] = customId.split(\":\") as [ComponentType, string];\n\tconst [data, ...tags] = dataTags.split(\".\") as [string, ...ComponentCustomIdTag[]];\n\n\treturn {\n\t\tcomponentType,\n\t\tdata,\n\t\ttags,\n\t};\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/typings/components.ts"],"names":["ComponentType"],"mappings":";;AA+BO,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;AAwCL,MAAM,mBAAA,GAAsB,CAAC,QAAA,KAAqB;AACxD,EAAA,MAAM,CAAC,aAAA,EAAe,QAAQ,CAAA,GAAI,QAAA,CAAS,MAAM,GAAG,CAAA;AACpD,EAAA,MAAM,CAAC,IAAA,EAAM,GAAG,IAAI,CAAA,GAAI,QAAA,CAAS,MAAM,GAAG,CAAA;AAE1C,EAAA,OAAO;AAAA,IACN,aAAA;AAAA,IACA,IAAA;AAAA,IACA;AAAA,GACD;AACD;AAQO,MAAM,iBAAA,GAAoB,CAAC,OAAA,KAAsC;AACvE,EAAA,MAAM,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,EAAK,GAAI,OAAA;AAC7B,EAAA,OAAO,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,IAAI,CAAA,EAAG,IAAA,GAAO,CAAA,CAAA,EAAI,IAAA,CAAK,IAAA,CAAK,GAAG,CAAC,CAAA,CAAA,GAAK,EAAE,CAAA,CAAA;AAC1D","file":"components.cjs","sourcesContent":["import {\n\tAnySelectMenuInteraction,\n\tButtonInteraction,\n\tCacheType,\n\tModalSubmitInteraction,\n} from \"discord.js\";\nimport { PermissionLevel } from \"./permissions.js\";\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 * Metadata for Components.\n *\n * @export\n * @interface ComponentMetadata\n * @typedef {ComponentMetadata}\n */\nexport interface ComponentMetadata {\n\t/**\n\t * The customId of the component.\n\t *\n\t * @type {string}\n\t */\n\tcustomId: string;\n\t/**\n\t * The permission level required to use the component.\n\t *\n\t * @type {PermissionLevel}\n\t */\n\tpermission: PermissionLevel;\n\t/**\n\t * Whether the interaction reply is ephemeral.\n\t *\n\t * @type {boolean}\n\t */\n\tephemeralReply: boolean;\n}\n\n/**\n * Deconstruct a component customId into its parts.\n *\n * @param {string} customId\n * @returns {{ componentType: ComponentType; data: string; tags: {}; }}\n */\nexport const deconstructCustomId = (customId: string) => {\n\tconst [componentType, dataTags] = customId.split(\":\") as [ComponentType, string];\n\tconst [data, ...tags] = dataTags.split(\".\") as [string, ...ComponentCustomIdTag[]];\n\n\treturn {\n\t\tcomponentType,\n\t\tdata,\n\t\ttags,\n\t};\n};\n\nexport type CustomIdConstructOptions = {\n\ttype: ComponentType,\n\tdata: string,\n\ttags?: ComponentCustomIdTag[]\n}\n\nexport const constructCustomId = (options: CustomIdConstructOptions) => {\n\tconst { data, type, tags } = options;\n\treturn `${type}:${data}${tags ? `.${tags.join(\".\")}` : \"\"}`;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export { c as ComponentCustomIdTag, d as ComponentInteraction, f as ComponentMetadata, e as ComponentType, h as deconstructCustomId } from '../../index-
|
|
2
|
+
export { c as ComponentCustomIdTag, d as ComponentInteraction, f as ComponentMetadata, e as ComponentType, i as CustomIdConstructOptions, j as constructCustomId, h as deconstructCustomId } from '../../index-Do60I3dv.cjs';
|
|
3
3
|
import './registry.cjs';
|
|
4
4
|
import '../../core/builders/util.builders.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export { c as ComponentCustomIdTag, d as ComponentInteraction, f as ComponentMetadata, e as ComponentType, h as deconstructCustomId } from '../../index-
|
|
2
|
+
export { c as ComponentCustomIdTag, d as ComponentInteraction, f as ComponentMetadata, e as ComponentType, i as CustomIdConstructOptions, j as constructCustomId, h as deconstructCustomId } from '../../index-JgBW-tT-.js';
|
|
3
3
|
import './registry.js';
|
|
4
4
|
import '../../core/builders/util.builders.js';
|
|
@@ -13,7 +13,11 @@ const deconstructCustomId = (customId) => {
|
|
|
13
13
|
tags
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
|
+
const constructCustomId = (options) => {
|
|
17
|
+
const { data, type, tags } = options;
|
|
18
|
+
return `${type}:${data}${tags ? `.${tags.join(".")}` : ""}`;
|
|
19
|
+
};
|
|
16
20
|
|
|
17
|
-
export { ComponentType, deconstructCustomId };
|
|
21
|
+
export { ComponentType, constructCustomId, deconstructCustomId };
|
|
18
22
|
//# sourceMappingURL=components.js.map
|
|
19
23
|
//# sourceMappingURL=components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/typings/components.ts"],"names":["ComponentType"],"mappings":"AA+BO,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;AAwCL,MAAM,mBAAA,GAAsB,CAAC,QAAA,KAAqB;AACxD,EAAA,MAAM,CAAC,aAAA,EAAe,QAAQ,CAAA,GAAI,QAAA,CAAS,MAAM,GAAG,CAAA;AACpD,EAAA,MAAM,CAAC,IAAA,EAAM,GAAG,IAAI,CAAA,GAAI,QAAA,CAAS,MAAM,GAAG,CAAA;AAE1C,EAAA,OAAO;AAAA,IACN,aAAA;AAAA,IACA,IAAA;AAAA,IACA;AAAA,GACD;AACD","file":"components.js","sourcesContent":["import {\n\tAnySelectMenuInteraction,\n\tButtonInteraction,\n\tCacheType,\n\tModalSubmitInteraction,\n} from \"discord.js\";\nimport { PermissionLevel } from \"./permissions.js\";\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 * Metadata for Components.\n *\n * @export\n * @interface ComponentMetadata\n * @typedef {ComponentMetadata}\n */\nexport interface ComponentMetadata {\n\t/**\n\t * The customId of the component.\n\t *\n\t * @type {string}\n\t */\n\tcustomId: string;\n\t/**\n\t * The permission level required to use the component.\n\t *\n\t * @type {PermissionLevel}\n\t */\n\tpermission: PermissionLevel;\n\t/**\n\t * Whether the interaction reply is ephemeral.\n\t *\n\t * @type {boolean}\n\t */\n\tephemeralReply: boolean;\n}\n\n/**\n * Deconstruct a component customId into its parts.\n *\n * @param {string} customId\n * @returns {{ componentType: ComponentType; data: string; tags: {}; }}\n */\nexport const deconstructCustomId = (customId: string) => {\n\tconst [componentType, dataTags] = customId.split(\":\") as [ComponentType, string];\n\tconst [data, ...tags] = dataTags.split(\".\") as [string, ...ComponentCustomIdTag[]];\n\n\treturn {\n\t\tcomponentType,\n\t\tdata,\n\t\ttags,\n\t};\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/typings/components.ts"],"names":["ComponentType"],"mappings":"AA+BO,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;AAwCL,MAAM,mBAAA,GAAsB,CAAC,QAAA,KAAqB;AACxD,EAAA,MAAM,CAAC,aAAA,EAAe,QAAQ,CAAA,GAAI,QAAA,CAAS,MAAM,GAAG,CAAA;AACpD,EAAA,MAAM,CAAC,IAAA,EAAM,GAAG,IAAI,CAAA,GAAI,QAAA,CAAS,MAAM,GAAG,CAAA;AAE1C,EAAA,OAAO;AAAA,IACN,aAAA;AAAA,IACA,IAAA;AAAA,IACA;AAAA,GACD;AACD;AAQO,MAAM,iBAAA,GAAoB,CAAC,OAAA,KAAsC;AACvE,EAAA,MAAM,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,EAAK,GAAI,OAAA;AAC7B,EAAA,OAAO,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,IAAI,CAAA,EAAG,IAAA,GAAO,CAAA,CAAA,EAAI,IAAA,CAAK,IAAA,CAAK,GAAG,CAAC,CAAA,CAAA,GAAK,EAAE,CAAA,CAAA;AAC1D","file":"components.js","sourcesContent":["import {\n\tAnySelectMenuInteraction,\n\tButtonInteraction,\n\tCacheType,\n\tModalSubmitInteraction,\n} from \"discord.js\";\nimport { PermissionLevel } from \"./permissions.js\";\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 * Metadata for Components.\n *\n * @export\n * @interface ComponentMetadata\n * @typedef {ComponentMetadata}\n */\nexport interface ComponentMetadata {\n\t/**\n\t * The customId of the component.\n\t *\n\t * @type {string}\n\t */\n\tcustomId: string;\n\t/**\n\t * The permission level required to use the component.\n\t *\n\t * @type {PermissionLevel}\n\t */\n\tpermission: PermissionLevel;\n\t/**\n\t * Whether the interaction reply is ephemeral.\n\t *\n\t * @type {boolean}\n\t */\n\tephemeralReply: boolean;\n}\n\n/**\n * Deconstruct a component customId into its parts.\n *\n * @param {string} customId\n * @returns {{ componentType: ComponentType; data: string; tags: {}; }}\n */\nexport const deconstructCustomId = (customId: string) => {\n\tconst [componentType, dataTags] = customId.split(\":\") as [ComponentType, string];\n\tconst [data, ...tags] = dataTags.split(\".\") as [string, ...ComponentCustomIdTag[]];\n\n\treturn {\n\t\tcomponentType,\n\t\tdata,\n\t\ttags,\n\t};\n};\n\nexport type CustomIdConstructOptions = {\n\ttype: ComponentType,\n\tdata: string,\n\ttags?: ComponentCustomIdTag[]\n}\n\nexport const constructCustomId = (options: CustomIdConstructOptions) => {\n\tconst { data, type, tags } = options;\n\treturn `${type}:${data}${tags ? `.${tags.join(\".\")}` : \"\"}`;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AnyCommand,
|
|
1
|
+
export { A as AnyCommand, u as AnyCommandBuilder, v as AnyCommandMetadata, q as CommandInteraction, r as CommandMetadata, c as ComponentCustomIdTag, d as ComponentInteraction, f as ComponentMetadata, e as ComponentType, t as ContextMenuMetadata, i as CustomIdConstructOptions, w as Event, x as Module, P as PermissionLevel, s as SubcommandMetadata, b as TriviousClientOptions, j as constructCustomId, h as deconstructCustomId, g as getPermissionLevel } from '../../index-Do60I3dv.cjs';
|
|
2
2
|
export { BaseRegistry } from './registry.cjs';
|
|
3
3
|
import 'discord.js';
|
|
4
4
|
import '../../core/builders/util.builders.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AnyCommand,
|
|
1
|
+
export { A as AnyCommand, u as AnyCommandBuilder, v as AnyCommandMetadata, q as CommandInteraction, r as CommandMetadata, c as ComponentCustomIdTag, d as ComponentInteraction, f as ComponentMetadata, e as ComponentType, t as ContextMenuMetadata, i as CustomIdConstructOptions, w as Event, x as Module, P as PermissionLevel, s as SubcommandMetadata, b as TriviousClientOptions, j as constructCustomId, h as deconstructCustomId, g as getPermissionLevel } from '../../index-JgBW-tT-.js';
|
|
2
2
|
export { BaseRegistry } from './registry.js';
|
|
3
3
|
import 'discord.js';
|
|
4
4
|
import '../../core/builders/util.builders.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export { P as PermissionLevel, g as getPermissionLevel } from '../../index-
|
|
2
|
+
export { P as PermissionLevel, g as getPermissionLevel } from '../../index-Do60I3dv.cjs';
|
|
3
3
|
import './registry.cjs';
|
|
4
4
|
import '../../core/builders/util.builders.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export { P as PermissionLevel, g as getPermissionLevel } from '../../index-
|
|
2
|
+
export { P as PermissionLevel, g as getPermissionLevel } from '../../index-JgBW-tT-.js';
|
|
3
3
|
import './registry.js';
|
|
4
4
|
import '../../core/builders/util.builders.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TriviousClient, P as PermissionLevel } from '../../index-
|
|
1
|
+
import { T as TriviousClient, P as PermissionLevel } from '../../index-Do60I3dv.cjs';
|
|
2
2
|
import { User, GuildMember, RESTPostAPIApplicationCommandsJSONBody } from 'discord.js';
|
|
3
3
|
import '../typings/registry.cjs';
|
|
4
4
|
import '../../core/builders/util.builders.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TriviousClient, P as PermissionLevel } from '../../index-
|
|
1
|
+
import { T as TriviousClient, P as PermissionLevel } from '../../index-JgBW-tT-.js';
|
|
2
2
|
import { User, GuildMember, RESTPostAPIApplicationCommandsJSONBody } from 'discord.js';
|
|
3
3
|
import '../typings/registry.js';
|
|
4
4
|
import '../../core/builders/util.builders.js';
|