gralonium 0.4.1 → 0.5.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.
@@ -3,6 +3,8 @@ import { Context } from "./Context.js";
3
3
  import { CommandLocalizer, Loader, Plugin } from "./Loader.js";
4
4
  import { HelpCommand, HelpCommandOptions } from "./HelpCommand.js";
5
5
  import { Cooldowns } from "./Cooldowns.js";
6
+ import type { V2AdaptiveConfigureOptions } from "./views/V2Adaptive.js";
7
+ import { V2PersistentRouter, V2PersistentRouterOptions } from "./views/V2PersistentRouter.js";
6
8
 
7
9
  export interface GraloniumRestrictions {
8
10
  userIDs: Set<Snowflake>;
@@ -29,16 +31,20 @@ export interface GraloniumOptions extends ClientOptions {
29
31
  localizeCommand?: CommandLocalizer;
30
32
  beforeExecute?: (ctx: Context, command: any, options: any) => boolean | void | Promise<boolean | void>;
31
33
  afterExecute?: (ctx: Context, command: any, options: any) => void | Promise<void>;
34
+ v2Adaptive?: V2AdaptiveConfigureOptions;
32
35
  }
33
36
 
34
37
  export declare class Gralonium extends Client {
35
38
  cooldowns: Cooldowns;
36
39
  loader: Loader;
40
+ persistentRouters: Map<string, V2PersistentRouter>;
37
41
  ops: GraloniumOptions;
38
42
  constructor(options: GraloniumOptions);
39
43
  addGlobalPlugins(plugins: Plugin[]): this;
44
+ createPersistentRouter(namespace: string, options?: V2PersistentRouterOptions): V2PersistentRouter;
45
+ registerPersistentRouter(router: V2PersistentRouter): V2PersistentRouter;
40
46
  getContext(data: CommandInteraction | Message): Context;
41
- load(dir: string, reload?: boolean): Promise<import("./Loader.js").ModuleData<import("./builders/InteractionBuilder.js").InteractionBuilder | import("./builders/CommandBuilder.js").CommandBuilder | import("./builders/EventBuilder.js").EventBuilder | import("./builders/GroupBuilder.js").GroupBuilder, any[]>[]>;
47
+ load(dir: string, reload?: boolean): Promise<Array<import("./Loader.js").ModuleData<import("./builders/InteractionBuilder.js").InteractionBuilder | import("./builders/CommandBuilder.js").CommandBuilder | import("./builders/EventBuilder.js").EventBuilder | import("./builders/GroupBuilder.js").GroupBuilder | V2PersistentRouter, any[]> | V2PersistentRouter>>;
42
48
  sync(guildIDs?: string[]): Promise<Record<string, any>[]>;
43
49
  handleFrameworkError(error: unknown, ctx?: Context | null): void;
44
50
  login(token: string): Promise<string>;
@@ -7,6 +7,8 @@ const Context_js_1 = require("./Context.js");
7
7
  const Loader_js_1 = require("./Loader.js");
8
8
  const Cooldowns_js_1 = require("./Cooldowns.js");
9
9
  const Utils_js_1 = require("./Utils.js");
10
+ const V2Adaptive_js_1 = require("./views/V2Adaptive.js");
11
+ const V2PersistentRouter_js_1 = require("./views/V2PersistentRouter.js");
10
12
 
11
13
  class Gralonium extends discord_js_1.Client {
12
14
  static #processHandlersBound = false;
@@ -14,6 +16,7 @@ class Gralonium extends discord_js_1.Client {
14
16
 
15
17
  cooldowns = new Cooldowns_js_1.Cooldowns(this);
16
18
  loader = new Loader_js_1.Loader({ client: this });
19
+ persistentRouters = new Map();
17
20
  ops;
18
21
  #coreListenersBound = false;
19
22
 
@@ -35,6 +38,25 @@ class Gralonium extends discord_js_1.Client {
35
38
 
36
39
  if (this.ops.guildOnly === undefined) this.ops.guildOnly = true;
37
40
  if (typeof this.ops.debug !== "boolean") this.ops.debug = false;
41
+
42
+ V2Adaptive_js_1.ensureOverflowInteractionBridge(this);
43
+ if (this.ops.v2Adaptive && typeof this.ops.v2Adaptive === "object") {
44
+ V2Adaptive_js_1.V2Adaptive.configure(this.ops.v2Adaptive);
45
+ }
46
+ }
47
+
48
+ createPersistentRouter(namespace, routerOptions = {}) {
49
+ const router = V2PersistentRouter_js_1.createPersistentRouter(namespace, routerOptions);
50
+ this.persistentRouters.set(router.namespace, router);
51
+ return router;
52
+ }
53
+
54
+ registerPersistentRouter(router) {
55
+ if (!(router instanceof V2PersistentRouter_js_1.V2PersistentRouter)) {
56
+ throw new TypeError("[Gralonium] registerPersistentRouter() requires a V2PersistentRouter instance.");
57
+ }
58
+ this.persistentRouters.set(router.namespace, router);
59
+ return router;
38
60
  }
39
61
 
40
62
  addGlobalPlugins(plugins) {
@@ -6,6 +6,7 @@ const tslib_1 = require("tslib");
6
6
  const DJS = tslib_1.__importStar(require("discord.js"));
7
7
  const ComponentsV2Builder_js_1 = require("./builders/ComponentsV2Builder.js");
8
8
  const helpers_js_1 = require("./builders/components/helpers.js");
9
+ const V2Adaptive_js_1 = require("./views/V2Adaptive.js");
9
10
 
10
11
  class Context {
11
12
  bot;
@@ -269,6 +270,38 @@ class Context {
269
270
  return this.#sendWithOptionalRetry(() => this.data.deferReply(deferOptions));
270
271
  }
271
272
 
273
+ async #dispatchAdaptiveSend(payload, options, normalized, executorFn) {
274
+ try {
275
+ return await this.#sendWithOptionalRetry(() => executorFn(normalized));
276
+ } catch (error) {
277
+ const source =
278
+ V2Adaptive_js_1.V2Adaptive.extractOverflowSource(normalized) ||
279
+ V2Adaptive_js_1.V2Adaptive.extractOverflowSource(payload);
280
+
281
+ if (
282
+ !source ||
283
+ !source.usedNativeOverflow ||
284
+ !source.canFallback ||
285
+ !V2Adaptive_js_1.V2Adaptive.isOverflowRejectionError(error)
286
+ ) {
287
+ throw error;
288
+ }
289
+
290
+ V2Adaptive_js_1.V2Adaptive.markOverflowUnavailable();
291
+ const rebuilt = source.builder.toPayload({
292
+ ...(source.options || {}),
293
+ ...options,
294
+ forceOverflowFallback: true,
295
+ });
296
+
297
+ if (this.data instanceof DJS.Message) {
298
+ Context.#stripEphemeralForMessage(rebuilt);
299
+ }
300
+
301
+ return this.#sendWithOptionalRetry(() => executorFn(rebuilt));
302
+ }
303
+ }
304
+
272
305
  /**
273
306
  * Sends a reply in both prefix (`Message`) and slash/interaction modes.
274
307
  * Accepts strings, message option objects, or `ComponentsV2Builder` instances.
@@ -287,12 +320,17 @@ class Context {
287
320
 
288
321
  const hasPoll = Boolean(normalized && typeof normalized === "object" && normalized.poll !== undefined);
289
322
  if (thinkingWasV2 === isV2 && !hasPoll && typeof thinkingMsg.edit === "function") {
290
- const editData = normalized instanceof DJS.MessagePayload ? normalized : { ...normalized };
291
- if (editData && typeof editData === "object" && "reply" in editData) {
292
- delete editData.reply;
293
- }
323
+ const prepareEdit = (p) => {
324
+ const editData = p instanceof DJS.MessagePayload ? p : { ...p };
325
+ if (editData && typeof editData === "object" && "reply" in editData) {
326
+ delete editData.reply;
327
+ }
328
+ return editData;
329
+ };
294
330
  try {
295
- return await this.#sendWithOptionalRetry(() => thinkingMsg.edit(editData));
331
+ return await this.#dispatchAdaptiveSend(payload, options, normalized, (p) =>
332
+ thinkingMsg.edit(prepareEdit(p))
333
+ );
296
334
  } catch {
297
335
  // Fall through to sending a fresh message if placeholder can no longer be edited.
298
336
  }
@@ -303,20 +341,31 @@ class Context {
303
341
 
304
342
  const shouldReply = Boolean(options.reply ?? normalized?.reply ?? this.bot?.ops?.replyOnPrefix);
305
343
  if (shouldReply && !(normalized instanceof DJS.MessagePayload)) {
306
- if (!normalized.reply && this.data.id) {
307
- normalized.reply = { messageReference: this.data.id, failIfNotExists: false };
308
- }
309
- if (normalized.allowedMentions === undefined) {
310
- normalized.allowedMentions = { parse: [], repliedUser: false };
311
- }
344
+ const prepareReply = (p) => {
345
+ const out = { ...p };
346
+ if (!out.reply && this.data.id) {
347
+ out.reply = { messageReference: this.data.id, failIfNotExists: false };
348
+ }
349
+ if (out.allowedMentions === undefined) {
350
+ out.allowedMentions = { parse: [], repliedUser: false };
351
+ }
352
+ return out;
353
+ };
354
+
312
355
  if (typeof this.data.reply === "function" && !options.forceChannelSend) {
313
- const replyObj = { ...normalized };
314
- delete replyObj.reply;
315
- return this.#sendWithOptionalRetry(() => this.data.reply(replyObj));
356
+ return this.#dispatchAdaptiveSend(payload, options, normalized, (p) => {
357
+ const replyObj = prepareReply(p);
358
+ delete replyObj.reply;
359
+ return this.data.reply(replyObj);
360
+ });
316
361
  }
362
+
363
+ return this.#dispatchAdaptiveSend(payload, options, normalized, (p) =>
364
+ this.data.channel.send(prepareReply(p))
365
+ );
317
366
  }
318
367
 
319
- return this.#sendWithOptionalRetry(() => this.data.channel.send(normalized));
368
+ return this.#dispatchAdaptiveSend(payload, options, normalized, (p) => this.data.channel.send(p));
320
369
  }
321
370
 
322
371
  if (this.data.isAutocomplete?.()) {
@@ -329,17 +378,17 @@ class Context {
329
378
  if (this.data.deferred && !this.data.replied && typeof this.data.deleteReply === "function") {
330
379
  await this.data.deleteReply().catch(() => null);
331
380
  }
332
- return this.#sendWithOptionalRetry(() => this.data.followUp(normalized));
381
+ return this.#dispatchAdaptiveSend(payload, options, normalized, (p) => this.data.followUp(p));
333
382
  }
334
383
 
335
384
  if (options.followUp) {
336
- return this.#sendWithOptionalRetry(() => this.data.followUp(normalized));
385
+ return this.#dispatchAdaptiveSend(payload, options, normalized, (p) => this.data.followUp(p));
337
386
  }
338
387
 
339
- return this.#sendWithOptionalRetry(() => this.data.editReply(normalized));
388
+ return this.#dispatchAdaptiveSend(payload, options, normalized, (p) => this.data.editReply(p));
340
389
  }
341
390
 
342
- return this.#sendWithOptionalRetry(() => this.data.reply(normalized));
391
+ return this.#dispatchAdaptiveSend(payload, options, normalized, (p) => this.data.reply(p));
343
392
  }
344
393
 
345
394
  /**
@@ -7,9 +7,10 @@ import { GroupBuilder } from "./builders/GroupBuilder.js";
7
7
  import { Plugins as GraloniumPlugins } from "../main.js";
8
8
  import { Context } from "./Context.js";
9
9
  import { Gralonium } from "./Client.js";
10
+ import { V2PersistentRouter } from "./views/V2PersistentRouter.js";
10
11
 
11
12
  export interface ModuleData<T extends unknown = unknown, K extends any[] = any[]> {
12
- data: CommandBuilder | GroupBuilder | InteractionBuilder | EventBuilder;
13
+ data: CommandBuilder | GroupBuilder | InteractionBuilder | EventBuilder | V2PersistentRouter;
13
14
  plugins?: T extends CommandBuilder ? (typeof GraloniumPlugins[] | Plugin[]) : never;
14
15
  params?: T extends CommandBuilder ? ParamsBuilder : never;
15
16
  code?: T extends CommandBuilder
@@ -68,6 +69,7 @@ type InteractionTypes =
68
69
  | "chatInput"
69
70
  | "messageContextMenu"
70
71
  | "modalSubmit"
72
+ | "overflowMenu"
71
73
  | "userContextMenu"
72
74
  | "channelSelectMenu"
73
75
  | "roleSelectMenu"
@@ -90,7 +92,7 @@ export declare class Loader {
90
92
  rest: REST;
91
93
  constructor(options: LoaderOptions);
92
94
  setLocalizer(localizer: CommandLocalizer | null): this;
93
- load(dir: string, reload?: boolean): Promise<ModuleData<InteractionBuilder | CommandBuilder | EventBuilder | GroupBuilder, any[]>[]>;
95
+ load(dir: string, reload?: boolean): Promise<Array<ModuleData<InteractionBuilder | CommandBuilder | EventBuilder | GroupBuilder | V2PersistentRouter, any[]> | V2PersistentRouter>>;
94
96
  resolvePatternInteraction(type: InteractionTypes, key: string, interaction?: any): ModuleData<InteractionBuilder> | null;
95
97
  walkCommands(callable?: (command: Command<Types>) => number): CommandHelpingObject[];
96
98
  buildApplicationCommands(): Promise<Record<string, any>[]>;
@@ -12,6 +12,7 @@ const CommandBuilder_js_1 = require("./builders/CommandBuilder.js");
12
12
  const GroupBuilder_js_1 = require("./builders/GroupBuilder.js");
13
13
  const EventBuilder_js_1 = require("./builders/EventBuilder.js");
14
14
  const InteractionBuilder_js_1 = require("./builders/InteractionBuilder.js");
15
+ const V2PersistentRouter_js_1 = require("./views/V2PersistentRouter.js");
15
16
 
16
17
  const isValidFile = (file) => {
17
18
  if (file.endsWith(".d.ts")) return false;
@@ -32,6 +33,7 @@ class Loader {
32
33
  rest;
33
34
  #eventHandlers;
34
35
  #loadedSignature;
36
+ #loadedRouterNamespaces;
35
37
 
36
38
  constructor(options) {
37
39
  if (!(options?.client instanceof Client_js_1.Gralonium)) {
@@ -45,6 +47,7 @@ class Loader {
45
47
  button: new discord_js_1.Collection(),
46
48
  chatInput: new discord_js_1.Collection(),
47
49
  modalSubmit: new discord_js_1.Collection(),
50
+ overflowMenu: new discord_js_1.Collection(),
48
51
  userContextMenu: new discord_js_1.Collection(),
49
52
  messageContextMenu: new discord_js_1.Collection(),
50
53
  channelSelectMenu: new discord_js_1.Collection(),
@@ -60,6 +63,7 @@ class Loader {
60
63
  this.localizer = options.client?.ops?.localizeCommand ?? null;
61
64
  this.#eventHandlers = new Map();
62
65
  this.#loadedSignature = new Set();
66
+ this.#loadedRouterNamespaces = new Set();
63
67
  }
64
68
 
65
69
  /**
@@ -114,6 +118,9 @@ class Loader {
114
118
 
115
119
  #normalizeLoadedModule(item) {
116
120
  if (!item || typeof item !== "object") return null;
121
+ if (item instanceof V2PersistentRouter_js_1.V2PersistentRouter) {
122
+ return item;
123
+ }
117
124
  if (!item.data && typeof item.name === "string" && typeof item.code === "function") {
118
125
  return {
119
126
  data: new EventBuilder_js_1.EventBuilder({
@@ -128,7 +135,13 @@ class Loader {
128
135
  }
129
136
 
130
137
  #moduleSignature(moduleData) {
138
+ if (moduleData instanceof V2PersistentRouter_js_1.V2PersistentRouter) {
139
+ return `V2PersistentRouter:${moduleData.namespace}`;
140
+ }
131
141
  const data = moduleData?.data;
142
+ if (data instanceof V2PersistentRouter_js_1.V2PersistentRouter) {
143
+ return `V2PersistentRouter:${data.namespace}`;
144
+ }
132
145
  const type = data?.constructor?.name || "Unknown";
133
146
  if (data instanceof EventBuilder_js_1.EventBuilder) {
134
147
  return `${type}:${data.name}:${(0, crypto_1.randomUUID)()}`;
@@ -156,6 +169,13 @@ class Loader {
156
169
  }
157
170
 
158
171
  #assertValidModule(moduleData) {
172
+ if (
173
+ moduleData instanceof V2PersistentRouter_js_1.V2PersistentRouter ||
174
+ moduleData?.data instanceof V2PersistentRouter_js_1.V2PersistentRouter
175
+ ) {
176
+ return;
177
+ }
178
+
159
179
  if (!moduleData?.data) {
160
180
  throw new Error("Invalid module: missing data builder.");
161
181
  }
@@ -205,6 +225,11 @@ class Loader {
205
225
  for (const key of Object.keys(this.interactions)) {
206
226
  this.interactions[key].clear();
207
227
  }
228
+
229
+ for (const ns of this.#loadedRouterNamespaces) {
230
+ this.client?.persistentRouters?.delete?.(ns);
231
+ }
232
+ this.#loadedRouterNamespaces.clear();
208
233
  }
209
234
 
210
235
  #storeInteraction(moduleData) {
@@ -265,6 +290,21 @@ class Loader {
265
290
  this.#assertValidModule(moduleData);
266
291
  this.#assertUnique(moduleData);
267
292
 
293
+ if (
294
+ moduleData instanceof V2PersistentRouter_js_1.V2PersistentRouter ||
295
+ moduleData.data instanceof V2PersistentRouter_js_1.V2PersistentRouter
296
+ ) {
297
+ const router =
298
+ moduleData instanceof V2PersistentRouter_js_1.V2PersistentRouter ? moduleData : moduleData.data;
299
+ if (typeof this.client.registerPersistentRouter === "function") {
300
+ this.client.registerPersistentRouter(router);
301
+ } else {
302
+ this.client.persistentRouters?.set?.(router.namespace, router);
303
+ }
304
+ this.#loadedRouterNamespaces.add(router.namespace);
305
+ continue;
306
+ }
307
+
268
308
  if (moduleData.data instanceof EventBuilder_js_1.EventBuilder) {
269
309
  this.#attachEvent(moduleData);
270
310
  continue;
@@ -7,6 +7,7 @@ const types_1 = require("util/types");
7
7
  const DJS = tslib_1.__importStar(require("discord.js"));
8
8
  const Errors = tslib_1.__importStar(require("./Errors.js"));
9
9
  const Cooldowns_js_1 = require("./Cooldowns.js");
10
+ const V2Adaptive_js_1 = require("./views/V2Adaptive.js");
10
11
 
11
12
  class Utils {
12
13
  static noop(n = null) {
@@ -653,6 +654,7 @@ class Utils {
653
654
 
654
655
  static #extractInteractionLookup(interaction) {
655
656
  const checks = [
657
+ ["isOverflowMenu", "overflowMenu", "customId"],
656
658
  ["isAutocomplete", "autocomplete", "commandName"],
657
659
  ["isButton", "button", "customId"],
658
660
  ["isModalSubmit", "modalSubmit", "customId"],
@@ -677,11 +679,26 @@ class Utils {
677
679
  const target = Utils.#extractInteractionLookup(interaction);
678
680
  if (!target) return null;
679
681
 
680
- const bucket = bot.loader.interactions?.[target.typeKey];
681
- const exact = bucket?.get?.(target.key);
682
- if (exact) return exact;
682
+ const resolveBucket = (typeKey, lookupKey = target.key) => {
683
+ if (!lookupKey) return null;
684
+ const bucket = bot.loader.interactions?.[typeKey];
685
+ const exact = bucket?.get?.(lookupKey);
686
+ if (exact) return exact;
687
+ return bot.loader.resolvePatternInteraction?.(typeKey, lookupKey, interaction) || null;
688
+ };
689
+
690
+ const direct = resolveBucket(target.typeKey);
691
+ if (direct) return direct;
692
+
693
+ if (target.typeKey === "overflowMenu") {
694
+ if (interaction.overflowMenuCustomId && interaction.overflowMenuCustomId !== target.key) {
695
+ const parentMatch = resolveBucket("overflowMenu", interaction.overflowMenuCustomId);
696
+ if (parentMatch) return parentMatch;
697
+ }
698
+ return resolveBucket("button");
699
+ }
683
700
 
684
- return bot.loader.resolvePatternInteraction?.(target.typeKey, target.key, interaction) || null;
701
+ return null;
685
702
  }
686
703
 
687
704
  static async #executeInteractionModule(bot, interaction, moduleData) {
@@ -708,13 +725,14 @@ class Utils {
708
725
  }
709
726
  }
710
727
 
711
- static async handleInteraction(bot, interaction) {
712
- if (!interaction) return;
728
+ static async handleInteraction(bot, rawInteraction) {
729
+ if (!rawInteraction) return;
713
730
 
731
+ const interaction = V2Adaptive_js_1.unwrapOverflowFallbackInteraction(rawInteraction);
714
732
  const ctx = bot.getContext(interaction);
715
733
  Utils.#validateContextRestrictions(ctx);
716
734
 
717
- if (interaction.isChatInputCommand()) {
735
+ if (interaction.isChatInputCommand?.()) {
718
736
  const resolved = Utils.#findSlashCommand(bot, interaction);
719
737
  if (!resolved) return;
720
738
 
@@ -727,6 +745,18 @@ class Utils {
727
745
  return;
728
746
  }
729
747
 
748
+ if (bot.persistentRouters?.size && typeof interaction.customId === "string") {
749
+ for (const router of bot.persistentRouters.values()) {
750
+ if (router.matches(interaction.customId)) {
751
+ const handled = await router.handle(interaction, bot);
752
+ if (handled) {
753
+ await Utils.#runAnyInteractionHooks(bot, interaction);
754
+ return;
755
+ }
756
+ }
757
+ }
758
+ }
759
+
730
760
  const matched = Utils.#resolveInteractionModule(bot, interaction);
731
761
  if (matched) {
732
762
  await Utils.#executeInteractionModule(bot, interaction, matched);
@@ -19,9 +19,20 @@ import {
19
19
  ThumbnailBuilder,
20
20
  } from "discord.js";
21
21
  import type { DisableComponentsOptions, EmojiInput, ParsedEmoji } from "./components/helpers";
22
+ import type { V2LintOptions, V2LintResult } from "./components/linter";
23
+ import type {
24
+ MenuActionItemBuilder,
25
+ MenuActionItemStyle,
26
+ OverflowMenuBuilder,
27
+ OverflowMenuFallbackOptions,
28
+ OverflowMenuGroupBuilder,
29
+ OverflowMenuOptions,
30
+ OverflowMenuProxy,
31
+ } from "./components/overflow";
22
32
  import type { ButtonStyleInput } from "./components/StyleMapper";
23
33
  import type { V2CardOptions, V2ConfirmOptions, V2ImageViewOptions, V2ListOptions } from "./components/templates";
24
34
  import { V2Text, type V2FieldRow } from "./components/text";
35
+ import type { Context, ContextSendOptions } from "../Context";
25
36
 
26
37
  export type ButtonStyleResolvable =
27
38
  | "primary"
@@ -110,9 +121,21 @@ export interface V2SectionOptions extends V2TextOptions {
110
121
  thumbnailDescription?: string;
111
122
  thumbnailSpoiler?: boolean;
112
123
  button?: ButtonBuilder | V2ButtonObjectOptions;
124
+ overflow?: OverflowMenuBuilder | OverflowMenuOptions | ((menu: OverflowMenuProxy) => unknown);
125
+ overflowFallback?: "select" | "buttons" | "none" | false | OverflowMenuFallbackOptions;
126
+ overflowPlaceholder?: string;
127
+ placeholder?: string;
113
128
  fallbackToText?: boolean;
114
129
  }
115
130
 
131
+ export interface V2OverflowSectionOptions extends V2TextOptions {
132
+ customId?: string;
133
+ disabled?: boolean;
134
+ placeholder?: string;
135
+ overflowPlaceholder?: string;
136
+ overflowFallback?: "select" | "buttons" | "none" | false | OverflowMenuFallbackOptions;
137
+ }
138
+
116
139
  export interface V2GalleryItemObject {
117
140
  url: string;
118
141
  description?: string;
@@ -186,6 +209,15 @@ export interface V2PayloadOptions {
186
209
  safeMentions?: boolean;
187
210
  allowedMentions?: MessageMentionOptions;
188
211
  files?: BaseMessageOptions["files"];
212
+ forceOverflowFallback?: boolean;
213
+ forceNativeOverflow?: boolean;
214
+ validate?: boolean;
215
+ }
216
+
217
+ export interface V2BuildOptions {
218
+ forceOverflowFallback?: boolean;
219
+ forceNativeOverflow?: boolean;
220
+ validate?: boolean;
189
221
  }
190
222
 
191
223
  export interface V2BuiltPayload {
@@ -233,6 +265,11 @@ export declare class ComponentsV2Builder {
233
265
  static disableMessageComponents(message: Message, options?: DisableComponentsOptions): Promise<Message | null>;
234
266
  static countTextLength(components: any[]): number;
235
267
  static countComponents(components: any[]): number;
268
+ static lint(target: unknown, options?: V2LintOptions): V2LintResult;
269
+ static OverflowMenuBuilder: typeof OverflowMenuBuilder;
270
+ static OverflowMenuGroupBuilder: typeof OverflowMenuGroupBuilder;
271
+ static MenuActionItemBuilder: typeof MenuActionItemBuilder;
272
+ static MenuActionItemStyle: typeof MenuActionItemStyle;
236
273
  static isBuilder(value: unknown): value is ComponentsV2Builder;
237
274
 
238
275
  constructor(options?: ComponentsV2BuilderOptions);
@@ -252,8 +289,12 @@ export declare class ComponentsV2Builder {
252
289
 
253
290
  addSection(
254
291
  texts: string | TextDisplayBuilder | Array<string | TextDisplayBuilder | false | null | undefined>,
255
- accessoryOrOptions?: ThumbnailBuilder | ButtonBuilder | V2SectionOptions
292
+ accessoryOrOptions?: ThumbnailBuilder | ButtonBuilder | OverflowMenuBuilder | V2SectionOptions
256
293
  ): this;
294
+ addOverflowSection(
295
+ texts: string | TextDisplayBuilder | Array<string | TextDisplayBuilder | false | null | undefined>,
296
+ options?: V2OverflowSectionOptions
297
+ ): OverflowMenuProxy;
257
298
 
258
299
  addGallery(itemsOrUrl: V2GalleryInput, options?: V2GalleryOptions): this;
259
300
  addAttachment(source: Buffer | Uint8Array | string | AttachmentBuilder, options?: V2AttachmentOptions): this;
@@ -281,11 +322,15 @@ export declare class ComponentsV2Builder {
281
322
  readonly remainingChars: number;
282
323
  readonly componentCount: number;
283
324
  readonly remainingComponents: number;
325
+ readonly hasOverflowMenu: boolean;
284
326
  readonly files: AttachmentBuilder[];
285
327
 
286
- build(): TopLevelV2Component[];
287
- toJSON(): Record<string, unknown>[];
328
+ build(options?: V2BuildOptions): TopLevelV2Component[];
329
+ toJSON(options?: V2BuildOptions): Record<string, unknown>[];
330
+ lint(options?: V2LintOptions): V2LintResult;
288
331
  toPayload(options?: V2PayloadOptions): V2BuiltPayload;
332
+ send(target: Context | any, options?: V2PayloadOptions & ContextSendOptions): Promise<any>;
333
+ edit(target: Message | any, options?: V2PayloadOptions): Promise<any>;
289
334
 
290
335
  static card(options?: V2CardOptions): ComponentsV2Builder;
291
336
  static imageView(options?: V2ImageViewOptions): ComponentsV2Builder;