gralonium 0.2.0

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.
Files changed (50) hide show
  1. package/README.md +62 -0
  2. package/lib/classes/Client.d.ts +44 -0
  3. package/lib/classes/Client.js +162 -0
  4. package/lib/classes/Context.d.ts +25 -0
  5. package/lib/classes/Context.js +139 -0
  6. package/lib/classes/Cooldowns.d.ts +25 -0
  7. package/lib/classes/Cooldowns.js +72 -0
  8. package/lib/classes/Errors.d.ts +135 -0
  9. package/lib/classes/Errors.js +1 -0
  10. package/lib/classes/HelpCommand.d.ts +15 -0
  11. package/lib/classes/HelpCommand.js +1 -0
  12. package/lib/classes/Loader.d.ts +85 -0
  13. package/lib/classes/Loader.js +359 -0
  14. package/lib/classes/Plugins.d.ts +52 -0
  15. package/lib/classes/Plugins.js +107 -0
  16. package/lib/classes/Utils.d.ts +25 -0
  17. package/lib/classes/Utils.js +705 -0
  18. package/lib/classes/builders/CommandBuilder.d.ts +50 -0
  19. package/lib/classes/builders/CommandBuilder.js +107 -0
  20. package/lib/classes/builders/ComponentsV2Builder.d.ts +125 -0
  21. package/lib/classes/builders/ComponentsV2Builder.js +287 -0
  22. package/lib/classes/builders/EventBuilder.d.ts +19 -0
  23. package/lib/classes/builders/EventBuilder.js +1 -0
  24. package/lib/classes/builders/GroupBuilder.d.ts +46 -0
  25. package/lib/classes/builders/GroupBuilder.js +90 -0
  26. package/lib/classes/builders/InteractionBuilder.d.ts +32 -0
  27. package/lib/classes/builders/InteractionBuilder.js +1 -0
  28. package/lib/classes/builders/ParamsBuilder.d.ts +87 -0
  29. package/lib/classes/builders/ParamsBuilder.js +1 -0
  30. package/lib/classes/builders/components/StyleMapper.d.ts +10 -0
  31. package/lib/classes/builders/components/StyleMapper.js +32 -0
  32. package/lib/classes/builders/components/helpers.d.ts +22 -0
  33. package/lib/classes/builders/components/helpers.js +51 -0
  34. package/lib/classes/builders/components/templates.d.ts +13 -0
  35. package/lib/classes/builders/components/templates.js +41 -0
  36. package/lib/classes/experiments/Confirmator.d.ts +58 -0
  37. package/lib/classes/experiments/Confirmator.js +114 -0
  38. package/lib/classes/experiments/Paginator.d.ts +65 -0
  39. package/lib/classes/experiments/Paginator.js +124 -0
  40. package/lib/events/interactionCreate.d.ts +4 -0
  41. package/lib/events/interactionCreate.js +17 -0
  42. package/lib/events/messageCreate.d.ts +4 -0
  43. package/lib/events/messageCreate.js +17 -0
  44. package/lib/events/messageUpdate.d.ts +4 -0
  45. package/lib/events/messageUpdate.js +17 -0
  46. package/lib/experiments.d.ts +2 -0
  47. package/lib/experiments.js +1 -0
  48. package/lib/main.d.ts +18 -0
  49. package/lib/main.js +25 -0
  50. package/package.json +69 -0
