@spatulox/simplediscordbot 3.2.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,53 @@
1
1
  # Changelog
2
2
  Date format : dd/mm/yyyy
3
3
 
4
+ ### 29/09/2026 - 4.0.1
5
+ - Fix :
6
+ - `BotEnv.dev` follows the same rule as the `dim` CLI (`@spatulox/discord-interaction-manager`) : only `DISCORD_BOT_DEV=true` or `1` enable the dev mode. Other values (`yes`, `dev`...) enabled it on the bot but not in `dim`, so the bot loaded the `_dev` interactions while `dim` deployed the prod ones
7
+
8
+ ### 29/09/26 - 4.0.0
9
+ - Breaking :
10
+ - `GuildManager.searchMember()`, `GuildManager.isMemberInGuild()` and `GuildUserManager.isInVoice()` now take `(guildId, memberId)` like every other member method
11
+ - `toInteractionEdit()` is removed from `EmbedManager`, `ComponentManager`, `ButtonManager` and `SelectMenuManager` : use `toInteractionUpdate()`, same parameters, it works with `interaction.editReply()` and `interaction.update()`
12
+ - `ButtonManager.toMessage/toInteraction/toInteractionUpdate([...buttons])` group the buttons by 5 per row instead of one row per button
13
+ - `GuildManager.channel.text.find()` / `voice.find()` only return a `TextChannel` / `VoiceChannel`
14
+ - `GuildChannelManager.delete()` returns `false` on failure instead of throwing
15
+ - `DISCORD_BOT_DEV=false` (or `0`, `no`, `off`, empty) no longer enables the dev mode
16
+ - `Bot._client` is private (use `Bot.client`)
17
+ - Add :
18
+ - `PaginationManager` is exported : `PaginationManager.send(interaction, pages, options)`
19
+ - `Bot.interaction.*` accept a plain string and arrays of components, `Bot.interaction.defer(interaction, ephemeral)`
20
+ - `Bot.message.send/sendDM`, `Bot.log.*` and `WebhookManager.send` accept arrays of components
21
+ - `ComponentManager.toInteraction(container, file, footer, ephemeral)`
22
+ - `toInteractionUpdate()` on `EmbedManager`, `ComponentManager`, `ButtonManager` and `SelectMenuManager`, for `interaction.update()` and `interaction.editReply()`
23
+ - `toMessageUpdate()` on the same managers, for `message.edit()`
24
+ - Every `toXXXUpdate()` (`toInteractionUpdate()`, `toMessageUpdate()`) returns the exported `UpdateOptions` type (`InteractionUpdateOptions & InteractionEditReplyOptions & MessageEditOptions`) : the result fits `interaction.update()`, `interaction.editReply()` and `message.edit()`
25
+ - `ModalManager.date()` / `number()` / `phone()` take a `suffix` parameter (default `true`) : `false` keeps the given customId for the modal instead of suffixing it with `_date` / `_number` / `_phone_number`, the input is then `${customId}_input`
26
+ - `SelectMenuManager.option()` is public : builds one option or an array of options
27
+ - `ModalField.customId`, `InviteManager.find(code)`, `InviteManager.delete(code)`, `InviteManager.isOld()` / `InviteManager.cleanup()`, `Bot.stopRandomActivity()`, `bot.started`
28
+ - `DiscordRegex.SNOWFLAKE` / `DiscordRegex.DISCORD_URL`, `SendableComponent` / `ConfigLog` types are exported
29
+ - Unit tests (`npm test`), run by `npm run build`
30
+ - Fix :
31
+ - Components V2 : the flag was missing on interactions, arrays and edits, content + container was rejected by Discord (the content now becomes a TextDisplay)
32
+ - `GuildUserManager.timeout()` passed a timestamp instead of a duration
33
+ - `RoleManager.toggle()` could never add a role, roles whose name is 18 characters long couldn't be found
34
+ - `WebhookManager` reused the first channel's webhook for every channel
35
+ - `ThreadChannelManager.createFromMessage()` always failed, `createFromChannel()` crashed on voice channels
36
+ - `GuildManager.searchMember()` / `isMemberInGuild()` passed wrong arguments
37
+ - `UserManager.send()` with an array of components
38
+ - `Bot.interaction.followUp()` returned false for commands and modals, `Bot.interaction.update()` failed after `defer()`
39
+ - `ComponentManager.create()` ignored description / separator without title, `toMessage()` & co stacked footers on the same container
40
+ - `SimpleColor.black` as `defaultSimpleColor`, crashes when using `EmbedManager` / `Bot.log` before the Bot is instantiated
41
+ - `Bot.message.success/error` printed the message twice, `Bot.message.send(channelId)` only looked in the cache
42
+ - `ModalManager.titleDescription()` ignored prefilled values, `parseDate()` accepted `31/02`
43
+ - `ButtonManager.toMessage()` & co refused an array mixing rows and buttons at the type level (it already worked at runtime) : they take the exported `ButtonInput` type
44
+ - `DiscordRegex` : 17 to 20 digits ids, invites, `isDiscordUrl()`, usernames with dots, every unicode emoji
45
+ - `ReactionManager.remove()` with custom emojis, DMs support
46
+ - `GuildUserManager.rename()` retried on permission errors, error logs of `mute()` and member lookups
47
+ - `Bot` startup (ClientReady registered after login, unhandled errors, double login), `setRandomActivity()` stacking intervals
48
+ - Package : ESM consumers got the CommonJS build, `@discordjs/builders` was used without being a dependency, internal files and the whole package.json were published
49
+ - Removed : `InviteManager_old`, `FolderName`, `@types/node-schedule`, dead code
50
+
4
51
  ### 25/09/2026 - 3.2.0
