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

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 (53) hide show
  1. package/dist/{AutocompleteOptions-eKhIe6Qt.d.mts → AutocompleteOptions-DLp_B8as.d.mts} +61 -112
  2. package/dist/HmrModuleHandler-3sNgKHdf.mjs +163 -0
  3. package/dist/HmrModuleHandler-3sNgKHdf.mjs.map +1 -0
  4. package/dist/HmrModuleHandler-CTBng7wV.cjs +170 -0
  5. package/dist/HmrModuleHandler-CTBng7wV.cjs.map +1 -0
  6. package/dist/Plugin-3rlH0uxH.d.mts +620 -0
  7. package/dist/{Plugin-C2-VHrsX.cjs → Plugin-Cgp1a0uQ.cjs} +13 -4
  8. package/dist/Plugin-Cgp1a0uQ.cjs.map +1 -0
  9. package/dist/{Plugin-PcdPjAzc.mjs → Plugin-j9GYdroS.mjs} +13 -4
  10. package/dist/Plugin-j9GYdroS.mjs.map +1 -0
  11. package/dist/{permissions-DSW_EZfN.cjs → Silence-DiP95iwD.cjs} +38 -307
  12. package/dist/Silence-DiP95iwD.cjs.map +1 -0
  13. package/dist/{permissions-RVCBhL2n.mjs → Silence-dbC2slOB.mjs} +35 -238
  14. package/dist/Silence-dbC2slOB.mjs.map +1 -0
  15. package/dist/basic-D7bDlgSP.d.mts +10 -0
  16. package/dist/hmr.index.cjs +2 -164
  17. package/dist/hmr.index.mjs +2 -162
  18. package/dist/index-Dueqztyy.d.mts +142 -0
  19. package/dist/index.cjs +50 -72
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.mts +7 -5
  22. package/dist/index.mjs +8 -35
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/internal.index.cjs +262 -74
  25. package/dist/internal.index.cjs.map +1 -1
  26. package/dist/internal.index.d.mts +68 -4
  27. package/dist/internal.index.mjs +216 -35
  28. package/dist/internal.index.mjs.map +1 -1
  29. package/dist/node-internal.index.cjs +123 -52
  30. package/dist/node-internal.index.cjs.map +1 -1
  31. package/dist/node-internal.index.d.mts +67 -2158
  32. package/dist/node-internal.index.mjs +124 -54
  33. package/dist/node-internal.index.mjs.map +1 -1
  34. package/dist/plugin.index.cjs +1 -1
  35. package/dist/plugin.index.d.mts +1 -1
  36. package/dist/plugin.index.mjs +1 -1
  37. package/dist/publishDefault-CCf1azzW.mjs +264 -0
  38. package/dist/publishDefault-CCf1azzW.mjs.map +1 -0
  39. package/dist/publishDefault-l0NQ-SHo.cjs +353 -0
  40. package/dist/publishDefault-l0NQ-SHo.cjs.map +1 -0
  41. package/dist/subscribers-B1G6_LlK.cjs +517 -0
  42. package/dist/subscribers-B1G6_LlK.cjs.map +1 -0
  43. package/dist/subscribers-DYqFVP1X.mjs +480 -0
  44. package/dist/subscribers-DYqFVP1X.mjs.map +1 -0
  45. package/package.json +7 -6
  46. package/dist/Plugin-C2-VHrsX.cjs.map +0 -1
  47. package/dist/Plugin-CNyRKDHT.d.mts +0 -226
  48. package/dist/Plugin-PcdPjAzc.mjs.map +0 -1
  49. package/dist/hmr.index.cjs.map +0 -1
  50. package/dist/hmr.index.mjs.map +0 -1
  51. package/dist/is-never-Ddaba1Su.d.mts +0 -58
  52. package/dist/permissions-DSW_EZfN.cjs.map +0 -1
  53. package/dist/permissions-RVCBhL2n.mjs.map +0 -1
@@ -1,3 +1,3 @@
1
- import { a as PluginLifecycleSpec, d as PluginOptions, l as PluginCapabilityTypes, n as Plugin, t as Initializeable, u as PluginContext } from "./Plugin-CNyRKDHT.mjs";
1
+ import { d as PluginCapabilityTypes, f as PluginContext, m as PluginOptions, n as Initializeable, r as Plugin, s as PluginLifecycleSpec } from "./Plugin-3rlH0uxH.mjs";
2
2
  import { HmrAware, HmrUpdateEvent } from "@seedcord/types";
