@spatulox/simplediscordbot 1.4.1 → 1.5.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/dist/index.d.mts +138 -26
- package/dist/index.d.ts +138 -26
- package/dist/index.js +303 -57
- package/dist/index.mjs +320 -58
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmbedBuilder, ActionRowBuilder, MessageActionRowComponentBuilder, Message, InteractionDeferReplyOptions, InteractionReplyOptions, InteractionEditReplyOptions, MessageCreateOptions, TextChannel, DMChannel, ThreadChannel, User, GuildMember, BaseInteraction, InteractionResponse, Client, ActivityType, WebhookMessageCreateOptions, EmojiResolvable, Guild, BanOptions, Snowflake, GuildBasedChannel, GuildChannelCreateOptions, ForumChannel, NewsChannel, StageChannel, StartThreadOptions, VoiceChannel, Invite, Channel, Collection, GuildBan, ModalBuilder, StringSelectMenuBuilder, UserSelectMenuBuilder, RoleSelectMenuBuilder, MentionableSelectMenuBuilder, ChannelType,
|
|
1
|
+
import { EmbedBuilder, ActionRowBuilder, MessageActionRowComponentBuilder, Message, InteractionDeferReplyOptions, InteractionReplyOptions, InteractionEditReplyOptions, MessageCreateOptions, TextChannel, DMChannel, ThreadChannel, User, GuildMember, BaseInteraction, InteractionResponse, Client, ActivityType, WebhookMessageCreateOptions, EmojiResolvable, Guild, BanOptions, Snowflake, GuildBasedChannel, GuildChannelCreateOptions, ForumChannel, NewsChannel, StageChannel, StartThreadOptions, VoiceChannel, Invite, Channel, Collection, GuildBan, ModalBuilder, StringSelectMenuBuilder, UserSelectMenuBuilder, RoleSelectMenuBuilder, MentionableSelectMenuBuilder, ChannelSelectMenuBuilder, ChannelType, ContainerBuilder, ButtonBuilder, AttachmentBuilder } from 'discord.js';
|
|
2
2
|
|
|
3
3
|
type SendableComponent = EmbedBuilder | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
4
4
|
|
|
@@ -54,6 +54,7 @@ declare class BotLog {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
declare enum EmbedColor {
|
|
57
|
+
transparent = "transparent",
|
|
57
58
|
error = 8912917,
|
|
58
59
|
success = 65280,
|
|
59
60
|
black = 0,
|
|
@@ -111,7 +112,7 @@ declare class EmbedManager {
|
|
|
111
112
|
*/
|
|
112
113
|
static success(description: string): EmbedBuilder;
|
|
113
114
|
/**
|
|
114
|
-
* Creates a
|
|
115
|
+
* Creates a simple description embed
|
|
115
116
|
*/
|
|
116
117
|
static description(description: string): EmbedBuilder;
|
|
117
118
|
/**
|
|
@@ -131,14 +132,6 @@ declare class EmbedManager {
|
|
|
131
132
|
value: string;
|
|
132
133
|
inline?: boolean;
|
|
133
134
|
}[]): EmbedBuilder;
|
|
134
|
-
/**
|
|
135
|
-
* Fluent API shortcuts
|
|
136
|
-
*/
|
|
137
|
-
static title(embed: EmbedBuilder, title: string): EmbedBuilder;
|
|
138
|
-
static desc(embed: EmbedBuilder, description: string): EmbedBuilder;
|
|
139
|
-
static thumb(embed: EmbedBuilder, url: string): EmbedBuilder;
|
|
140
|
-
static image(embed: EmbedBuilder, url: string): EmbedBuilder;
|
|
141
|
-
static footer(embed: EmbedBuilder, text: string): EmbedBuilder;
|
|
142
135
|
/**
|
|
143
136
|
* Transform embed into objet for interaction.reply()
|
|
144
137
|
*/
|
|
@@ -187,7 +180,6 @@ declare class BotInteraction {
|
|
|
187
180
|
}
|
|
188
181
|
|
|
189
182
|
type BotConfig = {
|
|
190
|
-
botIconUrl?: string;
|
|
191
183
|
defaultEmbedColor?: number | EmbedColor;
|
|
192
184
|
botName?: string;
|
|
193
185
|
log?: ConfigLog;
|
|
@@ -561,12 +553,18 @@ declare enum ModalFieldType {
|
|
|
561
553
|
DATE = 3,
|
|
562
554
|
PHONE = 4
|
|
563
555
|
}
|
|
564
|
-
interface
|
|
565
|
-
type: ModalFieldType;
|
|
556
|
+
interface BaseModalField {
|
|
566
557
|
label: string;
|
|
567
|
-
placeholder?: string;
|
|
568
558
|
required?: boolean;
|
|
569
559
|
}
|
|
560
|
+
interface TextModalField extends BaseModalField {
|
|
561
|
+
type: ModalFieldType.SHORT | ModalFieldType.LONG | ModalFieldType.NUMBER | ModalFieldType.PHONE;
|
|
562
|
+
placeholder?: string;
|
|
563
|
+
}
|
|
564
|
+
interface DateModalField extends BaseModalField {
|
|
565
|
+
type: ModalFieldType.DATE;
|
|
566
|
+
}
|
|
567
|
+
type ModalField = TextModalField | DateModalField;
|
|
570
568
|
declare class ModalManager {
|
|
571
569
|
/**
|
|
572
570
|
* Creates base Modal - SIMPLE API !
|
|
@@ -577,13 +575,13 @@ declare class ModalManager {
|
|
|
577
575
|
*/
|
|
578
576
|
private static _createField;
|
|
579
577
|
/**
|
|
580
|
-
|
|
581
|
-
|
|
578
|
+
* Simple modal with ONE field - DIRECT ModalBuilder return !
|
|
579
|
+
*/
|
|
582
580
|
static simple(customId: string, modalTitle: string | null, field: ModalField): ModalBuilder;
|
|
583
581
|
/**
|
|
584
582
|
* Title + Description modal preset
|
|
585
583
|
*/
|
|
586
|
-
static titleDescription(customId: string, modalTitle: string, title: Omit<
|
|
584
|
+
static titleDescription(customId: string, modalTitle: string, title: Omit<TextModalField, "type">, description: Omit<TextModalField, "type">): ModalBuilder;
|
|
587
585
|
/**
|
|
588
586
|
* Date modal preset
|
|
589
587
|
*/
|
|
@@ -602,20 +600,21 @@ declare class ModalManager {
|
|
|
602
600
|
static add(modal: ModalBuilder, field: ModalField[]): ModalBuilder;
|
|
603
601
|
static add(modal: ModalBuilder, field: ModalField): ModalBuilder;
|
|
604
602
|
static parseNumber(value: string): number | null;
|
|
605
|
-
static parsePhone(value: string): string | null;
|
|
606
|
-
static parseDate(value: string): Date | null;
|
|
607
603
|
/**
|
|
608
|
-
*
|
|
604
|
+
* yyyy-mm-dd / dd-mm-yyyy / dd/mm/yyyy / yyyy/mm/dd
|
|
605
|
+
* American format is not supported lol
|
|
606
|
+
* @param value
|
|
609
607
|
*/
|
|
610
|
-
static
|
|
608
|
+
static parseDate(value: string): Date | null;
|
|
611
609
|
}
|
|
612
610
|
|
|
613
611
|
type SelectMenuCreateOption = {
|
|
614
612
|
label: string;
|
|
613
|
+
value: string;
|
|
615
614
|
description?: string;
|
|
616
615
|
emoji?: string;
|
|
617
|
-
value: string;
|
|
618
616
|
};
|
|
617
|
+
type SelectMenuList = StringSelectMenuBuilder | UserSelectMenuBuilder | RoleSelectMenuBuilder | MentionableSelectMenuBuilder | ChannelSelectMenuBuilder;
|
|
619
618
|
declare class SelectMenuManager {
|
|
620
619
|
/**
|
|
621
620
|
* Creates base StringSelectMenu - SIMPLE API !
|
|
@@ -628,7 +627,7 @@ declare class SelectMenuManager {
|
|
|
628
627
|
/**
|
|
629
628
|
* Pagination menu
|
|
630
629
|
*/
|
|
631
|
-
static paginated(customId: string, options: SelectMenuCreateOption[], pageSize?: number): ActionRowBuilder<MessageActionRowComponentBuilder
|
|
630
|
+
static paginated(customId: string, options: SelectMenuCreateOption[], pageSize?: number): ActionRowBuilder<MessageActionRowComponentBuilder>[];
|
|
632
631
|
/**
|
|
633
632
|
* User Select Menu (Components V2)
|
|
634
633
|
*/
|
|
@@ -648,8 +647,7 @@ declare class SelectMenuManager {
|
|
|
648
647
|
/**
|
|
649
648
|
* Quick option creator
|
|
650
649
|
*/
|
|
651
|
-
static option
|
|
652
|
-
static option(options: SelectMenuCreateOption[]): StringSelectMenuOptionBuilder[];
|
|
650
|
+
private static option;
|
|
653
651
|
private static _createOption;
|
|
654
652
|
/**
|
|
655
653
|
* Fluent API pour personnaliser
|
|
@@ -665,6 +663,120 @@ declare class SelectMenuManager {
|
|
|
665
663
|
* Rows multiples (5 max)
|
|
666
664
|
*/
|
|
667
665
|
static rows(...components: MessageActionRowComponentBuilder[]): ActionRowBuilder<MessageActionRowComponentBuilder>[];
|
|
666
|
+
static toMessage(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[]): MessageCreateOptions;
|
|
667
|
+
static toInteraction(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[], ephemeral?: boolean): InteractionReplyOptions | InteractionEditReplyOptions;
|
|
668
|
+
private static _createRowsToReturn;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
interface BasicComponentManagerField {
|
|
672
|
+
name: string;
|
|
673
|
+
value: string;
|
|
674
|
+
}
|
|
675
|
+
interface ComponentManagerFieldThumbnail extends BasicComponentManagerField {
|
|
676
|
+
thumbnailUrl: string;
|
|
677
|
+
}
|
|
678
|
+
interface ComponentManagerFieldAccessory extends BasicComponentManagerField {
|
|
679
|
+
button: ButtonBuilder;
|
|
680
|
+
}
|
|
681
|
+
type ComponentManagerField = ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | BasicComponentManagerField;
|
|
682
|
+
interface ComponentManagerCreate {
|
|
683
|
+
title?: string | null;
|
|
684
|
+
color?: EmbedColor | null;
|
|
685
|
+
thumbnailUrl?: string;
|
|
686
|
+
}
|
|
687
|
+
interface ComponentManagerFileInput {
|
|
688
|
+
buffer: Buffer;
|
|
689
|
+
name: string;
|
|
690
|
+
spoiler?: boolean;
|
|
691
|
+
}
|
|
692
|
+
declare class ComponentManager {
|
|
693
|
+
private static get DEFAULT_COLOR();
|
|
694
|
+
/**
|
|
695
|
+
* Creates base ComponentV2
|
|
696
|
+
*/
|
|
697
|
+
static create(option?: ComponentManagerCreate | null): ContainerBuilder;
|
|
698
|
+
/**
|
|
699
|
+
* Creates simple ComponentV2 with just description
|
|
700
|
+
*/
|
|
701
|
+
static simple(description: string, color?: EmbedColor | null): ContainerBuilder;
|
|
702
|
+
/**
|
|
703
|
+
* Creates success ComponentV2
|
|
704
|
+
*/
|
|
705
|
+
static success(description: string): ContainerBuilder;
|
|
706
|
+
/**
|
|
707
|
+
* Creates debug ComponentV2
|
|
708
|
+
*/
|
|
709
|
+
static debug(description: string): ContainerBuilder;
|
|
710
|
+
/**
|
|
711
|
+
* Creates error ComponentV2
|
|
712
|
+
*/
|
|
713
|
+
static error(description: string): ContainerBuilder;
|
|
714
|
+
private static separator;
|
|
715
|
+
/**
|
|
716
|
+
* Quick field adder
|
|
717
|
+
*/
|
|
718
|
+
static field(container: ContainerBuilder, field: ComponentManagerField): ContainerBuilder;
|
|
719
|
+
/**
|
|
720
|
+
* Multiple fields
|
|
721
|
+
*/
|
|
722
|
+
static fields(container: ContainerBuilder, fields: ComponentManagerField[]): ContainerBuilder;
|
|
723
|
+
/**
|
|
724
|
+
* Add a media gallery (links)
|
|
725
|
+
*/
|
|
726
|
+
static mediaGallery(container: ContainerBuilder, medias: {
|
|
727
|
+
url: string;
|
|
728
|
+
spoiler?: boolean;
|
|
729
|
+
}[]): ContainerBuilder;
|
|
730
|
+
/**
|
|
731
|
+
* Add a select menu
|
|
732
|
+
*/
|
|
733
|
+
static selectMenu(container: ContainerBuilder, selectMenu: SelectMenuList[]): ContainerBuilder;
|
|
734
|
+
static selectMenu(container: ContainerBuilder, selectMenu: SelectMenuList): ContainerBuilder;
|
|
735
|
+
/**
|
|
736
|
+
* Add file(s)
|
|
737
|
+
* Don't forget to get the files, return by the function and send it via the "file" field when sending message, or passing the file to the ComponentManager.toMessage()
|
|
738
|
+
*/
|
|
739
|
+
static file(container: ContainerBuilder, file: ComponentManagerFileInput): {
|
|
740
|
+
container: ContainerBuilder;
|
|
741
|
+
files: AttachmentBuilder[];
|
|
742
|
+
};
|
|
743
|
+
static file(container: ContainerBuilder, file: ComponentManagerFileInput[]): {
|
|
744
|
+
container: ContainerBuilder;
|
|
745
|
+
files: AttachmentBuilder[];
|
|
746
|
+
};
|
|
747
|
+
private static footer;
|
|
748
|
+
/**
|
|
749
|
+
* Transform ComponentV2 into object for channel.send()
|
|
750
|
+
* @param container The container to send
|
|
751
|
+
* @param file Only if you have files to attach
|
|
752
|
+
* @param footer Sometimes you don't want to have the Bot name neither the timestamp...
|
|
753
|
+
*/
|
|
754
|
+
static toMessage(container: ContainerBuilder, file?: AttachmentBuilder | AttachmentBuilder[] | null, footer?: boolean): MessageCreateOptions;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
interface ButtonOptions {
|
|
758
|
+
label?: string;
|
|
759
|
+
emoji?: string;
|
|
760
|
+
customId: string;
|
|
761
|
+
disabled?: boolean;
|
|
762
|
+
}
|
|
763
|
+
declare class ButtonManager {
|
|
764
|
+
private static _create;
|
|
765
|
+
static primary(options: ButtonOptions): ButtonBuilder;
|
|
766
|
+
static success(options: ButtonOptions): ButtonBuilder;
|
|
767
|
+
static secondary(options: ButtonOptions): ButtonBuilder;
|
|
768
|
+
static danger(options: ButtonOptions): ButtonBuilder;
|
|
769
|
+
static link(options: Omit<ButtonOptions & {
|
|
770
|
+
url: string;
|
|
771
|
+
label: string;
|
|
772
|
+
}, "customId">): ButtonBuilder;
|
|
773
|
+
static confirm(customId: string): ButtonBuilder;
|
|
774
|
+
static cancel(customId: string): ButtonBuilder;
|
|
775
|
+
static row(but: ButtonBuilder): ActionRowBuilder<ButtonBuilder>;
|
|
776
|
+
static row(but: ButtonBuilder[]): ActionRowBuilder<ButtonBuilder>;
|
|
777
|
+
static toMessage(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[]): MessageCreateOptions;
|
|
778
|
+
static toInteraction(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[], ephemeral?: boolean): InteractionReplyOptions | InteractionEditReplyOptions;
|
|
779
|
+
private static _createRowsToReturn;
|
|
668
780
|
}
|
|
669
781
|
|
|
670
782
|
declare class UnitTime {
|
|
@@ -952,4 +1064,4 @@ declare const SimpleDiscordBotInfo: {
|
|
|
952
1064
|
license: string;
|
|
953
1065
|
};
|
|
954
1066
|
|
|
955
|
-
export { Bot, type BotConfig, BotEnv, DiscordRegex, EmbedColor, EmbedManager, FileManager, GuildManager, Log, ModalManager, type RandomBotActivity, ReactionManager, SelectMenuManager, SimpleDiscordBotInfo, SimpleMutex, Time, UserManager, WebhookManager };
|
|
1067
|
+
export { Bot, type BotConfig, BotEnv, ButtonManager, ComponentManager, DiscordRegex, EmbedColor, EmbedManager, FileManager, GuildManager, Log, ModalManager, type RandomBotActivity, ReactionManager, SelectMenuManager, SimpleDiscordBotInfo, SimpleMutex, Time, UserManager, WebhookManager };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmbedBuilder, ActionRowBuilder, MessageActionRowComponentBuilder, Message, InteractionDeferReplyOptions, InteractionReplyOptions, InteractionEditReplyOptions, MessageCreateOptions, TextChannel, DMChannel, ThreadChannel, User, GuildMember, BaseInteraction, InteractionResponse, Client, ActivityType, WebhookMessageCreateOptions, EmojiResolvable, Guild, BanOptions, Snowflake, GuildBasedChannel, GuildChannelCreateOptions, ForumChannel, NewsChannel, StageChannel, StartThreadOptions, VoiceChannel, Invite, Channel, Collection, GuildBan, ModalBuilder, StringSelectMenuBuilder, UserSelectMenuBuilder, RoleSelectMenuBuilder, MentionableSelectMenuBuilder, ChannelType,
|
|
1
|
+
import { EmbedBuilder, ActionRowBuilder, MessageActionRowComponentBuilder, Message, InteractionDeferReplyOptions, InteractionReplyOptions, InteractionEditReplyOptions, MessageCreateOptions, TextChannel, DMChannel, ThreadChannel, User, GuildMember, BaseInteraction, InteractionResponse, Client, ActivityType, WebhookMessageCreateOptions, EmojiResolvable, Guild, BanOptions, Snowflake, GuildBasedChannel, GuildChannelCreateOptions, ForumChannel, NewsChannel, StageChannel, StartThreadOptions, VoiceChannel, Invite, Channel, Collection, GuildBan, ModalBuilder, StringSelectMenuBuilder, UserSelectMenuBuilder, RoleSelectMenuBuilder, MentionableSelectMenuBuilder, ChannelSelectMenuBuilder, ChannelType, ContainerBuilder, ButtonBuilder, AttachmentBuilder } from 'discord.js';
|
|
2
2
|
|
|
3
3
|
type SendableComponent = EmbedBuilder | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
4
4
|
|
|
@@ -54,6 +54,7 @@ declare class BotLog {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
declare enum EmbedColor {
|
|
57
|
+
transparent = "transparent",
|
|
57
58
|
error = 8912917,
|
|
58
59
|
success = 65280,
|
|
59
60
|
black = 0,
|
|
@@ -111,7 +112,7 @@ declare class EmbedManager {
|
|
|
111
112
|
*/
|
|
112
113
|
static success(description: string): EmbedBuilder;
|
|
113
114
|
/**
|
|
114
|
-
* Creates a
|
|
115
|
+
* Creates a simple description embed
|
|
115
116
|
*/
|
|
116
117
|
static description(description: string): EmbedBuilder;
|
|
117
118
|
/**
|
|
@@ -131,14 +132,6 @@ declare class EmbedManager {
|
|
|
131
132
|
value: string;
|
|
132
133
|
inline?: boolean;
|
|
133
134
|
}[]): EmbedBuilder;
|
|
134
|
-
/**
|
|
135
|
-
* Fluent API shortcuts
|
|
136
|
-
*/
|
|
137
|
-
static title(embed: EmbedBuilder, title: string): EmbedBuilder;
|
|
138
|
-
static desc(embed: EmbedBuilder, description: string): EmbedBuilder;
|
|
139
|
-
static thumb(embed: EmbedBuilder, url: string): EmbedBuilder;
|
|
140
|
-
static image(embed: EmbedBuilder, url: string): EmbedBuilder;
|
|
141
|
-
static footer(embed: EmbedBuilder, text: string): EmbedBuilder;
|
|
142
135
|
/**
|
|
143
136
|
* Transform embed into objet for interaction.reply()
|
|
144
137
|
*/
|
|
@@ -187,7 +180,6 @@ declare class BotInteraction {
|
|
|
187
180
|
}
|
|
188
181
|
|
|
189
182
|
type BotConfig = {
|
|
190
|
-
botIconUrl?: string;
|
|
191
183
|
defaultEmbedColor?: number | EmbedColor;
|
|
192
184
|
botName?: string;
|
|
193
185
|
log?: ConfigLog;
|
|
@@ -561,12 +553,18 @@ declare enum ModalFieldType {
|
|
|
561
553
|
DATE = 3,
|
|
562
554
|
PHONE = 4
|
|
563
555
|
}
|
|
564
|
-
interface
|
|
565
|
-
type: ModalFieldType;
|
|
556
|
+
interface BaseModalField {
|
|
566
557
|
label: string;
|
|
567
|
-
placeholder?: string;
|
|
568
558
|
required?: boolean;
|
|
569
559
|
}
|
|
560
|
+
interface TextModalField extends BaseModalField {
|
|
561
|
+
type: ModalFieldType.SHORT | ModalFieldType.LONG | ModalFieldType.NUMBER | ModalFieldType.PHONE;
|
|
562
|
+
placeholder?: string;
|
|
563
|
+
}
|
|
564
|
+
interface DateModalField extends BaseModalField {
|
|
565
|
+
type: ModalFieldType.DATE;
|
|
566
|
+
}
|
|
567
|
+
type ModalField = TextModalField | DateModalField;
|
|
570
568
|
declare class ModalManager {
|
|
571
569
|
/**
|
|
572
570
|
* Creates base Modal - SIMPLE API !
|
|
@@ -577,13 +575,13 @@ declare class ModalManager {
|
|
|
577
575
|
*/
|
|
578
576
|
private static _createField;
|
|
579
577
|
/**
|
|
580
|
-
|
|
581
|
-
|
|
578
|
+
* Simple modal with ONE field - DIRECT ModalBuilder return !
|
|
579
|
+
*/
|
|
582
580
|
static simple(customId: string, modalTitle: string | null, field: ModalField): ModalBuilder;
|
|
583
581
|
/**
|
|
584
582
|
* Title + Description modal preset
|
|
585
583
|
*/
|
|
586
|
-
static titleDescription(customId: string, modalTitle: string, title: Omit<
|
|
584
|
+
static titleDescription(customId: string, modalTitle: string, title: Omit<TextModalField, "type">, description: Omit<TextModalField, "type">): ModalBuilder;
|
|
587
585
|
/**
|
|
588
586
|
* Date modal preset
|
|
589
587
|
*/
|
|
@@ -602,20 +600,21 @@ declare class ModalManager {
|
|
|
602
600
|
static add(modal: ModalBuilder, field: ModalField[]): ModalBuilder;
|
|
603
601
|
static add(modal: ModalBuilder, field: ModalField): ModalBuilder;
|
|
604
602
|
static parseNumber(value: string): number | null;
|
|
605
|
-
static parsePhone(value: string): string | null;
|
|
606
|
-
static parseDate(value: string): Date | null;
|
|
607
603
|
/**
|
|
608
|
-
*
|
|
604
|
+
* yyyy-mm-dd / dd-mm-yyyy / dd/mm/yyyy / yyyy/mm/dd
|
|
605
|
+
* American format is not supported lol
|
|
606
|
+
* @param value
|
|
609
607
|
*/
|
|
610
|
-
static
|
|
608
|
+
static parseDate(value: string): Date | null;
|
|
611
609
|
}
|
|
612
610
|
|
|
613
611
|
type SelectMenuCreateOption = {
|
|
614
612
|
label: string;
|
|
613
|
+
value: string;
|
|
615
614
|
description?: string;
|
|
616
615
|
emoji?: string;
|
|
617
|
-
value: string;
|
|
618
616
|
};
|
|
617
|
+
type SelectMenuList = StringSelectMenuBuilder | UserSelectMenuBuilder | RoleSelectMenuBuilder | MentionableSelectMenuBuilder | ChannelSelectMenuBuilder;
|
|
619
618
|
declare class SelectMenuManager {
|
|
620
619
|
/**
|
|
621
620
|
* Creates base StringSelectMenu - SIMPLE API !
|
|
@@ -628,7 +627,7 @@ declare class SelectMenuManager {
|
|
|
628
627
|
/**
|
|
629
628
|
* Pagination menu
|
|
630
629
|
*/
|
|
631
|
-
static paginated(customId: string, options: SelectMenuCreateOption[], pageSize?: number): ActionRowBuilder<MessageActionRowComponentBuilder
|
|
630
|
+
static paginated(customId: string, options: SelectMenuCreateOption[], pageSize?: number): ActionRowBuilder<MessageActionRowComponentBuilder>[];
|
|
632
631
|
/**
|
|
633
632
|
* User Select Menu (Components V2)
|
|
634
633
|
*/
|
|
@@ -648,8 +647,7 @@ declare class SelectMenuManager {
|
|
|
648
647
|
/**
|
|
649
648
|
* Quick option creator
|
|
650
649
|
*/
|
|
651
|
-
static option
|
|
652
|
-
static option(options: SelectMenuCreateOption[]): StringSelectMenuOptionBuilder[];
|
|
650
|
+
private static option;
|
|
653
651
|
private static _createOption;
|
|
654
652
|
/**
|
|
655
653
|
* Fluent API pour personnaliser
|
|
@@ -665,6 +663,120 @@ declare class SelectMenuManager {
|
|
|
665
663
|
* Rows multiples (5 max)
|
|
666
664
|
*/
|
|
667
665
|
static rows(...components: MessageActionRowComponentBuilder[]): ActionRowBuilder<MessageActionRowComponentBuilder>[];
|
|
666
|
+
static toMessage(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[]): MessageCreateOptions;
|
|
667
|
+
static toInteraction(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[], ephemeral?: boolean): InteractionReplyOptions | InteractionEditReplyOptions;
|
|
668
|
+
private static _createRowsToReturn;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
interface BasicComponentManagerField {
|
|
672
|
+
name: string;
|
|
673
|
+
value: string;
|
|
674
|
+
}
|
|
675
|
+
interface ComponentManagerFieldThumbnail extends BasicComponentManagerField {
|
|
676
|
+
thumbnailUrl: string;
|
|
677
|
+
}
|
|
678
|
+
interface ComponentManagerFieldAccessory extends BasicComponentManagerField {
|
|
679
|
+
button: ButtonBuilder;
|
|
680
|
+
}
|
|
681
|
+
type ComponentManagerField = ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | BasicComponentManagerField;
|
|
682
|
+
interface ComponentManagerCreate {
|
|
683
|
+
title?: string | null;
|
|
684
|
+
color?: EmbedColor | null;
|
|
685
|
+
thumbnailUrl?: string;
|
|
686
|
+
}
|
|
687
|
+
interface ComponentManagerFileInput {
|
|
688
|
+
buffer: Buffer;
|
|
689
|
+
name: string;
|
|
690
|
+
spoiler?: boolean;
|
|
691
|
+
}
|
|
692
|
+
declare class ComponentManager {
|
|
693
|
+
private static get DEFAULT_COLOR();
|
|
694
|
+
/**
|
|
695
|
+
* Creates base ComponentV2
|
|
696
|
+
*/
|
|
697
|
+
static create(option?: ComponentManagerCreate | null): ContainerBuilder;
|
|
698
|
+
/**
|
|
699
|
+
* Creates simple ComponentV2 with just description
|
|
700
|
+
*/
|
|
701
|
+
static simple(description: string, color?: EmbedColor | null): ContainerBuilder;
|
|
702
|
+
/**
|
|
703
|
+
* Creates success ComponentV2
|
|
704
|
+
*/
|
|
705
|
+
static success(description: string): ContainerBuilder;
|
|
706
|
+
/**
|
|
707
|
+
* Creates debug ComponentV2
|
|
708
|
+
*/
|
|
709
|
+
static debug(description: string): ContainerBuilder;
|
|
710
|
+
/**
|
|
711
|
+
* Creates error ComponentV2
|
|
712
|
+
*/
|
|
713
|
+
static error(description: string): ContainerBuilder;
|
|
714
|
+
private static separator;
|
|
715
|
+
/**
|
|
716
|
+
* Quick field adder
|
|
717
|
+
*/
|
|
718
|
+
static field(container: ContainerBuilder, field: ComponentManagerField): ContainerBuilder;
|
|
719
|
+
/**
|
|
720
|
+
* Multiple fields
|
|
721
|
+
*/
|
|
722
|
+
static fields(container: ContainerBuilder, fields: ComponentManagerField[]): ContainerBuilder;
|
|
723
|
+
/**
|
|
724
|
+
* Add a media gallery (links)
|
|
725
|
+
*/
|
|
726
|
+
static mediaGallery(container: ContainerBuilder, medias: {
|
|
727
|
+
url: string;
|
|
728
|
+
spoiler?: boolean;
|
|
729
|
+
}[]): ContainerBuilder;
|
|
730
|
+
/**
|
|
731
|
+
* Add a select menu
|
|
732
|
+
*/
|
|
733
|
+
static selectMenu(container: ContainerBuilder, selectMenu: SelectMenuList[]): ContainerBuilder;
|
|
734
|
+
static selectMenu(container: ContainerBuilder, selectMenu: SelectMenuList): ContainerBuilder;
|
|
735
|
+
/**
|
|
736
|
+
* Add file(s)
|
|
737
|
+
* Don't forget to get the files, return by the function and send it via the "file" field when sending message, or passing the file to the ComponentManager.toMessage()
|
|
738
|
+
*/
|
|
739
|
+
static file(container: ContainerBuilder, file: ComponentManagerFileInput): {
|
|
740
|
+
container: ContainerBuilder;
|
|
741
|
+
files: AttachmentBuilder[];
|
|
742
|
+
};
|
|
743
|
+
static file(container: ContainerBuilder, file: ComponentManagerFileInput[]): {
|
|
744
|
+
container: ContainerBuilder;
|
|
745
|
+
files: AttachmentBuilder[];
|
|
746
|
+
};
|
|
747
|
+
private static footer;
|
|
748
|
+
/**
|
|
749
|
+
* Transform ComponentV2 into object for channel.send()
|
|
750
|
+
* @param container The container to send
|
|
751
|
+
* @param file Only if you have files to attach
|
|
752
|
+
* @param footer Sometimes you don't want to have the Bot name neither the timestamp...
|
|
753
|
+
*/
|
|
754
|
+
static toMessage(container: ContainerBuilder, file?: AttachmentBuilder | AttachmentBuilder[] | null, footer?: boolean): MessageCreateOptions;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
interface ButtonOptions {
|
|
758
|
+
label?: string;
|
|
759
|
+
emoji?: string;
|
|
760
|
+
customId: string;
|
|
761
|
+
disabled?: boolean;
|
|
762
|
+
}
|
|
763
|
+
declare class ButtonManager {
|
|
764
|
+
private static _create;
|
|
765
|
+
static primary(options: ButtonOptions): ButtonBuilder;
|
|
766
|
+
static success(options: ButtonOptions): ButtonBuilder;
|
|
767
|
+
static secondary(options: ButtonOptions): ButtonBuilder;
|
|
768
|
+
static danger(options: ButtonOptions): ButtonBuilder;
|
|
769
|
+
static link(options: Omit<ButtonOptions & {
|
|
770
|
+
url: string;
|
|
771
|
+
label: string;
|
|
772
|
+
}, "customId">): ButtonBuilder;
|
|
773
|
+
static confirm(customId: string): ButtonBuilder;
|
|
774
|
+
static cancel(customId: string): ButtonBuilder;
|
|
775
|
+
static row(but: ButtonBuilder): ActionRowBuilder<ButtonBuilder>;
|
|
776
|
+
static row(but: ButtonBuilder[]): ActionRowBuilder<ButtonBuilder>;
|
|
777
|
+
static toMessage(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[]): MessageCreateOptions;
|
|
778
|
+
static toInteraction(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[], ephemeral?: boolean): InteractionReplyOptions | InteractionEditReplyOptions;
|
|
779
|
+
private static _createRowsToReturn;
|
|
668
780
|
}
|
|
669
781
|
|
|
670
782
|
declare class UnitTime {
|
|
@@ -952,4 +1064,4 @@ declare const SimpleDiscordBotInfo: {
|
|
|
952
1064
|
license: string;
|
|
953
1065
|
};
|
|
954
1066
|
|
|
955
|
-
export { Bot, type BotConfig, BotEnv, DiscordRegex, EmbedColor, EmbedManager, FileManager, GuildManager, Log, ModalManager, type RandomBotActivity, ReactionManager, SelectMenuManager, SimpleDiscordBotInfo, SimpleMutex, Time, UserManager, WebhookManager };
|
|
1067
|
+
export { Bot, type BotConfig, BotEnv, ButtonManager, ComponentManager, DiscordRegex, EmbedColor, EmbedManager, FileManager, GuildManager, Log, ModalManager, type RandomBotActivity, ReactionManager, SelectMenuManager, SimpleDiscordBotInfo, SimpleMutex, Time, UserManager, WebhookManager };
|