5
52
  - Bump discord-interaction-manager (add a web interface)
6
53
 
package/dist/index.d.mts CHANGED
@@ -1,9 +1,14 @@
1
- import { EmbedBuilder, ContainerBuilder, ActionRowBuilder, MessageActionRowComponentBuilder, Message, TextChannel, DMChannel, ThreadChannel, MessageCreateOptions, User, GuildMember, BaseInteraction, InteractionResponse, Client, ActivityType, InteractionDeferReplyOptions, InteractionReplyOptions, InteractionEditReplyOptions, Snowflake, WebhookMessageCreateOptions, EmojiResolvable, Guild, BanOptions, GuildBasedChannel, GuildChannelCreateOptions, ForumChannel, NewsChannel, StageChannel, StartThreadOptions, VoiceChannel, Invite, Channel, Collection, GuildBan, ModalBuilder, StringSelectMenuBuilder, UserSelectMenuBuilder, RoleSelectMenuBuilder, MentionableSelectMenuBuilder, ChannelSelectMenuBuilder, ChannelType, SeparatorSpacingSize, ButtonBuilder, TextDisplayBuilder, AttachmentBuilder, ButtonStyle } from 'discord.js';
2
- import { BaseSelectMenuBuilder } from '@discordjs/builders';
1
+ import { EmbedBuilder, ContainerBuilder, BaseSelectMenuBuilder, ActionRowBuilder, MessageActionRowComponentBuilder, InteractionUpdateOptions, InteractionEditReplyOptions, MessageEditOptions, Message, TextChannel, DMChannel, ThreadChannel, MessageCreateOptions, User, GuildMember, BaseInteraction, InteractionResponse, Client, ActivityType, InteractionDeferReplyOptions, InteractionReplyOptions, Snowflake, WebhookMessageCreateOptions, EmojiResolvable, Guild, BanOptions, GuildBasedChannel, GuildChannelCreateOptions, ForumChannel, NewsChannel, StageChannel, StartThreadOptions, VoiceChannel, Invite, Channel, Collection, GuildBan, ModalBuilder, StringSelectMenuBuilder, UserSelectMenuBuilder, RoleSelectMenuBuilder, MentionableSelectMenuBuilder, ChannelSelectMenuBuilder, ChannelType, StringSelectMenuOptionBuilder, SeparatorSpacingSize, ButtonBuilder, TextDisplayBuilder, AttachmentBuilder, ButtonStyle, RepliableInteraction, InteractionCollector, ButtonInteraction } from 'discord.js';
3
2
  export { CacheManager, FileManager, Log, SimpleMutex, Time } from '@spatulox/utils';
4
3
 
5
4
  type SendableComponent = EmbedBuilder | ContainerBuilder | BaseSelectMenuBuilder<any> | ActionRowBuilder<MessageActionRowComponentBuilder>;
5
+ /**
6
+ * Options accepted by interaction.update(), interaction.editReply() and message.edit(),
7
+ * returned by every toXXXUpdate() helper (toInteractionUpdate(), toMessageUpdate())
8
+ */
9
+ type UpdateOptions = InteractionUpdateOptions & InteractionEditReplyOptions & MessageEditOptions;
6
10
 
