@seedcord/core 0.1.0-next.6 → 0.1.0-next.8

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 (64) hide show
  1. package/dist/HmrModuleHandler-3sNgKHdf.mjs +163 -0
  2. package/dist/HmrModuleHandler-3sNgKHdf.mjs.map +1 -0
  3. package/dist/HmrModuleHandler-CTBng7wV.cjs +170 -0
  4. package/dist/HmrModuleHandler-CTBng7wV.cjs.map +1 -0
  5. package/dist/Plugin-BZit5HUI.d.mts +555 -0
  6. package/dist/{Plugin-C2-VHrsX.cjs → Plugin-BlkhHNRm.cjs} +15 -34
  7. package/dist/Plugin-BlkhHNRm.cjs.map +1 -0
  8. package/dist/{Plugin-PcdPjAzc.mjs → Plugin-CDAV7P9l.mjs} +16 -29
  9. package/dist/Plugin-CDAV7P9l.mjs.map +1 -0
  10. package/dist/basic-1hebYVcN.d.mts +22 -0
  11. package/dist/contextMenuLeaves-f2rbyo83.d.mts +19 -0
  12. package/dist/{permissions-DSW_EZfN.cjs → cursor-BMkFAwO2.cjs} +308 -300
  13. package/dist/cursor-BMkFAwO2.cjs.map +1 -0
  14. package/dist/{permissions-RVCBhL2n.mjs → cursor-BvSH8tgw.mjs} +249 -247
  15. package/dist/cursor-BvSH8tgw.mjs.map +1 -0
  16. package/dist/{AutocompleteOptions-eKhIe6Qt.d.mts → cursor-D6nBjwaE.d.mts} +207 -116
  17. package/dist/hmr.index.cjs +2 -164
  18. package/dist/hmr.index.mjs +2 -162
  19. package/dist/index-Cr4-VV4u.d.mts +142 -0
  20. package/dist/index.cjs +362 -63
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.mts +239 -38
  23. package/dist/index.mjs +313 -26
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/internal.index.cjs +278 -83
  26. package/dist/internal.index.cjs.map +1 -1
  27. package/dist/internal.index.d.mts +111 -42
  28. package/dist/internal.index.mjs +223 -43
  29. package/dist/internal.index.mjs.map +1 -1
  30. package/dist/node-internal.index.cjs +314 -76
  31. package/dist/node-internal.index.cjs.map +1 -1
  32. package/dist/node-internal.index.d.mts +123 -2164
  33. package/dist/node-internal.index.mjs +313 -77
  34. package/dist/node-internal.index.mjs.map +1 -1
  35. package/dist/{phases-BfpAG6w3.mjs → phases-BauKJOTT.mjs} +2 -2
  36. package/dist/phases-BauKJOTT.mjs.map +1 -0
  37. package/dist/{phases-C_BGNyVo.cjs → phases-DcuDHoQl.cjs} +2 -2
  38. package/dist/phases-DcuDHoQl.cjs.map +1 -0
  39. package/dist/plugin.index.cjs +1 -1
  40. package/dist/plugin.index.d.mts +2 -2
  41. package/dist/plugin.index.mjs +1 -1
  42. package/dist/publishDefault-CVlwYUS5.cjs +382 -0
  43. package/dist/publishDefault-CVlwYUS5.cjs.map +1 -0
  44. package/dist/publishDefault-CldnxcT2.mjs +287 -0
  45. package/dist/publishDefault-CldnxcT2.mjs.map +1 -0
  46. package/dist/slashRouteLeaves-BANDtPFm.mjs +23 -0
  47. package/dist/slashRouteLeaves-BANDtPFm.mjs.map +1 -0
  48. package/dist/slashRouteLeaves-nfxOAM7Q.cjs +28 -0
  49. package/dist/slashRouteLeaves-nfxOAM7Q.cjs.map +1 -0
  50. package/dist/subscribers-BSJoyKNN.cjs +517 -0
  51. package/dist/subscribers-BSJoyKNN.cjs.map +1 -0
  52. package/dist/subscribers-DuxdM2cS.mjs +480 -0
  53. package/dist/subscribers-DuxdM2cS.mjs.map +1 -0
  54. package/package.json +7 -6
  55. package/dist/Plugin-C2-VHrsX.cjs.map +0 -1
  56. package/dist/Plugin-CNyRKDHT.d.mts +0 -226
  57. package/dist/Plugin-PcdPjAzc.mjs.map +0 -1
  58. package/dist/hmr.index.cjs.map +0 -1
  59. package/dist/hmr.index.mjs.map +0 -1
  60. package/dist/is-never-Ddaba1Su.d.mts +0 -58
  61. package/dist/permissions-DSW_EZfN.cjs.map +0 -1
  62. package/dist/permissions-RVCBhL2n.mjs.map +0 -1
  63. package/dist/phases-BfpAG6w3.mjs.map +0 -1
  64. package/dist/phases-C_BGNyVo.cjs.map +0 -1