3
3
  export { type HmrAware, type HmrUpdateEvent, type Initializeable, Plugin, type PluginCapabilityTypes, type PluginContext, type PluginLifecycleSpec, type PluginOptions };
@@ -1,3 +1,3 @@
1
- import { t as Plugin } from "./Plugin-PcdPjAzc.mjs";
1
+ import { t as Plugin } from "./Plugin-j9GYdroS.mjs";
2
2
 
3
3
  export { Plugin };
@@ -0,0 +1,264 @@
1
+ import { SeedcordErrorCode } from "@seedcord/errors";
2
+ import { SeedcordRangeError, SeedcordTypeError } from "@seedcord/errors/internal";
3
+ import { InteractionContextType, MessageFlags } from "discord-api-types/v10";
4
+ 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";
5
+
6
+ //#region src/metadataKeys.ts
7
+ let InteractionRoutes = /* @__PURE__ */ function(InteractionRoutes) {
8
+ InteractionRoutes["Slash"] = "slash";
9
+ InteractionRoutes["Button"] = "button";
10
+ InteractionRoutes["Modal"] = "modal";
11
+ InteractionRoutes["StringMenu"] = "stringMenu";
12
+ InteractionRoutes["UserMenu"] = "userMenu";
13
+ InteractionRoutes["RoleMenu"] = "roleMenu";
14
+ InteractionRoutes["ChannelMenu"] = "channelMenu";
15
+ InteractionRoutes["MentionableMenu"] = "mentionableMenu";
16
+ InteractionRoutes["MessageContextMenu"] = "messageContextMenu";
17
+ InteractionRoutes["UserContextMenu"] = "userContextMenu";
18
+ InteractionRoutes["Autocomplete"] = "autocomplete";
19
+ return InteractionRoutes;
20
+ }({});
21
+ const InteractionMetadataKey = Symbol("seedcord:interaction:metadata");
22
+ const InteractionRouteKeys = {
23
+ ["slash"]: Symbol("seedcord:interaction:slash"),
24
+ ["button"]: Symbol("seedcord:interaction:button"),
25
+ ["modal"]: Symbol("seedcord:interaction:modal"),
26
+ ["stringMenu"]: Symbol("seedcord:interaction:stringMenu"),
27
+ ["userMenu"]: Symbol("seedcord:interaction:userMenu"),
28
+ ["roleMenu"]: Symbol("seedcord:interaction:roleMenu"),
29
+ ["channelMenu"]: Symbol("seedcord:interaction:channelMenu"),
30
+ ["mentionableMenu"]: Symbol("seedcord:interaction:mentionableMenu"),
31
+ ["messageContextMenu"]: Symbol("seedcord:interaction:messageContextMenu"),
32
+ ["userContextMenu"]: Symbol("seedcord:interaction:userContextMenu"),
33
+ ["autocomplete"]: Symbol("seedcord:interaction:autocomplete")
34
+ };
35
+ const MiddlewareMetadataKey = Symbol("seedcord:middleware:metadata");
36
+ const EventMetadataKey = Symbol("seedcord:event:metadata");
37
+ const CommandMetadataKey = Symbol("seedcord:command:metadata");
38
+ const GatedMetadataKey = Symbol("seedcord:gated:metadata");
39
+ const SubscribeMetadataKey = Symbol("seedcord:subscribe:metadata");
40
+ const WebhookUrlMetadataKey = Symbol("seedcord:webhookUrl:metadata");
41
+
42
+ //#endregion
43
+ //#region src/components/botColorHolder.ts
44
+ const DEFAULT_COLOR = "Default";
45
+ let current = DEFAULT_COLOR;
46
+ function setBotColor(color) {
47
+ current = color ?? DEFAULT_COLOR;
48
+ }
49
+ function getBotColor() {
50
+ return current;
51
+ }
52
+
53
+ //#endregion
54
+ //#region src/components/builderTypes.ts
55
+ /**
56
+ * Available Discord.js builder classes for use with BuilderComponent for commands, embeds, modals, etc.
57
+ *
58
+ * @internal
59
+ */
60
+ const BuilderTypes = {
61
+ command: SlashCommandBuilder,
62
+ context_menu: ContextMenuCommandBuilder,
63
+ subcommand: SlashCommandSubcommandBuilder,
64
+ group: SlashCommandSubcommandGroupBuilder,
65
+ embed: EmbedBuilder,
66
+ modal: ModalBuilder,
67
+ label: LabelBuilder,
68
+ text_input: TextInputBuilder,
69
+ file_upload: FileUploadBuilder,
70
+ checkbox: CheckboxBuilder,
71
+ checkbox_group: CheckboxGroupBuilder,
72
+ checkbox_group_option: CheckboxGroupOptionBuilder,
73
+ radio_group: RadioGroupBuilder,
74
+ radio_group_option: RadioGroupOptionBuilder,
75
+ button: ButtonBuilder,
76
+ menu_string: StringSelectMenuBuilder,
77
+ menu_option_string: StringSelectMenuOptionBuilder,
78
+ menu_user: UserSelectMenuBuilder,
79
+ menu_channel: ChannelSelectMenuBuilder,
80
+ menu_mentionable: MentionableSelectMenuBuilder,
81
+ menu_role: RoleSelectMenuBuilder,
82
+ container: ContainerBuilder,
83
+ text_display: TextDisplayBuilder,
84
+ file: FileBuilder,
85
+ media: MediaGalleryBuilder,
86
+ section: SectionBuilder,
87
+ separator: SeparatorBuilder
88
+ };
89
+ /**
90
+ * Available Discord.js action row classes for use with RowComponent for Select Menus and Buttons
91
+ *
92
+ * @internal
93
+ */
94
+ const RowTypes = {
95
+ button: ActionRowBuilder,
96
+ menu_string: ActionRowBuilder,
97
+ menu_user: ActionRowBuilder,
98
+ menu_channel: ActionRowBuilder,
99
+ menu_mentionable: ActionRowBuilder,
100
+ menu_role: ActionRowBuilder
101
+ };
102
+
103
+ //#endregion
104
+ //#region src/components/colors.ts
105
+ const Colors = {
106
+ Aqua: 1752220,
107
+ Blue: 3447003,
108
+ Blurple: 5793266,
109
+ DarkAqua: 1146986,
110
+ DarkBlue: 2123412,
111
+ DarkButNotBlack: 2895667,
112
+ DarkerGrey: 8359053,
113
+ DarkGold: 12745742,
114
+ DarkGreen: 2067276,
115
+ DarkGrey: 9936031,
116
+ DarkNavy: 2899536,
117
+ DarkOrange: 11027200,
118
+ DarkPurple: 7419530,
119
+ DarkRed: 10038562,
120
+ DarkVividPink: 11342935,
121
+ Default: 0,
122
+ Fuchsia: 15418782,
123
+ Gold: 15844367,
124
+ Green: 5763719,
125
+ Grey: 9807270,
126
+ Greyple: 10070709,
127
+ LightGrey: 12370112,
128
+ LuminousVividPink: 15277667,
129
+ Navy: 3426654,
130
+ NotQuiteBlack: 2303786,
131
+ Orange: 15105570,
132
+ Purple: 10181046,
133
+ Red: 15548997,
134
+ White: 16777215,
135
+ Yellow: 16705372
136
+ };
137
+
138
+ //#endregion
139
+ //#region src/components/resolveColor.ts
140
+ const MAX_COLOR = 16777215;
141
+ const RED_SHIFT = 16;
142
+ const GREEN_SHIFT = 8;
143
+ const palette = Colors;
144
+ /**
145
+ * Resolves a {@link BotColor} to the integer Discord expects.
146
+ *
147
+ * Ported from discord.js (Apache-2.0), `resolveColor` in src/util/Util.js.
148
+ */
149
+ function resolveColor(color) {
150
+ let resolved;
151
+ if (typeof color === "string") {
152
+ if (color === "Random") return Math.floor(Math.random() * 16777216);
153
+ if (color === "Default") return 0;
154
+ if (/^#?[\da-f]{6}$/i.test(color)) return Number.parseInt(color.replace("#", ""), 16);
155
+ resolved = palette[color];
156
+ } else if (typeof color === "number") resolved = color;
157
+ else resolved = (color[0] << RED_SHIFT) + (color[1] << GREEN_SHIFT) + color[2];
158
+ if (resolved === void 0 || !Number.isSafeInteger(resolved)) throw new SeedcordTypeError(SeedcordErrorCode.ColorUnresolvable, [JSON.stringify(color)]);
159
+ if (resolved < 0 || resolved > MAX_COLOR) throw new SeedcordRangeError(SeedcordErrorCode.ColorOutOfRange);
160
+ return resolved;
161
+ }
162
+
163
+ //#endregion
164
+ //#region src/components/Component.ts
165
+ /**
166
+ * Base class for Discord component wrappers.
167
+ *
168
+ * @typeParam TComponent - The Discord.js component type being wrapped
169
+ *
170
+ * @internal
171
+ */
172
+ var BaseComponent = class {
173
+ _component;
174
+ constructor(ComponentClass) {
175
+ this._component = new ComponentClass();
176
+ }
177
+ /**
178
+ * The wrapped builder, for calling Discord.js methods like setTitle() and setDescription() inside a subclass.
179
+ *
180
+ * @example this.instance.setTitle('My Modal')
181
+ */
182
+ get instance() {
183
+ return this._component;
184
+ }
185
+ };
186
+ /**
187
+ * Base class for Discord.js builder components
188
+ *
189
+ * Wraps Discord.js builders (SlashCommandBuilder, EmbedBuilder, etc.) with
190
+ * Seedcord-specific defaults and helper methods.
191
+ *
192
+ * @typeParam BuilderKey - The type of Discord.js builder being wrapped
193
+ */
194
+ var BuilderComponent = class extends BaseComponent {
195
+ type;
196
+ colorApplied = false;
197
+ constructor(type) {
198
+ const ComponentClass = BuilderTypes[type];
199
+ super(ComponentClass);
200
+ this.type = type;
201
+ if (this.instance instanceof SlashCommandBuilder || this.instance instanceof ContextMenuCommandBuilder) this.instance.setContexts(InteractionContextType.Guild);
202
+ }
203
+ get component() {
204
+ this.applyBotColor();
205
+ return this.instance;
206
+ }
207
+ applyBotColor() {
208
+ if (this.colorApplied) return;
209
+ this.colorApplied = true;
210
+ const color = getBotColor();
211
+ if (this.instance instanceof EmbedBuilder) {
212
+ if (this.instance.data.color === void 0) this.instance.setColor(resolveColor(color));
213
+ } else if (this.instance instanceof ContainerBuilder) {
214
+ const accent = this.instance.data.accent_color;
215
+ if (accent === null || accent === void 0) this.instance.setAccentColor(color === "Default" ? void 0 : resolveColor(color));
216
+ }
217
+ }
218
+ };
219
+ /**
220
+ * Base class for Discord action row components
221
+ *
222
+ * Wraps Discord.js action row builder with Seedcord-specific defaults and helper methods.
223
+ *
224
+ * @typeParam RowKey - The Discord.js action row type being wrapped
225
+ */
226
+ var RowComponent = class extends BaseComponent {
227
+ type;
228
+ constructor(type) {
229
+ const ComponentClass = RowTypes[type];
230
+ super(ComponentClass);
231
+ this.type = type;
232
+ }
233
+ get component() {
234
+ return this.instance;
235
+ }
236
+ };
237
+
238
+ //#endregion
239
+ //#region src/reply/flags.ts
240
+ /** IsComponentsV2 is unconditional, every framework reply is v2. */
241
+ function sendFlags(opts) {
242
+ let flags = MessageFlags.IsComponentsV2;
243
+ if (opts?.ephemeral ?? true) flags |= MessageFlags.Ephemeral;
244
+ if (opts?.silent) flags |= MessageFlags.SuppressNotifications;
245
+ return flags;
246
+ }
247
+ /** A deferral carries no content, so only Ephemeral applies. */
248
+ function deferFlags(opts) {
249
+ return opts?.ephemeral ?? true ? MessageFlags.Ephemeral : 0;
250
+ }
251
+
252
+ //#endregion
253
+ //#region src/subscribers/publishDefault.ts
254
+ /**
255
+ * The key of the Bus method that emits the framework's own subscriptions. `publish` excludes these keys
256
+ * through `PublishableKey`, and this symbol is exported only from the internal entry.
257
+ *
258
+ * @internal
259
+ */
260
+ const PublishDefault = Symbol("seedcord.publishDefault");
261
+
262
+ //#endregion
263
+ export { RowComponent as a, EventMetadataKey as c, InteractionRouteKeys as d, InteractionRoutes as f, 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 };
264
+ //# sourceMappingURL=publishDefault-CCf1azzW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publishDefault-CCf1azzW.mjs","names":[],"sources":["../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":["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":"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"}
@@ -0,0 +1,353 @@
1
+ let _seedcord_errors = require("@seedcord/errors");
2
+ let _seedcord_errors_internal = require("@seedcord/errors/internal");
3
+ let discord_api_types_v10 = require("discord-api-types/v10");
4
+ let _discordjs_builders = require("@discordjs/builders");
5
+
6
+ //#region src/metadataKeys.ts
7
+ let InteractionRoutes = /* @__PURE__ */ function(InteractionRoutes) {
8
+ InteractionRoutes["Slash"] = "slash";
9
+ InteractionRoutes["Button"] = "button";
10
+ InteractionRoutes["Modal"] = "modal";
11
+ InteractionRoutes["StringMenu"] = "stringMenu";
12
+ InteractionRoutes["UserMenu"] = "userMenu";
13
+ InteractionRoutes["RoleMenu"] = "roleMenu";
14
+ InteractionRoutes["ChannelMenu"] = "channelMenu";
15
+ InteractionRoutes["MentionableMenu"] = "mentionableMenu";
16
+ InteractionRoutes["MessageContextMenu"] = "messageContextMenu";
17
+ InteractionRoutes["UserContextMenu"] = "userContextMenu";
18
+ InteractionRoutes["Autocomplete"] = "autocomplete";
19
+ return InteractionRoutes;
20
+ }({});
21
+ const InteractionMetadataKey = Symbol("seedcord:interaction:metadata");
22
+ const InteractionRouteKeys = {
23
+ ["slash"]: Symbol("seedcord:interaction:slash"),
24
+ ["button"]: Symbol("seedcord:interaction:button"),
25
+ ["modal"]: Symbol("seedcord:interaction:modal"),
26
+ ["stringMenu"]: Symbol("seedcord:interaction:stringMenu"),
27
+ ["userMenu"]: Symbol("seedcord:interaction:userMenu"),
28
+ ["roleMenu"]: Symbol("seedcord:interaction:roleMenu"),
29
+ ["channelMenu"]: Symbol("seedcord:interaction:channelMenu"),
30
+ ["mentionableMenu"]: Symbol("seedcord:interaction:mentionableMenu"),
31
+ ["messageContextMenu"]: Symbol("seedcord:interaction:messageContextMenu"),
32
+ ["userContextMenu"]: Symbol("seedcord:interaction:userContextMenu"),
33
+ ["autocomplete"]: Symbol("seedcord:interaction:autocomplete")
34
+ };
35
+ const MiddlewareMetadataKey = Symbol("seedcord:middleware:metadata");
36
+ const EventMetadataKey = Symbol("seedcord:event:metadata");
37
+ const CommandMetadataKey = Symbol("seedcord:command:metadata");
38
+ const GatedMetadataKey = Symbol("seedcord:gated:metadata");
39
+ const SubscribeMetadataKey = Symbol("seedcord:subscribe:metadata");
40
+ const WebhookUrlMetadataKey = Symbol("seedcord:webhookUrl:metadata");
41
+
42
+ //#endregion
43
+ //#region src/components/botColorHolder.ts
44
+ const DEFAULT_COLOR = "Default";
45
+ let current = DEFAULT_COLOR;
46
+ function setBotColor(color) {
47
+ current = color ?? DEFAULT_COLOR;
48
+ }
49
+ function getBotColor() {
50
+ return current;
51
+ }
52
+
53
+ //#endregion
54
+ //#region src/components/builderTypes.ts
55
+ /**
56
+ * Available Discord.js builder classes for use with BuilderComponent for commands, embeds, modals, etc.
57
+ *
58
+ * @internal
59
+ */
60
+ const BuilderTypes = {
61
+ command: _discordjs_builders.SlashCommandBuilder,
62
+ context_menu: _discordjs_builders.ContextMenuCommandBuilder,
63
+ subcommand: _discordjs_builders.SlashCommandSubcommandBuilder,
64
+ group: _discordjs_builders.SlashCommandSubcommandGroupBuilder,
65
+ embed: _discordjs_builders.EmbedBuilder,
66
+ modal: _discordjs_builders.ModalBuilder,
67
+ label: _discordjs_builders.LabelBuilder,
68
+ text_input: _discordjs_builders.TextInputBuilder,
69
+ file_upload: _discordjs_builders.FileUploadBuilder,
70
+ checkbox: _discordjs_builders.CheckboxBuilder,
71
+ checkbox_group: _discordjs_builders.CheckboxGroupBuilder,
72
+ checkbox_group_option: _discordjs_builders.CheckboxGroupOptionBuilder,
73
+ radio_group: _discordjs_builders.RadioGroupBuilder,
74
+ radio_group_option: _discordjs_builders.RadioGroupOptionBuilder,
75
+ button: _discordjs_builders.ButtonBuilder,
76
+ menu_string: _discordjs_builders.StringSelectMenuBuilder,
77
+ menu_option_string: _discordjs_builders.StringSelectMenuOptionBuilder,
78
+ menu_user: _discordjs_builders.UserSelectMenuBuilder,
79
+ menu_channel: _discordjs_builders.ChannelSelectMenuBuilder,
80
+ menu_mentionable: _discordjs_builders.MentionableSelectMenuBuilder,
81
+ menu_role: _discordjs_builders.RoleSelectMenuBuilder,
82
+ container: _discordjs_builders.ContainerBuilder,
83
+ text_display: _discordjs_builders.TextDisplayBuilder,
84
+ file: _discordjs_builders.FileBuilder,
85
+ media: _discordjs_builders.MediaGalleryBuilder,
86
+ section: _discordjs_builders.SectionBuilder,
87
+ separator: _discordjs_builders.SeparatorBuilder
88
+ };
89
+ /**
90
+ * Available Discord.js action row classes for use with RowComponent for Select Menus and Buttons
91
+ *
92
+ * @internal
93
+ */
94
+ const RowTypes = {
95
+ button: _discordjs_builders.ActionRowBuilder,
96
+ menu_string: _discordjs_builders.ActionRowBuilder,
97
+ menu_user: _discordjs_builders.ActionRowBuilder,
98
+ menu_channel: _discordjs_builders.ActionRowBuilder,
99
+ menu_mentionable: _discordjs_builders.ActionRowBuilder,
100
+ menu_role: _discordjs_builders.ActionRowBuilder
101
+ };
102
+
103
+ //#endregion
104
+ //#region src/components/colors.ts
105
+ const Colors = {
106
+ Aqua: 1752220,
107
+ Blue: 3447003,
108
+ Blurple: 5793266,
109
+ DarkAqua: 1146986,
110
+ DarkBlue: 2123412,
111
+ DarkButNotBlack: 2895667,
112
+ DarkerGrey: 8359053,
113
+ DarkGold: 12745742,
114
+ DarkGreen: 2067276,
115
+ DarkGrey: 9936031,
116
+ DarkNavy: 2899536,
117
+ DarkOrange: 11027200,
118
+ DarkPurple: 7419530,
119
+ DarkRed: 10038562,
120
+ DarkVividPink: 11342935,
121
+ Default: 0,
122
+ Fuchsia: 15418782,
123
+ Gold: 15844367,
124
+ Green: 5763719,
125
+ Grey: 9807270,
126
+ Greyple: 10070709,
127
+ LightGrey: 12370112,
128
+ LuminousVividPink: 15277667,
129
+ Navy: 3426654,
130
+ NotQuiteBlack: 2303786,
131
+ Orange: 15105570,
132
+ Purple: 10181046,
133
+ Red: 15548997,
134
+ White: 16777215,
135
+ Yellow: 16705372
136
+ };
137
+
138
+ //#endregion
139
+ //#region src/components/resolveColor.ts
140
+ const MAX_COLOR = 16777215;
141
+ const RED_SHIFT = 16;
142
+ const GREEN_SHIFT = 8;
143
+ const palette = Colors;
144
+ /**
145
+ * Resolves a {@link BotColor} to the integer Discord expects.
146
+ *
147
+ * Ported from discord.js (Apache-2.0), `resolveColor` in src/util/Util.js.
148
+ */
149
+ function resolveColor(color) {
150
+ let resolved;
151
+ if (typeof color === "string") {
152
+ if (color === "Random") return Math.floor(Math.random() * 16777216);
153
+ if (color === "Default") return 0;
154
+ if (/^#?[\da-f]{6}$/i.test(color)) return Number.parseInt(color.replace("#", ""), 16);
155
+ resolved = palette[color];
156
+ } else if (typeof color === "number") resolved = color;
157
+ else resolved = (color[0] << RED_SHIFT) + (color[1] << GREEN_SHIFT) + color[2];
158
+ if (resolved === void 0 || !Number.isSafeInteger(resolved)) throw new _seedcord_errors_internal.SeedcordTypeError(_seedcord_errors.SeedcordErrorCode.ColorUnresolvable, [JSON.stringify(color)]);
159
+ if (resolved < 0 || resolved > MAX_COLOR) throw new _seedcord_errors_internal.SeedcordRangeError(_seedcord_errors.SeedcordErrorCode.ColorOutOfRange);
160
+ return resolved;
161
+ }
162
+
163
+ //#endregion
164
+ //#region src/components/Component.ts
165
+ /**
166
+ * Base class for Discord component wrappers.
167
+ *
168
+ * @typeParam TComponent - The Discord.js component type being wrapped
169
+ *
170
+ * @internal
171
+ */
172
+ var BaseComponent = class {
173
+ _component;
174
+ constructor(ComponentClass) {
175
+ this._component = new ComponentClass();
176
+ }
177
+ /**
178
+ * The wrapped builder, for calling Discord.js methods like setTitle() and setDescription() inside a subclass.
179
+ *
180
+ * @example this.instance.setTitle('My Modal')
181
+ */
182
+ get instance() {
183
+ return this._component;
184
+ }
185
+ };
186
+ /**
187
+ * Base class for Discord.js builder components
188
+ *
189
+ * Wraps Discord.js builders (SlashCommandBuilder, EmbedBuilder, etc.) with
190
+ * Seedcord-specific defaults and helper methods.
191
+ *
192
+ * @typeParam BuilderKey - The type of Discord.js builder being wrapped
193
+ */
194
+ var BuilderComponent = class extends BaseComponent {
195
+ type;
196
+ colorApplied = false;
197
+ constructor(type) {
198
+ const ComponentClass = BuilderTypes[type];
199
+ super(ComponentClass);
200
+ this.type = type;
201
+ if (this.instance instanceof _discordjs_builders.SlashCommandBuilder || this.instance instanceof _discordjs_builders.ContextMenuCommandBuilder) this.instance.setContexts(discord_api_types_v10.InteractionContextType.Guild);
202
+ }
203
+ get component() {
204
+ this.applyBotColor();
205
+ return this.instance;
206
+ }
207
+ applyBotColor() {
208
+ if (this.colorApplied) return;
209
+ this.colorApplied = true;
210
+ const color = getBotColor();
211
+ if (this.instance instanceof _discordjs_builders.EmbedBuilder) {
212
+ if (this.instance.data.color === void 0) this.instance.setColor(resolveColor(color));
213
+ } else if (this.instance instanceof _discordjs_builders.ContainerBuilder) {
214
+ const accent = this.instance.data.accent_color;
215
+ if (accent === null || accent === void 0) this.instance.setAccentColor(color === "Default" ? void 0 : resolveColor(color));
216
+ }
217
+ }
218
+ };
219
+ /**
220
+ * Base class for Discord action row components
221
+ *
222
+ * Wraps Discord.js action row builder with Seedcord-specific defaults and helper methods.
223
+ *
224
+ * @typeParam RowKey - The Discord.js action row type being wrapped
225
+ */
226
+ var RowComponent = class extends BaseComponent {
227
+ type;
228
+ constructor(type) {
229
+ const ComponentClass = RowTypes[type];
230
+ super(ComponentClass);
231
+ this.type = type;
232
+ }
233
+ get component() {
234
+ return this.instance;
235
+ }
236
+ };
237
+
238
+ //#endregion
239
+ //#region src/reply/flags.ts
240
+ /** IsComponentsV2 is unconditional, every framework reply is v2. */
241
+ function sendFlags(opts) {
242
+ let flags = discord_api_types_v10.MessageFlags.IsComponentsV2;
243
+ if (opts?.ephemeral ?? true) flags |= discord_api_types_v10.MessageFlags.Ephemeral;
244
+ if (opts?.silent) flags |= discord_api_types_v10.MessageFlags.SuppressNotifications;
245
+ return flags;
246
+ }
247
+ /** A deferral carries no content, so only Ephemeral applies. */
248
+ function deferFlags(opts) {
249
+ return opts?.ephemeral ?? true ? discord_api_types_v10.MessageFlags.Ephemeral : 0;
250
+ }
251
+
252
+ //#endregion
253
+ //#region src/subscribers/publishDefault.ts
254
+ /**
255
+ * The key of the Bus method that emits the framework's own subscriptions. `publish` excludes these keys
256
+ * through `PublishableKey`, and this symbol is exported only from the internal entry.
257
+ *
258
+ * @internal
259
+ */
260
+ const PublishDefault = Symbol("seedcord.publishDefault");
261
+
262
+ //#endregion
263
+ Object.defineProperty(exports, 'BuilderComponent', {
264
+ enumerable: true,
265
+ get: function () {
266
+ return BuilderComponent;
267
+ }
268
+ });
269
+ Object.defineProperty(exports, 'CommandMetadataKey', {
270
+ enumerable: true,
271
+ get: function () {
272
+ return CommandMetadataKey;
273
+ }
274
+ });
275
+ Object.defineProperty(exports, 'EventMetadataKey', {
276
+ enumerable: true,
277
+ get: function () {
278
+ return EventMetadataKey;
279
+ }
280
+ });
281
+ Object.defineProperty(exports, 'GatedMetadataKey', {
282
+ enumerable: true,
283
+ get: function () {
284
+ return GatedMetadataKey;
285
+ }
286
+ });
287
+ Object.defineProperty(exports, 'InteractionMetadataKey', {
288
+ enumerable: true,
289
+ get: function () {
290
+ return InteractionMetadataKey;
291
+ }
292
+ });
293
+ Object.defineProperty(exports, 'InteractionRouteKeys', {
294
+ enumerable: true,
295
+ get: function () {
296
+ return InteractionRouteKeys;
297
+ }
298
+ });
299
+ Object.defineProperty(exports, 'InteractionRoutes', {
300
+ enumerable: true,
301
+ get: function () {
302
+ return InteractionRoutes;
303
+ }
304
+ });
305
+ Object.defineProperty(exports, 'MiddlewareMetadataKey', {
306
+ enumerable: true,
307
+ get: function () {
308
+ return MiddlewareMetadataKey;
309
+ }
310
+ });
311
+ Object.defineProperty(exports, 'PublishDefault', {
312
+ enumerable: true,
313
+ get: function () {
314
+ return PublishDefault;
315
+ }
316
+ });
317
+ Object.defineProperty(exports, 'RowComponent', {
318
+ enumerable: true,
319
+ get: function () {
320
+ return RowComponent;
321
+ }
322
+ });
323
+ Object.defineProperty(exports, 'SubscribeMetadataKey', {
324
+ enumerable: true,
325
+ get: function () {
326
+ return SubscribeMetadataKey;
327
+ }
328
+ });
329
+ Object.defineProperty(exports, 'WebhookUrlMetadataKey', {
330
+ enumerable: true,
331
+ get: function () {
332
+ return WebhookUrlMetadataKey;
333
+ }
334
+ });
335
+ Object.defineProperty(exports, 'deferFlags', {
336
+ enumerable: true,
337
+ get: function () {
338
+ return deferFlags;
339
+ }
340
+ });
341
+ Object.defineProperty(exports, 'sendFlags', {
342
+ enumerable: true,
343
+ get: function () {
344
+ return sendFlags;
345
+ }
346
+ });
347
+ Object.defineProperty(exports, 'setBotColor', {
348
+ enumerable: true,
349
+ get: function () {
350
+ return setBotColor;
351
+ }
352
+ });
353
+ //# sourceMappingURL=publishDefault-l0NQ-SHo.cjs.map