@@ -0,0 +1,50 @@
1
+ export declare function validateDefaultMemberPermissions(permissions: unknown): string | null | undefined;
2
+
3
+ export interface CommandDataBuilder {
4
+ name: string;
5
+ aliases?: string[];
6
+ description?: string;
7
+ as_prefix?: boolean;
8
+ as_slash?: boolean;
9
+ fallback?: true;
10
+ guildOnly?: boolean;
11
+ multiple_args?: boolean;
12
+ defaultMemberPermissions?: string | bigint;
13
+ userPermissions?: string[];
14
+ botPermissions?: string[];
15
+ guards?: Array<(ctx: any) => boolean | Promise<boolean>>;
16
+ cooldown?: { seconds: number; bucket?: string };
17
+ }
18
+
19
+ export declare class CommandBuilder {
20
+ name: string;
21
+ aliases: string[];
22
+ description: string;
23
+ as_prefix: boolean;
24
+ as_slash: boolean;
25
+ fallback: boolean;
26
+ guildOnly: boolean | undefined;
27
+ multiple_args?: boolean;
28
+ defaultMemberPermissions?: string | bigint | undefined;
29
+ userPermissions: string[];
30
+ botPermissions: string[];
31
+ guards: Array<(ctx: any) => boolean | Promise<boolean>>;
32
+ cooldown?: { seconds: number; bucket?: string };
33
+ constructor(options?: CommandDataBuilder);
34
+ setName(name: string): CommandBuilder;
35
+ setDescription(description: string): CommandBuilder;
36
+ setAliases(...aliases: string[]): CommandBuilder;
37
+ allowPrefix(allow: boolean): CommandBuilder;
38
+ allowSlash(allow: boolean): CommandBuilder;
39
+ allowMultipleArgs(allow: boolean): CommandBuilder;
40
+ setGuards(...guards: Array<(ctx: any) => boolean | Promise<boolean>>): CommandBuilder;
41
+ setUserPermissions(...permissions: string[]): CommandBuilder;
42
+ setBotPermissions(...permissions: string[]): CommandBuilder;
43
+ setCooldown(seconds: number, bucket?: string): CommandBuilder;
44
+ toJSON(): {
45
+ name: string;
46
+ description: string;
47
+ default_member_permissions: string | null | undefined;
48
+ dm_permission: boolean | undefined;
49
+ };
50
+ }
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommandBuilder = exports.validateDefaultMemberPermissions = void 0;
4
+
5
+ const shapeshift_1 = require("@sapphire/shapeshift");
6
+
7
+ const memberPermissionPredicate = shapeshift_1.s
8
+ .union(shapeshift_1.s.bigint.transform((value) => value.toString()), shapeshift_1.s.number.safeInt.transform((value) => value.toString()), shapeshift_1.s.string.regex(/^\d+$/))
9
+ .nullish;
10
+ const permissionStringPredicate = shapeshift_1.s.string.lengthGreaterThan(0);
11
+ const permissionArrayPredicate = shapeshift_1.s.array(permissionStringPredicate);
12
+
13
+ function validateDefaultMemberPermissions(permissions) {
14
+ return memberPermissionPredicate.parse(permissions);
15
+ }
16
+ exports.validateDefaultMemberPermissions = validateDefaultMemberPermissions;
17
+
18
+ class CommandBuilder {
19
+ name;
20
+ aliases;
21
+ description;
22
+ as_prefix;
23
+ as_slash;
24
+ fallback;
25
+ guildOnly;
26
+ multiple_args;
27
+ defaultMemberPermissions;
28
+ userPermissions;
29
+ botPermissions;
30
+ guards;
31
+ cooldown;
32
+
33
+ constructor(options) {
34
+ this.name = options?.name ?? "";
35
+ this.aliases = options?.aliases ?? [];
36
+ this.description = options?.description ?? "...";
37
+ this.fallback = options?.fallback ?? false;
38
+ this.as_prefix = options?.as_prefix ?? true;
39
+ this.as_slash = options?.as_slash ?? true;
40
+ this.guildOnly = options?.guildOnly;
41
+ this.defaultMemberPermissions = options?.defaultMemberPermissions;
42
+ this.userPermissions = permissionArrayPredicate.parse(options?.userPermissions ?? []);
43
+ this.botPermissions = permissionArrayPredicate.parse(options?.botPermissions ?? []);
44
+ this.guards = options?.guards ?? [];
45
+ this.cooldown = options?.cooldown;
46
+ }
47
+
48
+ setName(name) {
49
+ this.name = name;
50
+ return this;
51
+ }
52
+
53
+ setDescription(description) {
54
+ this.description = description;
55
+ return this;
56
+ }
57
+
58
+ setAliases(...aliases) {
59
+ this.aliases = aliases;
60
+ return this;
61
+ }
62
+
63
+ allowPrefix(allow) {
64
+ this.as_prefix = allow;
65
+ return this;
66
+ }
67
+
68
+ allowSlash(allow) {
69
+ this.as_slash = allow;
70
+ return this;
71
+ }
72
+
73
+ allowMultipleArgs(allow) {
74
+ this.multiple_args = allow;
75
+ return this;
76
+ }
77
+
78
+ setGuards(...guards) {
79
+ this.guards = guards;
80
+ return this;
81
+ }
82
+
83
+ setUserPermissions(...permissions) {
84
+ this.userPermissions = permissionArrayPredicate.parse(permissions);
85
+ return this;
86
+ }
87
+
88
+ setBotPermissions(...permissions) {
89
+ this.botPermissions = permissionArrayPredicate.parse(permissions);
90
+ return this;
91
+ }
92
+
93
+ setCooldown(seconds, bucket = "USER") {
94
+ this.cooldown = { seconds, bucket };
95
+ return this;
96
+ }
97
+
98
+ toJSON() {
99
+ return {
100
+ name: this.name,
101
+ description: this.description,
102
+ default_member_permissions: this.defaultMemberPermissions ? validateDefaultMemberPermissions(this.defaultMemberPermissions) : undefined,
103
+ dm_permission: typeof this.guildOnly === "boolean" ? !this.guildOnly : undefined,
104
+ };
105
+ }
106
+ }
107
+ exports.CommandBuilder = CommandBuilder;
@@ -0,0 +1,125 @@
1
+ import {
2
+ ButtonBuilder,
3
+ ButtonStyle,
4
+ ContainerBuilder,
5
+ MessageFlags,
6
+ } from "discord.js";
7
+ import { ButtonStyleInput } from "./components/StyleMapper.js";
8
+
9
+ /**
10
+ * Fluent proxy returned by `ComponentsV2Builder#addSelectMenu()`.
11
+ * Call `.end()` to return to the parent builder.
12
+ */
13
+ export declare class SelectMenuProxy {
14
+ /**
15
+ * Add an option to the select menu.
16
+ *
17
+ * @param label - Display label for the option
18
+ * @param value - Value submitted when the option is selected
19
+ * @param emoji - Unicode emoji (optional)
20
+ * @param description - Short description shown below the label (optional)
21
+ */
22
+ addOption(label: string, value?: string, emoji?: string, description?: string): this;
23
+
24
+ /** Return to the parent `ComponentsV2Builder`. */
25
+ end(): ComponentsV2Builder;
26
+ }
27
+
28
+ /**
29
+ * ComponentsV2Builder — a fluent builder that abstracts the complexity of
30
+ * Discord.js Components V2 (Containers, Separators, TextDisplays, Buttons,
31
+ * and StringSelectMenus).
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const components = new ComponentsV2Builder()
36
+ * .addText("## Welcome!")
37
+ * .addSeparator("small")
38
+ * .addButton("Click Me", "btn_1", "primary")
39
+ * .addButton("Cancel", "btn_2", "secondary")
40
+ * .build();
41
+ *
42
+ * interaction.reply({ components, flags: ComponentsV2Builder.flags });
43
+ * ```
44
+ */
45
+ export declare class ComponentsV2Builder {
46
+ /**
47
+ * Add a text display (markdown supported) to the container.
48
+ */
49
+ addText(content: string): this;
50
+
51
+ /**
52
+ * Add a separator to the container.
53
+ *
54
+ * @param spacing - "small" | "large" (defaults to "small")
55
+ * @param divider - Whether to render a visual divider line (defaults to true)
56
+ */
57
+ addSeparator(spacing?: "small" | "large", divider?: boolean): this;
58
+
59
+ /**
60
+ * Add a single button to the container.
61
+ * Buttons are batched and placed into ActionRows automatically (max 5 per row).
62
+ *
63
+ * @param label - Button label text
64
+ * @param customId - Custom ID (or URL for link buttons)
65
+ * @param style - "primary" | "secondary" | "success" | "danger" | "link"
66
+ * @param url - URL (only used when style is "link")
67
+ */
68
+ addButton(label: string, customId?: string, style?: ButtonStyleInput, url?: string): this;
69
+
70
+ /**
71
+ * Add multiple pre-built `ButtonBuilder` instances at once.
72
+ * They are batched into ActionRows automatically (max 5 per row).
73
+ */
74
+ addButtons(...buttons: ButtonBuilder[]): this;
75
+
76
+ /**
77
+ * Add a `StringSelectMenu` to the container.
78
+ * Returns a `SelectMenuProxy` for adding options fluently.
79
+ * Call `.end()` on the proxy to return to this builder.
80
+ *
81
+ * @param customId - Custom ID for the select menu
82
+ * @param placeholder - Placeholder text (optional)
83
+ */
84
+ addSelectMenu(customId?: string, placeholder?: string): SelectMenuProxy;
85
+
86
+ /**
87
+ * Mark the container as a spoiler (blurred until clicked).
88
+ */
89
+ setSpoiler(spoiler: boolean): this;
90
+
91
+ /**
92
+ * Build and return the components array ready for
93
+ * `interaction.reply({ components: builder.build(), flags: ComponentsV2Builder.flags })`.
94
+ */
95
+ build(): ContainerBuilder[];
96
+
97
+ /**
98
+ * The `MessageFlags` bitmask required for Components V2 messages.
99
+ *
100
+ * ```ts
101
+ * interaction.reply({ components: builder.build(), flags: ComponentsV2Builder.flags });
102
+ * ```
103
+ */
104
+ static readonly flags: MessageFlags;
105
+
106
+ /**
107
+ * Create a Confirm / Cancel button container.
108
+ */
109
+ static createConfirm(confirmId?: string, cancelId?: string): ComponentsV2Builder;
110
+
111
+ /**
112
+ * Create a ticket category select menu container.
113
+ */
114
+ static createTicketMenu(customId?: string): ComponentsV2Builder;
115
+
116
+ /**
117
+ * Create a plan selector container (bot / game / web hosting example).
118
+ */
119
+ static createPlanSelector(customId?: string): ComponentsV2Builder;
120
+
121
+ /**
122
+ * Create a role selector menu container.
123
+ */
124
+ static createRoleMenu(customId?: string): ComponentsV2Builder;
125
+ }
@@ -0,0 +1,287 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComponentsV2Builder = void 0;
4
+
5
+ const discord_js_1 = require("discord.js");
6
+ const StyleMapper_js_1 = require("./components/StyleMapper.js");
7
+ const helpers_js_1 = require("./components/helpers.js");
8
+
9
+ /**
10
+ * SelectMenuProxy gives a chainable API to add options to a StringSelectMenu
11
+ * and then return to the parent ComponentsV2Builder via `.end()`.
12
+ */
13
+ class SelectMenuProxy {
14
+ constructor(parent, menu) {
15
+ this._parent = parent;
16
+ this._menu = menu;
17
+ this._optionCount = 0;
18
+ }
19
+
20
+ /**
21
+ * Add an option to the select menu.
22
+ */
23
+ addOption(label, value, emoji, description) {
24
+ this._optionCount += 1;
25
+ helpers_js_1.validateSelectMenuOptions(this._optionCount);
26
+
27
+ const option = new discord_js_1.StringSelectMenuOptionBuilder()
28
+ .setLabel(label)
29
+ .setValue(value ?? helpers_js_1.generateCustomId("opt"));
30
+
31
+ if (emoji) option.setEmoji({ name: emoji });
32
+ if (description) option.setDescription(description);
33
+
34
+ this._menu.addOptions(option);
35
+ return this;
36
+ }
37
+
38
+ /**
39
+ * Return to the parent builder to continue chaining.
40
+ */
41
+ end() {
42
+ return this._parent;
43
+ }
44
+ }
45
+
46
+ /**
47
+ * ComponentsV2Builder — a fluent builder that abstracts the complexity of
48
+ * Discord.js Components V2 (Containers, Separators, TextDisplays, Buttons,
49
+ * and StringSelectMenus).
50
+ *
51
+ * @example
52
+ * ```js
53
+ * const { ComponentsV2Builder } = require("gralonium");
54
+ *
55
+ * const components = new ComponentsV2Builder()
56
+ * .addText("## Welcome!")
57
+ * .addSeparator("small")
58
+ * .addButton("Click Me", "btn_1", "primary")
59
+ * .addButton("Cancel", "btn_2", "secondary")
60
+ * .build();
61
+ *
62
+ * interaction.reply({ components });
63
+ * ```
64
+ */
65
+ class ComponentsV2Builder {
66
+ constructor() {
67
+ this._container = new discord_js_1.ContainerBuilder();
68
+ this._pendingButtons = [];
69
+ this._spoiler = false;
70
+ }
71
+
72
+ // ─── Internal helpers ────────────────────────────────────────────────────
73
+
74
+ /**
75
+ * Flush any pending buttons into an ActionRow inside the container.
76
+ */
77
+ _flushButtons() {
78
+ if (this._pendingButtons.length === 0) return;
79
+ const row = new discord_js_1.ActionRowBuilder().addComponents(...this._pendingButtons);
80
+ this._container.addActionRowComponents(row);
81
+ this._pendingButtons = [];
82
+ }
83
+
84
+ // ─── Public API ──────────────────────────────────────────────────────────
85
+
86
+ /**
87
+ * Add a text display (markdown supported) to the container.
88
+ */
89
+ addText(content) {
90
+ helpers_js_1.validateTextContent(content);
91
+ this._flushButtons();
92
+ this._container.addTextDisplayComponents(
93
+ new discord_js_1.TextDisplayBuilder().setContent(content)
94
+ );
95
+ return this;
96
+ }
97
+
98
+ /**
99
+ * Add a separator to the container.
100
+ *
101
+ * @param spacing - "small" | "large" (defaults to "small")
102
+ * @param divider - Whether to render a visual divider line (defaults to true)
103
+ */
104
+ addSeparator(spacing, divider) {
105
+ this._flushButtons();
106
+ const spacingValue =
107
+ spacing === "large"
108
+ ? discord_js_1.SeparatorSpacingSize.Large
109
+ : discord_js_1.SeparatorSpacingSize.Small;
110
+ const sep = new discord_js_1.SeparatorBuilder()
111
+ .setSpacing(spacingValue)
112
+ .setDivider(divider !== false);
113
+ this._container.addSeparatorComponents(sep);
114
+ return this;
115
+ }
116
+
117
+ /**
118
+ * Add a single button to the container.
119
+ * Buttons are batched and placed into ActionRows automatically (max 5 per row).
120
+ *
121
+ * @param label - Button label text
122
+ * @param customId - Custom ID (or URL for link buttons)
123
+ * @param style - "primary" | "secondary" | "success" | "danger" | "link"
124
+ * @param url - URL (only used when style is "link")
125
+ */
126
+ addButton(label, customId, style, url) {
127
+ const resolvedStyle = StyleMapper_js_1.mapButtonStyle(style);
128
+
129
+ // If we already have 5 buttons pending, flush them first
130
+ if (this._pendingButtons.length >= 5) {
131
+ this._flushButtons();
132
+ }
133
+
134
+ const btn = new discord_js_1.ButtonBuilder()
135
+ .setLabel(label)
136
+ .setStyle(resolvedStyle);
137
+
138
+ if (resolvedStyle === discord_js_1.ButtonStyle.Link) {
139
+ if (!url) throw new Error("[ComponentsV2Builder] A link button requires a URL.");
140
+ if (customId) {
141
+ console.warn("[ComponentsV2Builder] customId is ignored for link buttons; use the 'url' parameter instead.");
142
+ }
143
+ btn.setURL(url);
144
+ } else {
145
+ btn.setCustomId(customId ?? helpers_js_1.generateCustomId("btn"));
146
+ }
147
+
148
+ this._pendingButtons.push(btn);
149
+ return this;
150
+ }
151
+
152
+ /**
153
+ * Add multiple pre-built ButtonBuilder instances at once.
154
+ * They are batched into ActionRows automatically (max 5 per row).
155
+ */
156
+ addButtons(...buttons) {
157
+ for (const btn of buttons) {
158
+ if (this._pendingButtons.length >= 5) {
159
+ this._flushButtons();
160
+ }
161
+ this._pendingButtons.push(btn);
162
+ }
163
+ return this;
164
+ }
165
+
166
+ /**
167
+ * Add a StringSelectMenu to the container and return a SelectMenuProxy
168
+ * for adding options via a fluent sub-chain. Call `.end()` on the proxy
169
+ * to return to this builder.
170
+ *
171
+ * @param customId - Custom ID for the select menu
172
+ * @param placeholder - Placeholder text (optional)
173
+ */
174
+ addSelectMenu(customId, placeholder) {
175
+ this._flushButtons();
176
+ const menu = new discord_js_1.StringSelectMenuBuilder()
177
+ .setCustomId(customId ?? helpers_js_1.generateCustomId("sel"))
178
+ .setPlaceholder(placeholder ?? "Select an option...");
179
+
180
+ // We need to add the row after options are configured; the proxy returns
181
+ // to us via `.end()` which flushes remaining buttons and adds the row.
182
+ // To support immediate chaining, we attach the row now — options get added
183
+ // by the proxy in-place (discord.js builders are mutable).
184
+ const row = new discord_js_1.ActionRowBuilder().addComponents(menu);
185
+ this._container.addActionRowComponents(row);
186
+ return new SelectMenuProxy(this, menu);
187
+ }
188
+
189
+ /**
190
+ * Mark the container as a spoiler (blurred until clicked).
191
+ */
192
+ setSpoiler(spoiler) {
193
+ this._spoiler = spoiler;
194
+ this._container.setSpoiler(spoiler);
195
+ return this;
196
+ }
197
+
198
+ /**
199
+ * Build and return the components array ready to pass to
200
+ * `interaction.reply({ components })`.
201
+ *
202
+ * The `MessageFlags.IsComponentsV2` flag is **not** added here because it
203
+ * must be set on the reply options object itself, not inside the components
204
+ * array. Use the helper `ComponentsV2Builder.flags` constant when replying:
205
+ *
206
+ * ```js
207
+ * interaction.reply({ components: builder.build(), flags: ComponentsV2Builder.flags });
208
+ * ```
209
+ */
210
+ build() {
211
+ this._flushButtons();
212
+ return [this._container];
213
+ }
214
+
215
+ // ─── Static helpers ──────────────────────────────────────────────────────
216
+
217
+ /**
218
+ * The MessageFlags bitmask required for Components V2 messages.
219
+ *
220
+ * ```js
221
+ * interaction.reply({ components: builder.build(), flags: ComponentsV2Builder.flags });
222
+ * ```
223
+ */
224
+ static get flags() {
225
+ return discord_js_1.MessageFlags.IsComponentsV2;
226
+ }
227
+
228
+ // ─── Quick Templates ─────────────────────────────────────────────────────
229
+
230
+ /**
231
+ * Create a Confirm / Cancel button container.
232
+ *
233
+ * @param confirmId - Custom ID for the confirm button (default: "cv2_confirm")
234
+ * @param cancelId - Custom ID for the cancel button (default: "cv2_cancel")
235
+ */
236
+ static createConfirm(confirmId, cancelId) {
237
+ return new ComponentsV2Builder()
238
+ .addText("**Are you sure?**")
239
+ .addSeparator("small")
240
+ .addButton("Confirm", confirmId ?? "cv2_confirm", "success")
241
+ .addButton("Cancel", cancelId ?? "cv2_cancel", "danger");
242
+ }
243
+
244
+ /**
245
+ * Create a ticket category select menu container.
246
+ *
247
+ * @param customId - Custom ID for the select menu (default: "cv2_ticket_menu")
248
+ */
249
+ static createTicketMenu(customId) {
250
+ return new ComponentsV2Builder()
251
+ .addText("## 🎫 Open a Ticket")
252
+ .addSeparator("small")
253
+ .addSelectMenu(customId ?? "cv2_ticket_menu", "Select a category...")
254
+ .addOption("General Support", "ticket_general", "❓")
255
+ .addOption("Billing", "ticket_billing", "💳")
256
+ .addOption("Technical Issue", "ticket_tech", "🔧")
257
+ .end();
258
+ }
259
+
260
+ /**
261
+ * Create a plan selector container (bot / game / web hosting example).
262
+ *
263
+ * @param customId - Custom ID for the select menu (default: "cv2_plan_menu")
264
+ */
265
+ static createPlanSelector(customId) {
266
+ return new ComponentsV2Builder()
267
+ .addText("## Welcome!\nPlease select the plan you want to join!")
268
+ .addSeparator("small")
269
+ .addButton("Discord Bot Hosting", "plan_bot", "primary")
270
+ .addButton("Game Hosting", "plan_game", "success")
271
+ .addButton("Web Hosting", "plan_web", "danger");
272
+ }
273
+
274
+ /**
275
+ * Create a role selector menu container.
276
+ *
277
+ * @param customId - Custom ID for the select menu (default: "cv2_role_menu")
278
+ */
279
+ static createRoleMenu(customId) {
280
+ return new ComponentsV2Builder()
281
+ .addText("## 🎭 Select a Role")
282
+ .addSeparator("small")
283
+ .addSelectMenu(customId ?? "cv2_role_menu", "Choose your role...")
284
+ .end();
285
+ }
286
+ }
287
+ exports.ComponentsV2Builder = ComponentsV2Builder;
@@ -0,0 +1,19 @@
1
+ import { ClientEvents } from "discord.js";
2
+ export interface EventDataBuilder {
3
+ name: keyof ClientEvents;
4
+ once: boolean;
5
+ description?: string;
6
+ }
7
+ export declare class EventBuilder {
8
+ name: string;
9
+ once: boolean;
10
+ description: string;
11
+ constructor(options?: EventDataBuilder);
12
+ /**
13
+ * Returns the command data parsed as JSON.
14
+ */
15
+ toJSON(): {
16
+ name: string;
17
+ description: string;
18
+ };
19
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventBuilder=void 0;class EventBuilder{name;once;description;constructor(e){this.name=e?.name??"",this.once=e?.once??!1,this.description=e?.description??"..."}toJSON(){return{name:this.name,description:this.description}}}exports.EventBuilder=EventBuilder;
@@ -0,0 +1,46 @@
1
+ import { Command, Types } from "../Loader.js";
2
+
3
+ type GroupBuilderOptions = {
4
+ name: string;
5
+ aliases?: string[];
6
+ description?: string;
7
+ as_slash?: boolean;
8
+ as_prefix?: boolean;
9
+ guildOnly?: boolean;
10
+ defaultMemberPermissions?: string | bigint;
11
+ userPermissions?: string[];
12
+ botPermissions?: string[];
13
+ guards?: Array<(ctx: any) => boolean | Promise<boolean>>;
14
+ };
15
+
16
+ export declare class GroupBuilder {
17
+ name: string;
18
+ aliases: string[];
19
+ description: string;
20
+ commands: Command<Types.Normal>[];
21
+ as_slash: boolean;
22
+ as_prefix: boolean;
23
+ guildOnly: boolean | undefined;
24
+ defaultMemberPermissions?: string | bigint | undefined;
25
+ userPermissions: string[];
26
+ botPermissions: string[];
27
+ guards: Array<(ctx: any) => boolean | Promise<boolean>>;
28
+ constructor(ops?: GroupBuilderOptions);
29
+ setName(name: string): GroupBuilder;
30
+ setDescription(description: string): GroupBuilder;
31
+ addCommand(command: Command<Types.Normal>): GroupBuilder;
32
+ setGuards(...guards: Array<(ctx: any) => boolean | Promise<boolean>>): GroupBuilder;
33
+ setUserPermissions(...permissions: string[]): GroupBuilder;
34
+ setBotPermissions(...permissions: string[]): GroupBuilder;
35
+ allowPrefix(allow: boolean): GroupBuilder;
36
+ allowSlash(allow: boolean): GroupBuilder;
37
+ toJSON(): {
38
+ name: string;
39
+ description: string;
40
+ options: any[];
41
+ default_member_permissions: string | null | undefined;
42
+ dm_permission: boolean | undefined;
43
+ };
44
+ }
45
+
46
+ export {};