11
+ type LogContent = string | SendableComponent | SendableComponent[];
7
12
  type PreciseLogConfig = {
8
13
  channelId: string;
9
14
  console: boolean;
@@ -20,7 +25,6 @@ declare class BotLog {
20
25
  private static warnChannel;
21
26
  private static debugChannel;
22
27
  private static errorChannel;
23
- constructor();
24
28
  static config(): ConfigLog | undefined;
25
29
  /**
26
30
  * Initialize Discord logging channels and update Bot.log references
@@ -30,33 +34,38 @@ declare class BotLog {
30
34
  * Send content to specific Discord channel
31
35
  */
32
36
  private static _sendToChannel;
37
+ /**
38
+ * Text printed in the console : the string itself, or the description / title of an embed
39
+ */
40
+ private static _consoleText;
33
41
  /**
34
42
  * Send INFO log - TEXT or EMBED ! Respecte config.log.info
35
43
  */
36
- static info(content: string | SendableComponent): Promise<Message | void>;
44
+ static info(content: LogContent): Promise<Message | void>;
37
45
  /**
38
46
  * Send ERROR log - TEXT or EMBED ! Respecte config.log.error
39
47
  */
40
- static error(content: string | SendableComponent): Promise<Message | void>;
48
+ static error(content: LogContent): Promise<Message | void>;
41
49
  /**
42
50
  * Send WARNING log - TEXT or EMBED ! Respecte config.log.warn
43
51
  */
44
- static warn(content: string | SendableComponent): Promise<Message | void>;
52
+ static warn(content: LogContent): Promise<Message | void>;
45
53
  /**
46
54
  * Send DEBUG log - TEXT or EMBED ! Respecte config.log.debug
47
55
  */
48
- static debug(content: string | SendableComponent): Promise<Message | void>;
56
+ static debug(content: LogContent): Promise<Message | void>;
49
57
  }
50
58
 
51
59
  declare class BotMessage {
52
60
  /**
53
61
  * Send message to any text-based channel
54
62
  */
55
- static send(channel: TextChannel | DMChannel | ThreadChannel | string, content?: string | null, component?: SendableComponent): Promise<Message | null>;
56
- static send(channel: TextChannel | DMChannel | ThreadChannel | string, content: SendableComponent): Promise<Message | null>;
63
+ static send(channel: TextChannel | DMChannel | ThreadChannel | string, content?: string | null, component?: SendableComponent | SendableComponent[]): Promise<Message | null>;
64
+ static send(channel: TextChannel | DMChannel | ThreadChannel | string, content: SendableComponent | SendableComponent[]): Promise<Message | null>;
57
65
  static send(channel: TextChannel | DMChannel | ThreadChannel | string, content: MessageCreateOptions): Promise<Message | null>;
58
- static sendDM(userOrId: User | GuildMember | string, content: string, component: SendableComponent): Promise<Message | null>;
59
- static sendDM(userOrId: User | GuildMember | string, content: string | SendableComponent | MessageCreateOptions): Promise<Message | null>;
66
+ private static buildPayload;
67
+ static sendDM(userOrId: User | GuildMember | string, content: string, component: SendableComponent | SendableComponent[]): Promise<Message | null>;
68
+ static sendDM(userOrId: User | GuildMember | string, content: string | SendableComponent | SendableComponent[] | MessageCreateOptions): Promise<Message | null>;
60
69
  /**
61
70
  * Quick success message
62
71
  */
@@ -67,6 +76,8 @@ declare class BotMessage {
67
76
  static error(channel: TextChannel | DMChannel | ThreadChannel | User | GuildMember, message: string): Promise<Message | null>;
68
77
  }
69
78
 
79
+ type InteractionComponent = SendableComponent | SendableComponent[];
80
+ type InteractionResult = Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
70
81
  declare class BotInteraction {
71
82
  /**
72
83
  * InteractionReplyOptions && InteractionUpdateOptions
@@ -74,16 +85,30 @@ declare class BotInteraction {
74
85
  */
75
86
  private static buildReplyOptions;
76
87
  private static buildUpdateOptions;
77
- private static _buildOptions;
78
- static send(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
79
- static send(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
80
- static reply(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
81
- static reply(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
82
- static followUp(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
83
- static followUp(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
84
- static defer(interaction: BaseInteraction): Promise<InteractionResponse<boolean> | void>;
85
- static update(interaction: BaseInteraction, content: SendableComponent): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
86
- static update(interaction: BaseInteraction, content: string, component: SendableComponent): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
88
+ /**
89
+ * Normalize the (content, component, ephemeral) overloads :
90
+ * (string, ephemeral?) | (component, ephemeral?) | (string, component, ephemeral?)
91
+ */
92
+ private static resolveArgs;
93
+ /**
94
+ * Reply, or followUp if the interaction is already acknowledged
95
+ */
96
+ static send(interaction: BaseInteraction, content: string, ephemeral?: boolean): InteractionResult;
97
+ static send(interaction: BaseInteraction, content: InteractionComponent, ephemeral?: boolean): InteractionResult;
98
+ static send(interaction: BaseInteraction, content: string, component: InteractionComponent, ephemeral?: boolean): InteractionResult;
99
+ static reply(interaction: BaseInteraction, content: string, ephemeral?: boolean): InteractionResult;
100
+ static reply(interaction: BaseInteraction, content: InteractionComponent, ephemeral?: boolean): InteractionResult;
101
+ static reply(interaction: BaseInteraction, content: string, component: InteractionComponent, ephemeral?: boolean): InteractionResult;
102
+ static followUp(interaction: BaseInteraction, content: string, ephemeral?: boolean): InteractionResult;
103
+ static followUp(interaction: BaseInteraction, content: InteractionComponent, ephemeral?: boolean): InteractionResult;
104
+ static followUp(interaction: BaseInteraction, content: string, component: InteractionComponent, ephemeral?: boolean): InteractionResult;
105
+ /**
106
+ * @param ephemeral Only used by commands : components and modals defer the message they come from
107
+ */
108
+ static defer(interaction: BaseInteraction, ephemeral?: boolean): Promise<InteractionResponse<boolean> | void>;
109
+ static update(interaction: BaseInteraction, content: string): InteractionResult;
110
+ static update(interaction: BaseInteraction, content: InteractionComponent): InteractionResult;
111
+ static update(interaction: BaseInteraction, content: string, component: InteractionComponent): InteractionResult;
87
112
  }
88
113
 
89
114
  declare enum SimpleColor {
@@ -131,7 +156,6 @@ type BotConfig = {
131
156
  botName?: string;
132
157
  log?: ConfigLog;
133
158
  };
134
- type InternalBotConfig = {} & BotConfig;
135
159
  type RandomBotActivity = {
136
160
  type: ActivityType;
137
161
  message: string;
@@ -140,17 +164,26 @@ declare class Bot {
140
164
  static readonly log: typeof BotLog;
141
165
  static readonly message: typeof BotMessage;
142
166
  static readonly interaction: typeof BotInteraction;
143
- static _client: Client;
144
- private static criticConfig;
167
+ private static _client;
168
+ private static token;
145
169
  private static _config;
146
- get config(): InternalBotConfig;
170
+ private static randomActivityInterval;
171
+ get config(): BotConfig;
147
172
  get client(): Client;
148
173
  static get client(): Client;
149
- static get config(): InternalBotConfig;
174
+ static get config(): BotConfig;
175
+ /**
176
+ * Resolves once the login is done (true) or has definitively failed (false)
177
+ */
178
+ readonly started: Promise<boolean>;
150
179
  constructor(client: Client, config?: BotConfig);
151
180
  login(maxTries?: number): Promise<boolean>;
152
181
  static setActivity(message: string, type: ActivityType): void;
153
182
  static setRandomActivity(randomActivity: RandomBotActivity, intervalMs?: number | null): void;
183
+ /**
184
+ * Stop the rotation started by setRandomActivity(), the current activity is kept
185
+ */
186
+ static stopRandomActivity(): void;
154
187
  }
155
188
 
156
189
  declare const BotEnv: {
@@ -207,9 +240,13 @@ declare class EmbedManager {
207
240
  */
208
241
  static toInteraction(embed: EmbedBuilder, ephemeral?: boolean): InteractionReplyOptions;
209
242
  /**
210
- * Transform embed into objet for interaction.editReply()
243
+ * Options to edit an existing message : message.edit()
211
244
  */
212
- static toInteractionEdit(embed: EmbedBuilder): InteractionEditReplyOptions;
245
+ static toMessageUpdate(embed: EmbedBuilder): UpdateOptions;
246
+ /**
247
+ * Options for interaction.update() and interaction.editReply() (buttons, select menus, modals, deferred replies)
248
+ */
249
+ static toInteractionUpdate(embed: EmbedBuilder): UpdateOptions;
213
250
  /**
214
251
  * Transform embed into objet to send a message
215
252
  */
@@ -220,7 +257,8 @@ declare class WebhookManager {
220
257
  private readonly client;
221
258
  private readonly name;
222
259
  private readonly avatarPathOrUrl?;
223
- private webhook;
260
+ /** One webhook per channel id (the parent channel id for threads) */
261
+ private readonly webhooks;
224
262
  constructor(client: Client, name: string, avatarPathOrUrl?: string | undefined);
225
263
  private getAvatar;
226
264
  /**
@@ -228,7 +266,11 @@ declare class WebhookManager {
228
266
  */
229
267
  private getChannel;
230
268
  /**
231
- * Get or create webhook (lazy initialization)
269
+ * Channel owning the webhook : the parent channel when targeting a thread
270
+ */
271
+ private getWebhookChannel;
272
+ /**
273
+ * Get or create webhook (lazy initialization, cached per channel)
232
274
  * Create the webhook in the parent channel if it's in a thread
233
275
  */
234
276
  private getWebhook;
@@ -236,7 +278,7 @@ declare class WebhookManager {
236
278
  * Send message/text/component !
237
279
  */
238
280
  send(channelId: Snowflake, content: string): Promise<Message | null>;
239
- send(channelId: Snowflake, content: SendableComponent): Promise<Message | null>;
281
+ send(channelId: Snowflake, content: SendableComponent | SendableComponent[]): Promise<Message | null>;
240
282
  send(channelId: Snowflake, content: WebhookMessageCreateOptions): Promise<Message | null>;
241
283
  /**
242
284
  * Quick success embed
@@ -253,6 +295,10 @@ declare class WebhookManager {
253
295
  }
254
296
 
255
297
  declare class ReactionManager {
298
+ /**
299
+ * Any text based channel : guild channels, threads and DMs
300
+ */
301
+ private static fetchMessage;
256
302
  /**
257
303
  * Add a reaction to a message
258
304
  */
@@ -315,7 +361,7 @@ declare class GuildUserManager extends BasicUserManager {
315
361
  /**
316
362
  * Check if a member is in voice
317
363
  */
318
- static isInVoice(memberId: string, guildId: string): Promise<boolean>;
364
+ static isInVoice(guildId: string, memberId: string): Promise<boolean>;
319
365
  /**
320
366
  * Mute a member
321
367
  */
@@ -369,15 +415,24 @@ declare class RoleManager {
369
415
  * Check if member has role
370
416
  */
371
417
  static hasRole(member: GuildMember, roleIdOrName: Snowflake | string): boolean;
418
+ /**
419
+ * Search by id first, then by name (case insensitive). Snowflakes are 17 to 20 digits long,
420
+ * so the length of the string can't tell an id from a name
421
+ */
422
+ private static resolve;
372
423
  }
373
424
 
374
425
  declare class GuildMessageManager {
426
+ /**
427
+ * Any guild channel able to hold messages : text, announcement, thread, voice / stage text chat
428
+ */
429
+ private static findTextBased;
375
430
  /**
376
431
  * Overloads for send
377
432
  */
378
- static send(channelId: string, content: string): Promise<Message>;
379
- static send(channelId: string, component: SendableComponent | SendableComponent[]): Promise<Message>;
380
- static send(channelId: string, options: MessageCreateOptions): Promise<Message>;
433
+ static send(channelId: string, content: string): Promise<Message | null>;
434
+ static send(channelId: string, component: SendableComponent | SendableComponent[]): Promise<Message | null>;
435
+ static send(channelId: string, options: MessageCreateOptions): Promise<Message | null>;
381
436
  /**
382
437
  * Delete message
383
438
  */
@@ -442,9 +497,9 @@ declare class ThreadChannelManager {
442
497
  static findAll(guildId: string): ThreadChannel[];
443
498
  static createFromChannel(parentId: string, options: StartThreadOptions): Promise<ThreadChannel>;
444
499
  static createFromMessage(message: Message, options: StartThreadOptions): Promise<ThreadChannel>;
445
- static send(channelId: string, content: string): Promise<Message>;
446
- static send(channelId: string, component: SendableComponent | SendableComponent[]): Promise<Message>;
447
- static send(channelId: string, options: MessageCreateOptions): Promise<Message>;
500
+ static send(channelId: string, content: string): Promise<Message | null>;
501
+ static send(channelId: string, component: SendableComponent | SendableComponent[]): Promise<Message | null>;
502
+ static send(channelId: string, options: MessageCreateOptions): Promise<Message | null>;
448
503
  }
449
504
 
450
505
  declare class GuildVoiceChannelManager extends GuildChannelManager {
@@ -475,13 +530,27 @@ declare class InviteManager {
475
530
  temporary?: boolean;
476
531
  }): Promise<Invite>;
477
532
  /**
478
- * Delete an invitation
533
+ * Find an invite by its code or its url (discord.gg/code, discord.com/invite/code)
534
+ */
535
+ static find(codeOrUrl: string): Promise<Invite | null>;
536
+ /**
537
+ * Delete an invitation, from the invite itself or its code / url
479
538
  */
480
539
  static delete(invite: Invite): Promise<boolean>;
540
+ static delete(codeOrUrl: string): Promise<boolean>;
481
541
  /**
482
542
  * List every invitation from a guild
483
543
  */
484
544
  static list(guildId: string): Promise<Invite[]>;
545
+ /**
546
+ * Check if an invite is older than maxAgeMs (default 1 hour).
547
+ * Permanent invites (maxAge = 0) and excluded codes are never considered old
548
+ */
549
+ static isOld(invite: Invite, excludedCodes?: string[], maxAgeMs?: number): boolean;
550
+ /**
551
+ * Delete every old invite of a guild, returns the number of deleted invites
552
+ */
553
+ static cleanup(guildId: string, excludedCodes?: string[], maxAgeMs?: number): Promise<number>;
485
554
  }
486
555
 
487
556
  declare class GuildManager {
@@ -498,11 +567,11 @@ declare class GuildManager {
498
567
  /**
499
568
  * Search guild member by ID
500
569
  */
501
- static searchMember(memberId: string, guildId: string): Promise<GuildMember | null>;
570
+ static searchMember(guildId: string, memberId: string): Promise<GuildMember | null>;
502
571
  /**
503
572
  * Check if member is still in guild
504
573
  */
505
- static isMemberInGuild(memberId: string, guildId: string): Promise<boolean>;
574
+ static isMemberInGuild(guildId: string, memberId: string): Promise<boolean>;
506
575
  /**
507
576
  * Fetch all members with retry (heavy operation)
508
577
  */
@@ -524,6 +593,8 @@ declare enum ModalFieldType {
524
593
  }
525
594
  interface BaseModalField {
526
595
  label: string;
596
+ /** Custom id of the input, default `${modalCustomId}_${label}` (add()) or `${modalCustomId}_input` (simple()) */
597
+ customId?: string;
527
598
  value?: string;
528
599
  required?: boolean;
529
600
  }
@@ -554,16 +625,20 @@ declare class ModalManager {
554
625
  static titleDescription(customId: string, modalTitle: string, title: Omit<TextModalField, "type">, description: Omit<TextModalField, "type">): ModalBuilder;
555
626
  /**
556
627
  * Date modal preset
628
+ * @param suffix true (default) : the modal customId is `${customId}_date` and the input `${customId}_date_input`,
629
+ * false : the modal keeps `customId` and the input is `${customId}_input`. Same for number() (_number) and phone() (_phone_number)
557
630
  */
558
- static date(customId: string, modalTitle?: string, inputLabel?: string): ModalBuilder;
631
+ static date(customId: string, modalTitle?: string, inputLabel?: string, suffix?: boolean): ModalBuilder;
559
632
  /**
560
633
  * Number modal preset
634
+ * @param suffix See date() : `${customId}_number` by default, `customId` when false
561
635
  */
562
- static number(customId: string, modalTitle?: string, inputLabel?: string): ModalBuilder;
636
+ static number(customId: string, modalTitle?: string, inputLabel?: string, suffix?: boolean): ModalBuilder;
563
637
  /**
564
- * Number modal preset
638
+ * Phone modal preset
639
+ * @param suffix See date() : `${customId}_phone_number` by default, `customId` when false
565
640
  */
566
- static phone(customId: string, modalTitle?: string, inputLabel?: string): ModalBuilder;
641
+ static phone(customId: string, modalTitle?: string, inputLabel?: string, suffix?: boolean): ModalBuilder;
567
642
  /**
568
643
  * Add field to existing modal (Fluent API)
569
644
  */
@@ -576,6 +651,10 @@ declare class ModalManager {
576
651
  * @param value
577
652
  */
578
653
  static parseDate(value: string): Date | null;
654
+ /**
655
+ * new Date() silently rolls an impossible date over (31/02 becomes 02/03) : reject any date that doesn't round-trip
656
+ */
657
+ private static buildDate;
579
658
  }
580
659
 
581
660
  type SelectMenuCreateOption = {
@@ -616,9 +695,11 @@ declare class SelectMenuManager {
616
695
  */
617
696
  static channels(customId: string, placeholder?: string, channelTypes?: ChannelType[]): ChannelSelectMenuBuilder;
618
697
  /**
619
- * Quick option creator
698
+ * Quick option creator : one option, or several at once
699
+ * `menu.addOptions(SelectMenuManager.option([{label: "A", value: "a"}, {label: "B", value: "b"}]))`
620
700
  */
621
- private static option;
701
+ static option(option: SelectMenuCreateOption): StringSelectMenuOptionBuilder;
702
+ static option(options: SelectMenuCreateOption[]): StringSelectMenuOptionBuilder[];
622
703
  private static _createOption;
623
704
  /**
624
705
  * Fluent API pour personnaliser
@@ -636,7 +717,14 @@ declare class SelectMenuManager {
636
717
  static rows(...components: MessageActionRowComponentBuilder[]): ActionRowBuilder<MessageActionRowComponentBuilder>[];
637
718
  static toMessage(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[]): MessageCreateOptions;
638
719
  static toInteraction(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[], ephemeral?: boolean): InteractionReplyOptions;
639
- static toInteractionEdit(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[]): InteractionEditReplyOptions;
720
+ /**
721
+ * Options to edit an existing message : message.edit()
722
+ */
723
+ static toMessageUpdate(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[]): UpdateOptions;
724
+ /**
725
+ * Options for interaction.update() and interaction.editReply() (buttons, select menus, modals, deferred replies)
726
+ */
727
+ static toInteractionUpdate(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[]): UpdateOptions;
640
728
  private static _createRowsToReturn;
641
729
  }
642
730
 
@@ -733,6 +821,10 @@ declare class ComponentManager {
733
821
  container: ContainerBuilder;
734
822
  files: AttachmentBuilder[];
735
823
  };
824
+ /**
825
+ * Returns a copy with the footer, so calling toMessage() / toInteraction() twice on the same
826
+ * container doesn't stack footers
827
+ */
736
828
  private static footer;
737
829
  /**
738
830
  * Transform ComponentV2 into object for channel.send()
@@ -741,8 +833,15 @@ declare class ComponentManager {
741
833
  * @param footer Sometimes you don't want to have the Bot name neither the timestamp...
742
834
  */
743
835
  static toMessage(container: ContainerBuilder, file?: AttachmentBuilder | AttachmentBuilder[] | null, footer?: boolean): MessageCreateOptions;
744
- static toInteraction(container: ContainerBuilder, file?: AttachmentBuilder | AttachmentBuilder[] | null, footer?: boolean): InteractionReplyOptions;
745
- static toInteractionEdit(container: ContainerBuilder, file?: AttachmentBuilder | AttachmentBuilder[] | null, footer?: boolean): InteractionEditReplyOptions;
836
+ static toInteraction(container: ContainerBuilder, file?: AttachmentBuilder | AttachmentBuilder[] | null, footer?: boolean, ephemeral?: boolean): InteractionReplyOptions;
837
+ /**
838
+ * Options to edit an existing message : message.edit(). The Components V2 flag is set, so a legacy message can be turned into a V2 one
839
+ */
840
+ static toMessageUpdate(container: ContainerBuilder, file?: AttachmentBuilder | AttachmentBuilder[] | null, footer?: boolean): UpdateOptions;
841
+ /**
842
+ * Options for interaction.update() and interaction.editReply() (buttons, select menus, modals, deferred replies), with the Components V2 flag
843
+ */
844
+ static toInteractionUpdate(container: ContainerBuilder, file?: AttachmentBuilder | AttachmentBuilder[] | null, footer?: boolean): UpdateOptions;
746
845
  }
747
846
 
748
847
  interface ProgressBarOptions {
@@ -845,6 +944,8 @@ interface ButtonOptions {
845
944
  customId: string;
846
945
  disabled?: boolean;
847
946
  }
947
+ /** One button, one row, or an array mixing buttons and rows (consecutive buttons are grouped by 5 per row) */
948
+ type ButtonInput = ButtonBuilder | ActionRowBuilder<ButtonBuilder> | (ButtonBuilder | ActionRowBuilder<ButtonBuilder>)[];
848
949
  declare class ButtonManager {
849
950
  static create(options: ButtonOptions & {
850
951
  style: ButtonStyle;
@@ -861,19 +962,53 @@ declare class ButtonManager {
861
962
  static cancel(customId: string): ButtonBuilder;
862
963
  static row(but: ButtonBuilder): ActionRowBuilder<ButtonBuilder>;
863
964
  static row(but: ButtonBuilder[]): ActionRowBuilder<ButtonBuilder>;
864
- static toMessage(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[]): MessageCreateOptions;
865
- static toInteraction(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[], ephemeral?: boolean): InteractionReplyOptions;
866
- static toInteractionEdit(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[]): InteractionEditReplyOptions;
965
+ static toMessage(button: ButtonInput): MessageCreateOptions;
966
+ static toInteraction(button: ButtonInput, ephemeral?: boolean): InteractionReplyOptions;
967
+ /**
968
+ * Options to edit an existing message : message.edit()
969
+ */
970
+ static toMessageUpdate(button: ButtonInput): UpdateOptions;
971
+ /**
972
+ * Options for interaction.update() and interaction.editReply() (buttons, select menus, modals, deferred replies)
973
+ */
974
+ static toInteractionUpdate(button: ButtonInput): UpdateOptions;
975
+ /**
976
+ * Consecutive buttons are grouped by 5 in the same row (like row() does), action rows are kept as is
977
+ */
867
978
  private static createRowsToReturn;
868
979
  }
869
980
 
981
+ interface PaginationPage {
982
+ embed: EmbedBuilder;
983
+ content?: string;
984
+ }
985
+ interface PaginationOptions {
986
+ /** Total lifetime of the pagination in ms, default 60000 */
987
+ time?: number;
988
+ /** Stop after this many ms without any click, default 15000 */
989
+ idle?: number;
990
+ /** Only used when the interaction isn't acknowledged yet, default false */
991
+ ephemeral?: boolean;
992
+ }
993
+ declare class PaginationManager {
994
+ /**
995
+ * Reply to the interaction (or edit the deferred reply) with the first page and navigation buttons.
996
+ * Only the user who triggered the interaction can navigate, and the buttons are disabled when the
997
+ * collector ends.
998
+ */
999
+ static send(interaction: RepliableInteraction, pages: PaginationPage[], options?: PaginationOptions): Promise<InteractionCollector<ButtonInteraction> | null>;
1000
+ private static row;
1001
+ }
1002
+
870
1003
  /**
871
1004
  * Classe utilitaire pour valider tous les formats Discord avec regex
872
1005
  */
873
1006
  declare class DiscordRegex {
874
1007
  static readonly SPACE = "\u200B";
875
1008
  static readonly URL_REGEX: RegExp;
1009
+ static readonly DISCORD_URL: RegExp;
876
1010
  static readonly USER_REGEX: RegExp;
1011
+ /** @deprecated A bot mention can't be told apart from a user mention : same as USER_REGEX */
877
1012
  static readonly BOT_REGEX: RegExp;
878
1013
  static readonly CHANNEL_REGEX: RegExp;
879
1014
  static readonly ROLE_REGEX: RegExp;
@@ -888,6 +1023,7 @@ declare class DiscordRegex {
888
1023
  * Mention a Channel
889
1024
  */
890
1025
  static readonly DISCORD_MENTION_REGEX: RegExp;
1026
+ static readonly SNOWFLAKE: RegExp;
891
1027
  static readonly USER_ID: RegExp;
892
1028
  static readonly CHANNEL_ID: RegExp;
893
1029
  static readonly GUILD_ID: RegExp;
@@ -900,11 +1036,11 @@ declare class DiscordRegex {
900
1036
  static readonly INVITE: RegExp;
901
1037
  static readonly EMOJI: RegExp;
902
1038
  /**
903
- * Validate Discord ID Discord (18)
1039
+ * Validate a Discord ID (snowflake, 17 to 20 digits)
904
1040
  */
905
1041
  static isDiscordId(id: string): boolean;
906
1042
  /**
907
- * Validate a bot ID (19)
1043
+ * @deprecated A bot mention can't be told apart from a user mention : same as isUserMention()
908
1044
  */
909
1045
  static isBotMention(mention: string): boolean;
910
1046
  /**
@@ -916,7 +1052,7 @@ declare class DiscordRegex {
916
1052
  */
917
1053
  static isUsername(username: string): boolean;
918
1054
  /**
919
- * Type guard for Discord ID
1055
+ * @deprecated Same as isDiscordId()
920
1056
  */
921
1057
  static isDiscordIdType(id: string): id is string;
922
1058
  /**
@@ -941,4 +1077,4 @@ declare const SimpleDiscordBotInfo: {
941
1077
  license: string;
942
1078
  };
943
1079
 
944
- export { Bot, type BotConfig, BotEnv, ButtonManager, type ButtonOptions, ChartManager, ComponentManager, type ComponentManagerCreate, type ComponentManagerField, type ComponentManagerFileInput, DiscordRegex, EmbedManager, GuildManager, type ModalField, ModalFieldType, ModalManager, type ProgressBarOptions, type ProgressBarRow, type RandomBotActivity, ReactionManager, type SelectMenuCreateOption, type SelectMenuList, SelectMenuManager, SimpleColor, SimpleDiscordBotInfo, type SparklineOptions, type SparklineRow, type SparklinesOptions, UserManager, WebhookManager };
1080
+ export { Bot, type BotConfig, BotEnv, type ButtonInput, ButtonManager, type ButtonOptions, ChartManager, ComponentManager, type ComponentManagerCreate, type ComponentManagerField, type ComponentManagerFileInput, type ConfigLog, DiscordRegex, EmbedManager, GuildManager, type ModalField, ModalFieldType, ModalManager, PaginationManager, type PaginationOptions, type PaginationPage, type ProgressBarOptions, type ProgressBarRow, type RandomBotActivity, ReactionManager, type SelectMenuCreateOption, type SelectMenuList, SelectMenuManager, type SendableComponent, SimpleColor, SimpleDiscordBotInfo, type SparklineOptions, type SparklineRow, type SparklinesOptions, type UpdateOptions, UserManager, WebhookManager };