@@ -0,0 +1,287 @@
1
+ import { ActionRowBuilder, ButtonBuilder, ChannelSelectMenuBuilder, CheckboxBuilder, CheckboxGroupBuilder, CheckboxGroupOptionBuilder, ContainerBuilder, ContextMenuCommandBuilder, EmbedBuilder, FileBuilder, FileUploadBuilder, LabelBuilder, MediaGalleryBuilder, MentionableSelectMenuBuilder, ModalBuilder, RadioGroupBuilder, RadioGroupOptionBuilder, RoleSelectMenuBuilder, SectionBuilder, SeparatorBuilder, SlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, TextDisplayBuilder, TextInputBuilder, UserSelectMenuBuilder } from "@discordjs/builders";
2
+ import { ApplicationCommandType, InteractionContextType, MessageFlags } from "discord-api-types/v10";
3
+ import { SeedcordErrorCode } from "@seedcord/errors";
4
+ import { SeedcordRangeError, SeedcordTypeError } from "@seedcord/errors/internal";
5
+
6
+ //#region src/commands/contextMenuLeaves.ts
7
+ /**
8
+ * Collects the names of every registered context-menu command across a set of command builders, deduplicated
9
+ * because the same builder appears once per guild. A user and a message command can share a name, so the two
10
+ * kinds stay in separate sets.
11
+ *
12
+ * @internal
13
+ */
14
+ function contextMenuLeaves(commands) {
15
+ const user = /* @__PURE__ */ new Set();
16
+ const message = /* @__PURE__ */ new Set();
17
+ for (const command of commands) {
18
+ if (!(command instanceof ContextMenuCommandBuilder)) continue;
19
+ if (command.type === ApplicationCommandType.User) user.add(command.name);
20
+ else message.add(command.name);
21
+ }
22
+ return {
23
+ user,
24
+ message
25
+ };
26
+ }
27
+
28
+ //#endregion
29
+ //#region src/metadataKeys.ts
30
+ let InteractionRoutes = /* @__PURE__ */ function(InteractionRoutes) {
31
+ InteractionRoutes["Slash"] = "slash";
32
+ InteractionRoutes["Button"] = "button";
33
+ InteractionRoutes["Modal"] = "modal";
34
+ InteractionRoutes["StringMenu"] = "stringMenu";
35
+ InteractionRoutes["UserMenu"] = "userMenu";
36
+ InteractionRoutes["RoleMenu"] = "roleMenu";
37
+ InteractionRoutes["ChannelMenu"] = "channelMenu";
38
+ InteractionRoutes["MentionableMenu"] = "mentionableMenu";
39
+ InteractionRoutes["MessageContextMenu"] = "messageContextMenu";
40
+ InteractionRoutes["UserContextMenu"] = "userContextMenu";
41
+ InteractionRoutes["Autocomplete"] = "autocomplete";
42
+ return InteractionRoutes;
43
+ }({});
44
+ const InteractionMetadataKey = Symbol("seedcord:interaction:metadata");
45
+ const InteractionRouteKeys = {
46
+ ["slash"]: Symbol("seedcord:interaction:slash"),
47
+ ["button"]: Symbol("seedcord:interaction:button"),
48
+ ["modal"]: Symbol("seedcord:interaction:modal"),
49
+ ["stringMenu"]: Symbol("seedcord:interaction:stringMenu"),
50
+ ["userMenu"]: Symbol("seedcord:interaction:userMenu"),
51
+ ["roleMenu"]: Symbol("seedcord:interaction:roleMenu"),
52
+ ["channelMenu"]: Symbol("seedcord:interaction:channelMenu"),
53
+ ["mentionableMenu"]: Symbol("seedcord:interaction:mentionableMenu"),
54
+ ["messageContextMenu"]: Symbol("seedcord:interaction:messageContextMenu"),
55
+ ["userContextMenu"]: Symbol("seedcord:interaction:userContextMenu"),
56
+ ["autocomplete"]: Symbol("seedcord:interaction:autocomplete")
57
+ };
58
+ const MiddlewareMetadataKey = Symbol("seedcord:middleware:metadata");
59
+ const EventMetadataKey = Symbol("seedcord:event:metadata");
60
+ const CommandMetadataKey = Symbol("seedcord:command:metadata");
61
+ const GatedMetadataKey = Symbol("seedcord:gated:metadata");
62
+ const SubscribeMetadataKey = Symbol("seedcord:subscribe:metadata");
63
+ const WebhookUrlMetadataKey = Symbol("seedcord:webhookUrl:metadata");
64
+
65
+ //#endregion
66
+ //#region src/components/botColorHolder.ts
67
+ const DEFAULT_COLOR = "Default";
68
+ let current = DEFAULT_COLOR;
69
+ function setBotColor(color) {
70
+ current = color ?? DEFAULT_COLOR;
71
+ }
72
+ function getBotColor() {
73
+ return current;
74
+ }
75
+
76
+ //#endregion
77
+ //#region src/components/builderTypes.ts
78
+ /**
79
+ * Available Discord.js builder classes for use with BuilderComponent for commands, embeds, modals, etc.
80
+ *
81
+ * @internal
82
+ */
83
+ const BuilderTypes = {
84
+ command: SlashCommandBuilder,
85
+ context_menu: ContextMenuCommandBuilder,
86
+ subcommand: SlashCommandSubcommandBuilder,
87
+ group: SlashCommandSubcommandGroupBuilder,
88
+ embed: EmbedBuilder,
89
+ modal: ModalBuilder,
90
+ label: LabelBuilder,
91
+ text_input: TextInputBuilder,
92
+ file_upload: FileUploadBuilder,
93
+ checkbox: CheckboxBuilder,
94
+ checkbox_group: CheckboxGroupBuilder,
95
+ checkbox_group_option: CheckboxGroupOptionBuilder,
96
+ radio_group: RadioGroupBuilder,
97
+ radio_group_option: RadioGroupOptionBuilder,
98
+ button: ButtonBuilder,
99
+ menu_string: StringSelectMenuBuilder,
100
+ menu_option_string: StringSelectMenuOptionBuilder,
101
+ menu_user: UserSelectMenuBuilder,
102
+ menu_channel: ChannelSelectMenuBuilder,
103
+ menu_mentionable: MentionableSelectMenuBuilder,
104
+ menu_role: RoleSelectMenuBuilder,
105
+ container: ContainerBuilder,
106
+ text_display: TextDisplayBuilder,
107
+ file: FileBuilder,
108
+ media: MediaGalleryBuilder,
109
+ section: SectionBuilder,
110
+ separator: SeparatorBuilder
111
+ };
112
+ /**
113
+ * Available Discord.js action row classes for use with RowComponent for Select Menus and Buttons
114
+ *
115
+ * @internal
116
+ */
117
+ const RowTypes = {
118
+ button: ActionRowBuilder,
119
+ menu_string: ActionRowBuilder,
120
+ menu_user: ActionRowBuilder,
121
+ menu_channel: ActionRowBuilder,
122
+ menu_mentionable: ActionRowBuilder,
123
+ menu_role: ActionRowBuilder
124
+ };
125
+
126
+ //#endregion
127
+ //#region src/components/colors.ts
128
+ const Colors = {
129
+ Aqua: 1752220,
130
+ Blue: 3447003,
131
+ Blurple: 5793266,
132
+ DarkAqua: 1146986,
133
+ DarkBlue: 2123412,
134
+ DarkButNotBlack: 2895667,
135
+ DarkerGrey: 8359053,
136
+ DarkGold: 12745742,
137
+ DarkGreen: 2067276,
138
+ DarkGrey: 9936031,
139
+ DarkNavy: 2899536,
140
+ DarkOrange: 11027200,
141
+ DarkPurple: 7419530,
142
+ DarkRed: 10038562,
143
+ DarkVividPink: 11342935,
144
+ Default: 0,
145
+ Fuchsia: 15418782,
146
+ Gold: 15844367,
147
+ Green: 5763719,
148
+ Grey: 9807270,
149
+ Greyple: 10070709,
150
+ LightGrey: 12370112,
151
+ LuminousVividPink: 15277667,
152
+ Navy: 3426654,
153
+ NotQuiteBlack: 2303786,
154
+ Orange: 15105570,
155
+ Purple: 10181046,
156
+ Red: 15548997,
157
+ White: 16777215,
158
+ Yellow: 16705372
159
+ };
160
+
161
+ //#endregion
162
+ //#region src/components/resolveColor.ts
163
+ const MAX_COLOR = 16777215;
164
+ const RED_SHIFT = 16;
165
+ const GREEN_SHIFT = 8;
166
+ const palette = Colors;
167
+ /**
168
+ * Resolves a {@link BotColor} to the integer Discord expects.
169
+ *
170
+ * Ported from discord.js (Apache-2.0), `resolveColor` in src/util/Util.js.
171
+ */
172
+ function resolveColor(color) {
173
+ let resolved;
174
+ if (typeof color === "string") {
175
+ if (color === "Random") return Math.floor(Math.random() * 16777216);
176
+ if (color === "Default") return 0;
177
+ if (/^#?[\da-f]{6}$/i.test(color)) return Number.parseInt(color.replace("#", ""), 16);
178
+ resolved = palette[color];
179
+ } else if (typeof color === "number") resolved = color;
180
+ else resolved = (color[0] << RED_SHIFT) + (color[1] << GREEN_SHIFT) + color[2];
181
+ if (resolved === void 0 || !Number.isSafeInteger(resolved)) throw new SeedcordTypeError(SeedcordErrorCode.ColorUnresolvable, [JSON.stringify(color)]);
182
+ if (resolved < 0 || resolved > MAX_COLOR) throw new SeedcordRangeError(SeedcordErrorCode.ColorOutOfRange);
183
+ return resolved;
184
+ }
185
+
186
+ //#endregion
187
+ //#region src/components/Component.ts
188
+ /**
189
+ * Base class for Discord component wrappers.
190
+ *
191
+ * @typeParam TComponent - The Discord.js component type being wrapped
192
+ *
193
+ * @internal
194
+ */
195
+ var BaseComponent = class {
196
+ _component;
197
+ constructor(ComponentClass) {
198
+ this._component = new ComponentClass();
199
+ }
200
+ /**
201
+ * The wrapped builder, for calling Discord.js methods like setTitle() and setDescription() inside a subclass.
202
+ *
203
+ * @example this.instance.setTitle('My Modal')
204
+ */
205
+ get instance() {
206
+ return this._component;
207
+ }
208
+ };
209
+ /**
210
+ * Base class for Discord.js builder components
211
+ *
212
+ * Wraps Discord.js builders (SlashCommandBuilder, EmbedBuilder, etc.) with
213
+ * Seedcord-specific defaults and helper methods.
214
+ *
215
+ * @typeParam BuilderKey - The type of Discord.js builder being wrapped
216
+ */
217
+ var BuilderComponent = class extends BaseComponent {
218
+ type;
219
+ colorApplied = false;
220
+ constructor(type) {
221
+ const ComponentClass = BuilderTypes[type];
222
+ super(ComponentClass);
223
+ this.type = type;
224
+ if (this.instance instanceof SlashCommandBuilder || this.instance instanceof ContextMenuCommandBuilder) this.instance.setContexts(InteractionContextType.Guild);
225
+ }
226
+ get component() {
227
+ this.applyBotColor();
228
+ return this.instance;
229
+ }
230
+ applyBotColor() {
231
+ if (this.colorApplied) return;
232
+ this.colorApplied = true;
233
+ const color = getBotColor();
234
+ if (this.instance instanceof EmbedBuilder) {
235
+ if (this.instance.data.color === void 0) this.instance.setColor(resolveColor(color));
236
+ } else if (this.instance instanceof ContainerBuilder) {
237
+ const accent = this.instance.data.accent_color;
238
+ if (accent === null || accent === void 0) this.instance.setAccentColor(color === "Default" ? void 0 : resolveColor(color));
239
+ }
240
+ }
241
+ };
242
+ /**
243
+ * Base class for Discord action row components
244
+ *
245
+ * Wraps Discord.js action row builder with Seedcord-specific defaults and helper methods.
246
+ *
247
+ * @typeParam RowKey - The Discord.js action row type being wrapped
248
+ */
249
+ var RowComponent = class extends BaseComponent {
250
+ type;
251
+ constructor(type) {
252
+ const ComponentClass = RowTypes[type];
253
+ super(ComponentClass);
254
+ this.type = type;
255
+ }
256
+ get component() {
257
+ return this.instance;
258
+ }
259
+ };
260
+
261
+ //#endregion
262
+ //#region src/reply/flags.ts
263
+ /** IsComponentsV2 is unconditional, every framework reply is v2. */
264
+ function sendFlags(opts) {
265
+ let flags = MessageFlags.IsComponentsV2;
266
+ if (opts?.ephemeral ?? true) flags |= MessageFlags.Ephemeral;
267
+ if (opts?.silent) flags |= MessageFlags.SuppressNotifications;
268
+ return flags;
269
+ }
270
+ /** A deferral carries no content, so only Ephemeral applies. */
271
+ function deferFlags(opts) {
272
+ return opts?.ephemeral ?? true ? MessageFlags.Ephemeral : 0;
273
+ }
274
+
275
+ //#endregion
276
+ //#region src/subscribers/publishDefault.ts
277
+ /**
278
+ * The key of the Bus method that emits the framework's own subscriptions. `publish` excludes these keys
279
+ * through `PublishableKey`, and this symbol is exported only from the internal entry.
280
+ *
281
+ * @internal
282
+ */
283
+ const PublishDefault = Symbol("seedcord.publishDefault");
284
+
285
+ //#endregion
286
+ export { RowComponent as a, EventMetadataKey as c, InteractionRouteKeys as d, InteractionRoutes as f, contextMenuLeaves as g, WebhookUrlMetadataKey as h, BuilderComponent as i, GatedMetadataKey as l, SubscribeMetadataKey as m, deferFlags as n, setBotColor as o, MiddlewareMetadataKey as p, sendFlags as r, CommandMetadataKey as s, PublishDefault as t, InteractionMetadataKey as u };
287
+ //# sourceMappingURL=publishDefault-CldnxcT2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publishDefault-CldnxcT2.mjs","names":[],"sources":["../src/commands/contextMenuLeaves.ts","../src/metadataKeys.ts","../src/components/botColorHolder.ts","../src/components/builderTypes.ts","../src/components/colors.ts","../src/components/resolveColor.ts","../src/components/Component.ts","../src/reply/flags.ts","../src/subscribers/publishDefault.ts"],"sourcesContent":["import { ContextMenuCommandBuilder } from '@discordjs/builders';\nimport { ApplicationCommandType } from 'discord-api-types/v10';\n\nimport type { SlashCommandBuilder } from '@discordjs/builders';\n\n/** The registered context-menu command names, split by kind. @internal */\nexport interface ContextMenuLeaves {\n readonly user: Set<string>;\n readonly message: Set<string>;\n}\n\n/**\n * Collects the names of every registered context-menu command across a set of command builders, deduplicated\n * because the same builder appears once per guild. A user and a message command can share a name, so the two\n * kinds stay in separate sets.\n *\n * @internal\n */\nexport function contextMenuLeaves(\n commands: Iterable<SlashCommandBuilder | ContextMenuCommandBuilder>\n): ContextMenuLeaves {\n const user = new Set<string>();\n const message = new Set<string>();\n for (const command of commands) {\n if (!(command instanceof ContextMenuCommandBuilder)) continue;\n if (command.type === ApplicationCommandType.User) user.add(command.name);\n else message.add(command.name);\n }\n return { user, message };\n}\n","export enum InteractionRoutes {\n Slash = 'slash',\n Button = 'button',\n Modal = 'modal',\n StringMenu = 'stringMenu',\n UserMenu = 'userMenu',\n RoleMenu = 'roleMenu',\n ChannelMenu = 'channelMenu',\n MentionableMenu = 'mentionableMenu',\n MessageContextMenu = 'messageContextMenu',\n UserContextMenu = 'userContextMenu',\n Autocomplete = 'autocomplete'\n}\n\nexport const InteractionMetadataKey = Symbol('seedcord:interaction:metadata');\n\nexport const InteractionRouteKeys: Record<InteractionRoutes, symbol> = {\n [InteractionRoutes.Slash]: Symbol('seedcord:interaction:slash'),\n [InteractionRoutes.Button]: Symbol('seedcord:interaction:button'),\n [InteractionRoutes.Modal]: Symbol('seedcord:interaction:modal'),\n [InteractionRoutes.StringMenu]: Symbol('seedcord:interaction:stringMenu'),\n [InteractionRoutes.UserMenu]: Symbol('seedcord:interaction:userMenu'),\n [InteractionRoutes.RoleMenu]: Symbol('seedcord:interaction:roleMenu'),\n [InteractionRoutes.ChannelMenu]: Symbol('seedcord:interaction:channelMenu'),\n [InteractionRoutes.MentionableMenu]: Symbol('seedcord:interaction:mentionableMenu'),\n [InteractionRoutes.MessageContextMenu]: Symbol('seedcord:interaction:messageContextMenu'),\n [InteractionRoutes.UserContextMenu]: Symbol('seedcord:interaction:userContextMenu'),\n [InteractionRoutes.Autocomplete]: Symbol('seedcord:interaction:autocomplete')\n};\n\nexport const MiddlewareMetadataKey = Symbol('seedcord:middleware:metadata');\n\nexport const EventMetadataKey = Symbol('seedcord:event:metadata');\n\nexport const CommandMetadataKey = Symbol('seedcord:command:metadata');\n\nexport const GatedMetadataKey = Symbol('seedcord:gated:metadata');\n\nexport const SubscribeMetadataKey = Symbol('seedcord:subscribe:metadata');\n\nexport const WebhookUrlMetadataKey = Symbol('seedcord:webhookUrl:metadata');\n","import type { BotColor } from '@seedcord/types';\n\n// must be 'Default' so the container guard in applyBotColor leaves the accent unset\nconst DEFAULT_COLOR: BotColor = 'Default';\n\nlet current: BotColor = DEFAULT_COLOR;\n\nexport function setBotColor(color: BotColor | undefined): void {\n current = color ?? DEFAULT_COLOR;\n}\n\nexport function getBotColor(): BotColor {\n return current;\n}\n","import {\n ActionRowBuilder,\n ButtonBuilder,\n ChannelSelectMenuBuilder,\n CheckboxBuilder,\n CheckboxGroupBuilder,\n CheckboxGroupOptionBuilder,\n ContainerBuilder,\n ContextMenuCommandBuilder,\n EmbedBuilder,\n FileBuilder,\n FileUploadBuilder,\n LabelBuilder,\n MediaGalleryBuilder,\n MentionableSelectMenuBuilder,\n ModalBuilder,\n RadioGroupBuilder,\n RadioGroupOptionBuilder,\n RoleSelectMenuBuilder,\n SectionBuilder,\n SeparatorBuilder,\n SlashCommandBuilder,\n SlashCommandSubcommandBuilder,\n SlashCommandSubcommandGroupBuilder,\n StringSelectMenuBuilder,\n StringSelectMenuOptionBuilder,\n TextDisplayBuilder,\n TextInputBuilder,\n UserSelectMenuBuilder\n} from '@discordjs/builders';\n\n/**\n * Available Discord.js builder classes for use with BuilderComponent for commands, embeds, modals, etc.\n *\n * @internal\n */\nexport const BuilderTypes = {\n // Command Components\n command: SlashCommandBuilder,\n context_menu: ContextMenuCommandBuilder,\n subcommand: SlashCommandSubcommandBuilder,\n group: SlashCommandSubcommandGroupBuilder,\n\n // Embed Components\n embed: EmbedBuilder,\n\n // Modal Components\n modal: ModalBuilder,\n label: LabelBuilder,\n text_input: TextInputBuilder,\n file_upload: FileUploadBuilder,\n checkbox: CheckboxBuilder,\n checkbox_group: CheckboxGroupBuilder,\n checkbox_group_option: CheckboxGroupOptionBuilder,\n radio_group: RadioGroupBuilder,\n radio_group_option: RadioGroupOptionBuilder,\n\n // Action Row Components\n button: ButtonBuilder,\n menu_string: StringSelectMenuBuilder,\n menu_option_string: StringSelectMenuOptionBuilder,\n menu_user: UserSelectMenuBuilder,\n menu_channel: ChannelSelectMenuBuilder,\n menu_mentionable: MentionableSelectMenuBuilder,\n menu_role: RoleSelectMenuBuilder,\n\n // ComponentsV2\n container: ContainerBuilder,\n text_display: TextDisplayBuilder,\n file: FileBuilder,\n media: MediaGalleryBuilder,\n section: SectionBuilder,\n separator: SeparatorBuilder\n};\n\n/**\n * Available Discord.js action row classes for use with RowComponent for Select Menus and Buttons\n *\n * @internal\n */\nexport const RowTypes: {\n button: typeof ActionRowBuilder<ButtonBuilder>;\n menu_string: typeof ActionRowBuilder<StringSelectMenuBuilder>;\n menu_user: typeof ActionRowBuilder<UserSelectMenuBuilder>;\n menu_channel: typeof ActionRowBuilder<ChannelSelectMenuBuilder>;\n menu_mentionable: typeof ActionRowBuilder<MentionableSelectMenuBuilder>;\n menu_role: typeof ActionRowBuilder<RoleSelectMenuBuilder>;\n} = {\n button: ActionRowBuilder<ButtonBuilder>,\n menu_string: ActionRowBuilder<StringSelectMenuBuilder>,\n menu_user: ActionRowBuilder<UserSelectMenuBuilder>,\n menu_channel: ActionRowBuilder<ChannelSelectMenuBuilder>,\n menu_mentionable: ActionRowBuilder<MentionableSelectMenuBuilder>,\n menu_role: ActionRowBuilder<RoleSelectMenuBuilder>\n};\n\n/**\n * Available Discord.js builder types for use with BuilderComponent\n */\nexport type BuilderType = keyof typeof BuilderTypes;\n\n/**\n * @internal\n */\nexport type InstantiatedBuilder<BuilderKey extends BuilderType> = InstanceType<(typeof BuilderTypes)[BuilderKey]>;\n\n/**\n * Available Discord.js action row types for use with RowComponent\n */\nexport type RowType = keyof typeof RowTypes;\n\n/**\n * @internal\n */\nexport type InstantiatedActionRow<RowKey extends RowType> = InstanceType<(typeof RowTypes)[RowKey]>;\n","import type { ColorName, TypedOmit } from '@seedcord/types';\n\n// Ported verbatim from discord.js (Apache-2.0), src/util/Colors.js.\nexport const Colors: TypedOmit<Record<ColorName, number>, 'Random'> = {\n Aqua: 0x1a_bc_9c,\n Blue: 0x34_98_db,\n Blurple: 0x58_65_f2,\n DarkAqua: 0x11_80_6a,\n DarkBlue: 0x20_66_94,\n DarkButNotBlack: 0x2c_2f_33,\n DarkerGrey: 0x7f_8c_8d,\n DarkGold: 0xc2_7c_0e,\n DarkGreen: 0x1f_8b_4c,\n DarkGrey: 0x97_9c_9f,\n DarkNavy: 0x2c_3e_50,\n DarkOrange: 0xa8_43_00,\n DarkPurple: 0x71_36_8a,\n DarkRed: 0x99_2d_22,\n DarkVividPink: 0xad_14_57,\n Default: 0x00_00_00,\n Fuchsia: 0xeb_45_9e,\n Gold: 0xf1_c4_0f,\n Green: 0x57_f2_87,\n Grey: 0x95_a5_a6,\n Greyple: 0x99_aa_b5,\n LightGrey: 0xbc_c0_c0,\n LuminousVividPink: 0xe9_1e_63,\n Navy: 0x34_49_5e,\n NotQuiteBlack: 0x23_27_2a,\n Orange: 0xe6_7e_22,\n Purple: 0x9b_59_b6,\n Red: 0xed_42_45,\n White: 0xff_ff_ff,\n Yellow: 0xfe_e7_5c\n} as const;\n","import { SeedcordErrorCode } from '@seedcord/errors';\nimport { SeedcordRangeError, SeedcordTypeError } from '@seedcord/errors/internal';\n\nimport { Colors } from './colors';\n\nimport type { BotColor } from '@seedcord/types';\n\nconst MAX_COLOR = 0xff_ff_ff;\nconst RED_SHIFT = 16;\nconst GREEN_SHIFT = 8;\n\nconst palette: Record<string, number | undefined> = Colors;\n\n/**\n * Resolves a {@link BotColor} to the integer Discord expects.\n *\n * Ported from discord.js (Apache-2.0), `resolveColor` in src/util/Util.js.\n */\nexport function resolveColor(color: BotColor): number {\n let resolved: number | undefined;\n\n if (typeof color === 'string') {\n if (color === 'Random') return Math.floor(Math.random() * (MAX_COLOR + 1));\n if (color === 'Default') return 0;\n if (/^#?[\\da-f]{6}$/i.test(color)) return Number.parseInt(color.replace('#', ''), 16);\n resolved = palette[color];\n } else if (typeof color === 'number') {\n resolved = color;\n } else {\n resolved = (color[0] << RED_SHIFT) + (color[1] << GREEN_SHIFT) + color[2];\n }\n\n if (resolved === undefined || !Number.isSafeInteger(resolved)) {\n throw new SeedcordTypeError(SeedcordErrorCode.ColorUnresolvable, [JSON.stringify(color)]);\n }\n if (resolved < 0 || resolved > MAX_COLOR) {\n throw new SeedcordRangeError(SeedcordErrorCode.ColorOutOfRange);\n }\n\n return resolved;\n}\n","import { ContainerBuilder, ContextMenuCommandBuilder, EmbedBuilder, SlashCommandBuilder } from '@discordjs/builders';\nimport { InteractionContextType } from 'discord-api-types/v10';\n\nimport { getBotColor } from './botColorHolder';\nimport { BuilderTypes, RowTypes } from './builderTypes';\nimport { resolveColor } from './resolveColor';\n\nimport type { BuilderType, InstantiatedActionRow, InstantiatedBuilder, RowType } from './builderTypes';\n\n/**\n * Base class for Discord component wrappers.\n *\n * @typeParam TComponent - The Discord.js component type being wrapped\n *\n * @internal\n */\nabstract class BaseComponent<TComponent> {\n private readonly _component: TComponent;\n\n protected constructor(ComponentClass: new () => TComponent) {\n this._component = new ComponentClass();\n }\n\n /**\n * Returns the live builder, ready to send in a Discord message or nest in another component.\n *\n * Configure it through `this.instance`. Reading this can apply the bot color (see\n * {@link BuilderComponent}), so it has a side effect.\n * @example new SomeComponent().component\n */\n public abstract get component(): InstantiatedBuilder<BuilderType> | InstantiatedActionRow<RowType>;\n\n /**\n * The wrapped builder, for calling Discord.js methods like setTitle() and setDescription() inside a subclass.\n *\n * @example this.instance.setTitle('My Modal')\n */\n protected get instance(): TComponent {\n return this._component;\n }\n}\n\n/**\n * Base class for Discord.js builder components\n *\n * Wraps Discord.js builders (SlashCommandBuilder, EmbedBuilder, etc.) with\n * Seedcord-specific defaults and helper methods.\n *\n * @typeParam BuilderKey - The type of Discord.js builder being wrapped\n */\nexport abstract class BuilderComponent<BuilderKey extends BuilderType> extends BaseComponent<\n InstantiatedBuilder<BuilderKey>\n> {\n private colorApplied = false;\n\n protected constructor(public readonly type: BuilderKey) {\n const ComponentClass = BuilderTypes[type] as unknown;\n super(ComponentClass as new () => InstantiatedBuilder<BuilderKey>);\n\n if (this.instance instanceof SlashCommandBuilder || this.instance instanceof ContextMenuCommandBuilder) {\n this.instance.setContexts(InteractionContextType.Guild);\n }\n }\n\n get component(): InstantiatedBuilder<BuilderKey> {\n this.applyBotColor();\n return this.instance;\n }\n\n // Resolving in the constructor would capture the default for a component built before setBotColor()\n // ran. The unset check keeps a color the subclass set for itself.\n private applyBotColor(): void {\n if (this.colorApplied) return;\n this.colorApplied = true;\n\n const color = getBotColor();\n if (this.instance instanceof EmbedBuilder) {\n if (this.instance.data.color === undefined) this.instance.setColor(resolveColor(color));\n } else if (this.instance instanceof ContainerBuilder) {\n const accent = this.instance.data.accent_color;\n if (accent === null || accent === undefined) {\n this.instance.setAccentColor(color === 'Default' ? undefined : resolveColor(color));\n }\n }\n }\n}\n\n/**\n * Base class for Discord action row components\n *\n * Wraps Discord.js action row builder with Seedcord-specific defaults and helper methods.\n *\n * @typeParam RowKey - The Discord.js action row type being wrapped\n */\nexport abstract class RowComponent<RowKey extends RowType> extends BaseComponent<InstantiatedActionRow<RowKey>> {\n protected constructor(public readonly type: RowKey) {\n const ComponentClass = RowTypes[type] as unknown;\n super(ComponentClass as new () => InstantiatedActionRow<RowKey>);\n }\n\n get component(): InstantiatedActionRow<RowKey> {\n return this.instance;\n }\n}\n","import { MessageFlags } from 'discord-api-types/v10';\n\nimport type { DeferOpts, SendOpts } from '@seedcord/types';\n\n/** IsComponentsV2 is unconditional, every framework reply is v2. */\nexport function sendFlags(opts?: SendOpts): number {\n let flags = MessageFlags.IsComponentsV2;\n if (opts?.ephemeral ?? true) flags |= MessageFlags.Ephemeral;\n if (opts?.silent) flags |= MessageFlags.SuppressNotifications;\n return flags;\n}\n\n/** A deferral carries no content, so only Ephemeral applies. */\nexport function deferFlags(opts?: DeferOpts): number {\n return (opts?.ephemeral ?? true) ? MessageFlags.Ephemeral : 0;\n}\n","/**\n * The key of the Bus method that emits the framework's own subscriptions. `publish` excludes these keys\n * through `PublishableKey`, and this symbol is exported only from the internal entry.\n *\n * @internal\n */\nexport const PublishDefault = Symbol('seedcord.publishDefault');\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAAgB,kBACZ,UACiB;CACjB,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,0BAAU,IAAI,IAAY;CAChC,KAAK,MAAM,WAAW,UAAU;EAC5B,IAAI,EAAE,mBAAmB,4BAA4B;EACrD,IAAI,QAAQ,SAAS,uBAAuB,MAAM,KAAK,IAAI,QAAQ,IAAI;OAClE,QAAQ,IAAI,QAAQ,IAAI;CACjC;CACA,OAAO;EAAE;EAAM;CAAQ;AAC3B;;;;AC7BA,IAAY,oBAAL;CACH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AACJ;AAEA,MAAa,yBAAyB,OAAO,+BAA+B;AAE5E,MAAa,uBAA0D;YACxC,OAAO,4BAA4B;aAClC,OAAO,6BAA6B;YACrC,OAAO,4BAA4B;iBAC9B,OAAO,iCAAiC;eAC1C,OAAO,+BAA+B;eACtC,OAAO,+BAA+B;kBACnC,OAAO,kCAAkC;sBACrC,OAAO,sCAAsC;yBAC1C,OAAO,yCAAyC;sBACnD,OAAO,sCAAsC;mBAChD,OAAO,mCAAmC;AAChF;AAEA,MAAa,wBAAwB,OAAO,8BAA8B;AAE1E,MAAa,mBAAmB,OAAO,yBAAyB;AAEhE,MAAa,qBAAqB,OAAO,2BAA2B;AAEpE,MAAa,mBAAmB,OAAO,yBAAyB;AAEhE,MAAa,uBAAuB,OAAO,6BAA6B;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QAAQ,WAAW,QAC9B,KAAK,SAAS,eAAe,UAAU,YAAY,SAAY,aAAa,KAAK,CAAC;EAE1F;CACJ;AACJ;;;;;;;;AASA,IAAsB,eAAtB,cAAmE,cAA6C;CACtE;CAAtC,AAAU,YAAY,AAAgB,MAAc;EAChD,MAAM,iBAAiB,SAAS;EAChC,MAAM,cAAyD;EAF7B;CAGtC;CAEA,IAAI,YAA2C;EAC3C,OAAO,KAAK;CAChB;AACJ;;;;;AClGA,SAAgB,UAAU,MAAyB;CAC/C,IAAI,QAAQ,aAAa;CACzB,IAAI,MAAM,aAAa,MAAM,SAAS,aAAa;CACnD,IAAI,MAAM,QAAQ,SAAS,aAAa;CACxC,OAAO;AACX;;AAGA,SAAgB,WAAW,MAA0B;CACjD,OAAQ,MAAM,aAAa,OAAQ,aAAa,YAAY;AAChE;;;;;;;;;;ACTA,MAAa,iBAAiB,OAAO,yBAAyB"}
@@ -0,0 +1,23 @@
1
+ import { SlashCommandBuilder } from "@discordjs/builders";
2
+ import { routeLeavesOf } from "@seedcord/utils/internal";
3
+
4
+ //#region src/commands/slashRouteLeaves.ts
5
+ /**
6
+ * Collects the route keys of every executable slash leaf across a set of command builders, deduplicated
7
+ * because the same builder appears once per guild. The keys come from the same {@link routeLeavesOf} that
8
+ * `seedcord codegen` reads, so the boot-time check compares against the generated registry's keys.
9
+ *
10
+ * @internal
11
+ */
12
+ function slashRouteLeaves(commands) {
13
+ const leaves = /* @__PURE__ */ new Set();
14
+ for (const command of commands) {
15
+ if (!(command instanceof SlashCommandBuilder)) continue;
16
+ for (const leaf of routeLeavesOf(command.toJSON())) leaves.add(leaf.route);
17
+ }
18
+ return leaves;
19
+ }
20
+
21
+ //#endregion
22
+ export { slashRouteLeaves as t };
23
+ //# sourceMappingURL=slashRouteLeaves-BANDtPFm.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slashRouteLeaves-BANDtPFm.mjs","names":[],"sources":["../src/commands/slashRouteLeaves.ts"],"sourcesContent":["import { SlashCommandBuilder } from '@discordjs/builders';\nimport { routeLeavesOf } from '@seedcord/utils/internal';\n\nimport type { ContextMenuCommandBuilder } from '@discordjs/builders';\n\n/**\n * Collects the route keys of every executable slash leaf across a set of command builders, deduplicated\n * because the same builder appears once per guild. The keys come from the same {@link routeLeavesOf} that\n * `seedcord codegen` reads, so the boot-time check compares against the generated registry's keys.\n *\n * @internal\n */\nexport function slashRouteLeaves(commands: Iterable<SlashCommandBuilder | ContextMenuCommandBuilder>): Set<string> {\n const leaves = new Set<string>();\n for (const command of commands) {\n if (!(command instanceof SlashCommandBuilder)) continue;\n for (const leaf of routeLeavesOf(command.toJSON())) leaves.add(leaf.route);\n }\n return leaves;\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAgB,iBAAiB,UAAkF;CAC/G,MAAM,yBAAS,IAAI,IAAY;CAC/B,KAAK,MAAM,WAAW,UAAU;EAC5B,IAAI,EAAE,mBAAmB,sBAAsB;EAC/C,KAAK,MAAM,QAAQ,cAAc,QAAQ,OAAO,CAAC,GAAG,OAAO,IAAI,KAAK,KAAK;CAC7E;CACA,OAAO;AACX"}
@@ -0,0 +1,28 @@
1
+ let _discordjs_builders = require("@discordjs/builders");
2
+ let _seedcord_utils_internal = require("@seedcord/utils/internal");
3
+
4
+ //#region src/commands/slashRouteLeaves.ts
5
+ /**
6
+ * Collects the route keys of every executable slash leaf across a set of command builders, deduplicated
7
+ * because the same builder appears once per guild. The keys come from the same {@link routeLeavesOf} that
8
+ * `seedcord codegen` reads, so the boot-time check compares against the generated registry's keys.
9
+ *
10
+ * @internal
11
+ */
12
+ function slashRouteLeaves(commands) {
13
+ const leaves = /* @__PURE__ */ new Set();
14
+ for (const command of commands) {
15
+ if (!(command instanceof _discordjs_builders.SlashCommandBuilder)) continue;
16
+ for (const leaf of (0, _seedcord_utils_internal.routeLeavesOf)(command.toJSON())) leaves.add(leaf.route);
17
+ }
18
+ return leaves;
19
+ }
20
+
21
+ //#endregion
22
+ Object.defineProperty(exports, 'slashRouteLeaves', {
23
+ enumerable: true,
24
+ get: function () {
25
+ return slashRouteLeaves;
26
+ }
27
+ });
28
+ //# sourceMappingURL=slashRouteLeaves-nfxOAM7Q.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slashRouteLeaves-nfxOAM7Q.cjs","names":["SlashCommandBuilder"],"sources":["../src/commands/slashRouteLeaves.ts"],"sourcesContent":["import { SlashCommandBuilder } from '@discordjs/builders';\nimport { routeLeavesOf } from '@seedcord/utils/internal';\n\nimport type { ContextMenuCommandBuilder } from '@discordjs/builders';\n\n/**\n * Collects the route keys of every executable slash leaf across a set of command builders, deduplicated\n * because the same builder appears once per guild. The keys come from the same {@link routeLeavesOf} that\n * `seedcord codegen` reads, so the boot-time check compares against the generated registry's keys.\n *\n * @internal\n */\nexport function slashRouteLeaves(commands: Iterable<SlashCommandBuilder | ContextMenuCommandBuilder>): Set<string> {\n const leaves = new Set<string>();\n for (const command of commands) {\n if (!(command instanceof SlashCommandBuilder)) continue;\n for (const leaf of routeLeavesOf(command.toJSON())) leaves.add(leaf.route);\n }\n return leaves;\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAgB,iBAAiB,UAAkF;CAC/G,MAAM,yBAAS,IAAI,IAAY;CAC/B,KAAK,MAAM,WAAW,UAAU;EAC5B,IAAI,EAAE,mBAAmBA,0CAAsB;EAC/C,KAAK,MAAM,oDAAsB,QAAQ,OAAO,CAAC,GAAG,OAAO,IAAI,KAAK,KAAK;CAC7E;CACA,OAAO;AACX"}