@spatulox/simplediscordbot 1.5.1 → 1.6.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.
- package/dist/index.d.mts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +45 -23
- package/dist/index.mjs +44 -23
- 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, ChannelSelectMenuBuilder, ChannelType, ContainerBuilder, ButtonBuilder, AttachmentBuilder } from 'discord.js';
|
|
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, SeparatorSpacingSize, ContainerBuilder, ButtonBuilder, AttachmentBuilder, ButtonStyle } from 'discord.js';
|
|
2
2
|
|
|
3
3
|
type SendableComponent = EmbedBuilder | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
4
4
|
|
|
@@ -555,6 +555,7 @@ declare enum ModalFieldType {
|
|
|
555
555
|
}
|
|
556
556
|
interface BaseModalField {
|
|
557
557
|
label: string;
|
|
558
|
+
value?: string;
|
|
558
559
|
required?: boolean;
|
|
559
560
|
}
|
|
560
561
|
interface TextModalField extends BaseModalField {
|
|
@@ -669,8 +670,9 @@ declare class SelectMenuManager {
|
|
|
669
670
|
}
|
|
670
671
|
|
|
671
672
|
interface BasicComponentManagerField {
|
|
672
|
-
name
|
|
673
|
+
name?: string;
|
|
673
674
|
value: string;
|
|
675
|
+
separator?: SeparatorSpacingSize | false;
|
|
674
676
|
}
|
|
675
677
|
interface ComponentManagerFieldThumbnail extends BasicComponentManagerField {
|
|
676
678
|
thumbnailUrl: string;
|
|
@@ -681,8 +683,10 @@ interface ComponentManagerFieldAccessory extends BasicComponentManagerField {
|
|
|
681
683
|
type ComponentManagerField = ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | BasicComponentManagerField;
|
|
682
684
|
interface ComponentManagerCreate {
|
|
683
685
|
title?: string | null;
|
|
686
|
+
description?: string | null;
|
|
684
687
|
color?: EmbedColor | null;
|
|
685
688
|
thumbnailUrl?: string;
|
|
689
|
+
separator?: SeparatorSpacingSize | false;
|
|
686
690
|
}
|
|
687
691
|
interface ComponentManagerFileInput {
|
|
688
692
|
buffer: Buffer;
|
|
@@ -761,7 +765,9 @@ interface ButtonOptions {
|
|
|
761
765
|
disabled?: boolean;
|
|
762
766
|
}
|
|
763
767
|
declare class ButtonManager {
|
|
764
|
-
|
|
768
|
+
static create(options: ButtonOptions & {
|
|
769
|
+
style: ButtonStyle;
|
|
770
|
+
}): ButtonBuilder;
|
|
765
771
|
static primary(options: ButtonOptions): ButtonBuilder;
|
|
766
772
|
static success(options: ButtonOptions): ButtonBuilder;
|
|
767
773
|
static secondary(options: ButtonOptions): ButtonBuilder;
|
|
@@ -776,7 +782,7 @@ declare class ButtonManager {
|
|
|
776
782
|
static row(but: ButtonBuilder[]): ActionRowBuilder<ButtonBuilder>;
|
|
777
783
|
static toMessage(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[]): MessageCreateOptions;
|
|
778
784
|
static toInteraction(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[], ephemeral?: boolean): InteractionReplyOptions | InteractionEditReplyOptions;
|
|
779
|
-
private static
|
|
785
|
+
private static createRowsToReturn;
|
|
780
786
|
}
|
|
781
787
|
|
|
782
788
|
declare class UnitTime {
|
|
@@ -1064,4 +1070,4 @@ declare const SimpleDiscordBotInfo: {
|
|
|
1064
1070
|
license: string;
|
|
1065
1071
|
};
|
|
1066
1072
|
|
|
1067
|
-
export { Bot, type BotConfig, BotEnv, ButtonManager, ComponentManager, DiscordRegex, EmbedColor, EmbedManager, FileManager, GuildManager, Log, ModalManager, type RandomBotActivity, ReactionManager, SelectMenuManager, SimpleDiscordBotInfo, SimpleMutex, Time, UserManager, WebhookManager };
|
|
1073
|
+
export { Bot, type BotConfig, BotEnv, ButtonManager, ComponentManager, type ComponentManagerField, DiscordRegex, EmbedColor, EmbedManager, FileManager, GuildManager, Log, type ModalField, ModalFieldType, 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, ChannelSelectMenuBuilder, ChannelType, ContainerBuilder, ButtonBuilder, AttachmentBuilder } from 'discord.js';
|
|
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, SeparatorSpacingSize, ContainerBuilder, ButtonBuilder, AttachmentBuilder, ButtonStyle } from 'discord.js';
|
|
2
2
|
|
|
3
3
|
type SendableComponent = EmbedBuilder | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
4
4
|
|
|
@@ -555,6 +555,7 @@ declare enum ModalFieldType {
|
|
|
555
555
|
}
|
|
556
556
|
interface BaseModalField {
|
|
557
557
|
label: string;
|
|
558
|
+
value?: string;
|
|
558
559
|
required?: boolean;
|
|
559
560
|
}
|
|
560
561
|
interface TextModalField extends BaseModalField {
|
|
@@ -669,8 +670,9 @@ declare class SelectMenuManager {
|
|
|
669
670
|
}
|
|
670
671
|
|
|
671
672
|
interface BasicComponentManagerField {
|
|
672
|
-
name
|
|
673
|
+
name?: string;
|
|
673
674
|
value: string;
|
|
675
|
+
separator?: SeparatorSpacingSize | false;
|
|
674
676
|
}
|
|
675
677
|
interface ComponentManagerFieldThumbnail extends BasicComponentManagerField {
|
|
676
678
|
thumbnailUrl: string;
|
|
@@ -681,8 +683,10 @@ interface ComponentManagerFieldAccessory extends BasicComponentManagerField {
|
|
|
681
683
|
type ComponentManagerField = ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | BasicComponentManagerField;
|
|
682
684
|
interface ComponentManagerCreate {
|
|
683
685
|
title?: string | null;
|
|
686
|
+
description?: string | null;
|
|
684
687
|
color?: EmbedColor | null;
|
|
685
688
|
thumbnailUrl?: string;
|
|
689
|
+
separator?: SeparatorSpacingSize | false;
|
|
686
690
|
}
|
|
687
691
|
interface ComponentManagerFileInput {
|
|
688
692
|
buffer: Buffer;
|
|
@@ -761,7 +765,9 @@ interface ButtonOptions {
|
|
|
761
765
|
disabled?: boolean;
|
|
762
766
|
}
|
|
763
767
|
declare class ButtonManager {
|
|
764
|
-
|
|
768
|
+
static create(options: ButtonOptions & {
|
|
769
|
+
style: ButtonStyle;
|
|
770
|
+
}): ButtonBuilder;
|
|
765
771
|
static primary(options: ButtonOptions): ButtonBuilder;
|
|
766
772
|
static success(options: ButtonOptions): ButtonBuilder;
|
|
767
773
|
static secondary(options: ButtonOptions): ButtonBuilder;
|
|
@@ -776,7 +782,7 @@ declare class ButtonManager {
|
|
|
776
782
|
static row(but: ButtonBuilder[]): ActionRowBuilder<ButtonBuilder>;
|
|
777
783
|
static toMessage(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[]): MessageCreateOptions;
|
|
778
784
|
static toInteraction(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[], ephemeral?: boolean): InteractionReplyOptions | InteractionEditReplyOptions;
|
|
779
|
-
private static
|
|
785
|
+
private static createRowsToReturn;
|
|
780
786
|
}
|
|
781
787
|
|
|
782
788
|
declare class UnitTime {
|
|
@@ -1064,4 +1070,4 @@ declare const SimpleDiscordBotInfo: {
|
|
|
1064
1070
|
license: string;
|
|
1065
1071
|
};
|
|
1066
1072
|
|
|
1067
|
-
export { Bot, type BotConfig, BotEnv, ButtonManager, ComponentManager, DiscordRegex, EmbedColor, EmbedManager, FileManager, GuildManager, Log, ModalManager, type RandomBotActivity, ReactionManager, SelectMenuManager, SimpleDiscordBotInfo, SimpleMutex, Time, UserManager, WebhookManager };
|
|
1073
|
+
export { Bot, type BotConfig, BotEnv, ButtonManager, ComponentManager, type ComponentManagerField, DiscordRegex, EmbedColor, EmbedManager, FileManager, GuildManager, Log, type ModalField, ModalFieldType, ModalManager, type RandomBotActivity, ReactionManager, SelectMenuManager, SimpleDiscordBotInfo, SimpleMutex, Time, UserManager, WebhookManager };
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ __export(index_exports, {
|
|
|
40
40
|
FileManager: () => FileManager,
|
|
41
41
|
GuildManager: () => GuildManager,
|
|
42
42
|
Log: () => Log,
|
|
43
|
+
ModalFieldType: () => ModalFieldType,
|
|
43
44
|
ModalManager: () => ModalManager,
|
|
44
45
|
ReactionManager: () => ReactionManager,
|
|
45
46
|
SelectMenuManager: () => SelectMenuManager,
|
|
@@ -2287,6 +2288,14 @@ var UserManager = class extends BasicUserManager {
|
|
|
2287
2288
|
|
|
2288
2289
|
// src/manager/interactions/ModalManager.ts
|
|
2289
2290
|
var import_discord15 = require("discord.js");
|
|
2291
|
+
var ModalFieldType = /* @__PURE__ */ ((ModalFieldType2) => {
|
|
2292
|
+
ModalFieldType2[ModalFieldType2["SHORT"] = 0] = "SHORT";
|
|
2293
|
+
ModalFieldType2[ModalFieldType2["LONG"] = 1] = "LONG";
|
|
2294
|
+
ModalFieldType2[ModalFieldType2["NUMBER"] = 2] = "NUMBER";
|
|
2295
|
+
ModalFieldType2[ModalFieldType2["DATE"] = 3] = "DATE";
|
|
2296
|
+
ModalFieldType2[ModalFieldType2["PHONE"] = 4] = "PHONE";
|
|
2297
|
+
return ModalFieldType2;
|
|
2298
|
+
})(ModalFieldType || {});
|
|
2290
2299
|
var ModalManager = class {
|
|
2291
2300
|
/**
|
|
2292
2301
|
* Creates base Modal - SIMPLE API !
|
|
@@ -2299,6 +2308,9 @@ var ModalManager = class {
|
|
|
2299
2308
|
*/
|
|
2300
2309
|
static _createField(opt) {
|
|
2301
2310
|
const builder = new import_discord15.TextInputBuilder().setCustomId(opt.customId).setRequired(opt.required ?? false);
|
|
2311
|
+
if (opt.value) {
|
|
2312
|
+
builder.setValue(opt.value);
|
|
2313
|
+
}
|
|
2302
2314
|
if (opt.placeholder) {
|
|
2303
2315
|
builder.setPlaceholder(opt.placeholder);
|
|
2304
2316
|
} else {
|
|
@@ -2331,7 +2343,8 @@ var ModalManager = class {
|
|
|
2331
2343
|
const opt = {
|
|
2332
2344
|
...field,
|
|
2333
2345
|
customId: `${customId}_input`,
|
|
2334
|
-
placeholder: "placeholder" in field && field.placeholder ? field.placeholder : `Enter ${field.label.toLowerCase()}
|
|
2346
|
+
placeholder: "placeholder" in field && field.placeholder ? field.placeholder : `Enter ${field.label.toLowerCase()}`,
|
|
2347
|
+
value: field.value
|
|
2335
2348
|
};
|
|
2336
2349
|
modal.addLabelComponents(this._createField(opt));
|
|
2337
2350
|
return modal;
|
|
@@ -2562,7 +2575,7 @@ var ComponentManager = class {
|
|
|
2562
2575
|
if (option?.thumbnailUrl) {
|
|
2563
2576
|
const headerSection = new import_discord17.SectionBuilder().addTextDisplayComponents(
|
|
2564
2577
|
new import_discord17.TextDisplayBuilder().setContent(
|
|
2565
|
-
option?.title ?
|
|
2578
|
+
option?.title ? option.title : "\u200B"
|
|
2566
2579
|
)
|
|
2567
2580
|
).setThumbnailAccessory(
|
|
2568
2581
|
new import_discord17.ThumbnailBuilder().setURL(option.thumbnailUrl)
|
|
@@ -2570,10 +2583,15 @@ var ComponentManager = class {
|
|
|
2570
2583
|
container.addSectionComponents(headerSection);
|
|
2571
2584
|
} else {
|
|
2572
2585
|
container.addTextDisplayComponents(
|
|
2573
|
-
new import_discord17.TextDisplayBuilder().setContent(
|
|
2586
|
+
new import_discord17.TextDisplayBuilder().setContent(option.title)
|
|
2574
2587
|
);
|
|
2575
2588
|
}
|
|
2576
|
-
|
|
2589
|
+
if (option?.description) {
|
|
2590
|
+
container.addTextDisplayComponents(new import_discord17.TextDisplayBuilder().setContent(option.description));
|
|
2591
|
+
}
|
|
2592
|
+
if (option?.separator) {
|
|
2593
|
+
container.addSeparatorComponents(this.separator(option.separator));
|
|
2594
|
+
}
|
|
2577
2595
|
}
|
|
2578
2596
|
return container;
|
|
2579
2597
|
}
|
|
@@ -2613,10 +2631,11 @@ var ComponentManager = class {
|
|
|
2613
2631
|
*/
|
|
2614
2632
|
static field(container, field) {
|
|
2615
2633
|
if ("button" in field || "thumbnailUrl" in field) {
|
|
2616
|
-
const section = new import_discord17.SectionBuilder()
|
|
2617
|
-
|
|
2618
|
-
new import_discord17.TextDisplayBuilder().setContent(field.
|
|
2619
|
-
|
|
2634
|
+
const section = new import_discord17.SectionBuilder();
|
|
2635
|
+
if (field.name) {
|
|
2636
|
+
section.addTextDisplayComponents(new import_discord17.TextDisplayBuilder().setContent(`__**${field.name}**__`));
|
|
2637
|
+
}
|
|
2638
|
+
section.addTextDisplayComponents(new import_discord17.TextDisplayBuilder().setContent(field.value));
|
|
2620
2639
|
if ("button" in field) {
|
|
2621
2640
|
section.setButtonAccessory(field.button);
|
|
2622
2641
|
} else if ("thumbnailUrl" in field) {
|
|
@@ -2624,12 +2643,14 @@ var ComponentManager = class {
|
|
|
2624
2643
|
}
|
|
2625
2644
|
container.addSectionComponents(section);
|
|
2626
2645
|
} else {
|
|
2627
|
-
|
|
2628
|
-
new import_discord17.TextDisplayBuilder().setContent(`**${field.name}**`)
|
|
2629
|
-
|
|
2630
|
-
);
|
|
2646
|
+
if (field.name) {
|
|
2647
|
+
container.addTextDisplayComponents(new import_discord17.TextDisplayBuilder().setContent(`**${field.name}**`));
|
|
2648
|
+
}
|
|
2649
|
+
container.addTextDisplayComponents(new import_discord17.TextDisplayBuilder().setContent(field.value));
|
|
2650
|
+
}
|
|
2651
|
+
if (field.separator !== false) {
|
|
2652
|
+
container.addSeparatorComponents(this.separator(field.separator));
|
|
2631
2653
|
}
|
|
2632
|
-
container.addSeparatorComponents(this.separator());
|
|
2633
2654
|
return container;
|
|
2634
2655
|
}
|
|
2635
2656
|
/*static field(container: ContainerBuilder, field: ComponentManagerField): ContainerBuilder {
|
|
@@ -2729,7 +2750,7 @@ var ComponentManager = class {
|
|
|
2729
2750
|
// src/manager/interactions/ButtonManager.ts
|
|
2730
2751
|
var import_discord18 = require("discord.js");
|
|
2731
2752
|
var ButtonManager = class _ButtonManager {
|
|
2732
|
-
static
|
|
2753
|
+
static create(options) {
|
|
2733
2754
|
const btn = new import_discord18.ButtonBuilder().setCustomId(options.customId).setLabel(options.label ?? "Button").setStyle(options.style).setDisabled(options.disabled ?? false);
|
|
2734
2755
|
if (options.emoji) {
|
|
2735
2756
|
btn.setEmoji(options.emoji);
|
|
@@ -2737,16 +2758,16 @@ var ButtonManager = class _ButtonManager {
|
|
|
2737
2758
|
return btn;
|
|
2738
2759
|
}
|
|
2739
2760
|
static primary(options) {
|
|
2740
|
-
return this.
|
|
2761
|
+
return this.create({ ...options, style: import_discord18.ButtonStyle.Primary });
|
|
2741
2762
|
}
|
|
2742
2763
|
static success(options) {
|
|
2743
|
-
return this.
|
|
2764
|
+
return this.create({ ...options, style: import_discord18.ButtonStyle.Success });
|
|
2744
2765
|
}
|
|
2745
2766
|
static secondary(options) {
|
|
2746
|
-
return this.
|
|
2767
|
+
return this.create({ ...options, style: import_discord18.ButtonStyle.Secondary });
|
|
2747
2768
|
}
|
|
2748
2769
|
static danger(options) {
|
|
2749
|
-
return this.
|
|
2770
|
+
return this.create({ ...options, style: import_discord18.ButtonStyle.Danger });
|
|
2750
2771
|
}
|
|
2751
2772
|
static link(options) {
|
|
2752
2773
|
const btn = new import_discord18.ButtonBuilder().setLabel(options.label).setStyle(import_discord18.ButtonStyle.Link).setURL(options.url);
|
|
@@ -2765,16 +2786,16 @@ var ButtonManager = class _ButtonManager {
|
|
|
2765
2786
|
}
|
|
2766
2787
|
static toMessage(button) {
|
|
2767
2788
|
return {
|
|
2768
|
-
components: this.
|
|
2789
|
+
components: this.createRowsToReturn(button)
|
|
2769
2790
|
};
|
|
2770
2791
|
}
|
|
2771
2792
|
static toInteraction(button, ephemeral = false) {
|
|
2772
2793
|
return {
|
|
2773
|
-
components: this.
|
|
2794
|
+
components: this.createRowsToReturn(button),
|
|
2774
2795
|
flags: ephemeral ? [import_discord18.MessageFlags.Ephemeral] : []
|
|
2775
2796
|
};
|
|
2776
2797
|
}
|
|
2777
|
-
static
|
|
2798
|
+
static createRowsToReturn(button) {
|
|
2778
2799
|
if (Array.isArray(button)) {
|
|
2779
2800
|
return button.map(
|
|
2780
2801
|
(btn) => btn instanceof import_discord18.ActionRowBuilder ? btn : _ButtonManager.row(btn)
|
|
@@ -2825,7 +2846,7 @@ var SimpleMutex = class {
|
|
|
2825
2846
|
// package.json
|
|
2826
2847
|
var package_default = {
|
|
2827
2848
|
name: "@spatulox/simplediscordbot",
|
|
2828
|
-
version: "1.5.
|
|
2849
|
+
version: "1.5.2",
|
|
2829
2850
|
author: "Spatulox",
|
|
2830
2851
|
description: "Simple discord bot framework to set up a bot under 30 secondes",
|
|
2831
2852
|
exports: {
|
|
@@ -2847,7 +2868,7 @@ var package_default = {
|
|
|
2847
2868
|
},
|
|
2848
2869
|
license: "MIT",
|
|
2849
2870
|
dependencies: {
|
|
2850
|
-
"@spatulox/discord-interaction-manager": "^1.0.
|
|
2871
|
+
"@spatulox/discord-interaction-manager": "^1.0.22",
|
|
2851
2872
|
"discord.js": "^14.25.1"
|
|
2852
2873
|
},
|
|
2853
2874
|
devDependencies: {
|
|
@@ -2892,6 +2913,7 @@ var SimpleDiscordBotInfo = {
|
|
|
2892
2913
|
FileManager,
|
|
2893
2914
|
GuildManager,
|
|
2894
2915
|
Log,
|
|
2916
|
+
ModalFieldType,
|
|
2895
2917
|
ModalManager,
|
|
2896
2918
|
ReactionManager,
|
|
2897
2919
|
SelectMenuManager,
|
package/dist/index.mjs
CHANGED
|
@@ -2255,6 +2255,14 @@ import {
|
|
|
2255
2255
|
TextInputStyle,
|
|
2256
2256
|
LabelBuilder
|
|
2257
2257
|
} from "discord.js";
|
|
2258
|
+
var ModalFieldType = /* @__PURE__ */ ((ModalFieldType2) => {
|
|
2259
|
+
ModalFieldType2[ModalFieldType2["SHORT"] = 0] = "SHORT";
|
|
2260
|
+
ModalFieldType2[ModalFieldType2["LONG"] = 1] = "LONG";
|
|
2261
|
+
ModalFieldType2[ModalFieldType2["NUMBER"] = 2] = "NUMBER";
|
|
2262
|
+
ModalFieldType2[ModalFieldType2["DATE"] = 3] = "DATE";
|
|
2263
|
+
ModalFieldType2[ModalFieldType2["PHONE"] = 4] = "PHONE";
|
|
2264
|
+
return ModalFieldType2;
|
|
2265
|
+
})(ModalFieldType || {});
|
|
2258
2266
|
var ModalManager = class {
|
|
2259
2267
|
/**
|
|
2260
2268
|
* Creates base Modal - SIMPLE API !
|
|
@@ -2267,6 +2275,9 @@ var ModalManager = class {
|
|
|
2267
2275
|
*/
|
|
2268
2276
|
static _createField(opt) {
|
|
2269
2277
|
const builder = new TextInputBuilder().setCustomId(opt.customId).setRequired(opt.required ?? false);
|
|
2278
|
+
if (opt.value) {
|
|
2279
|
+
builder.setValue(opt.value);
|
|
2280
|
+
}
|
|
2270
2281
|
if (opt.placeholder) {
|
|
2271
2282
|
builder.setPlaceholder(opt.placeholder);
|
|
2272
2283
|
} else {
|
|
@@ -2299,7 +2310,8 @@ var ModalManager = class {
|
|
|
2299
2310
|
const opt = {
|
|
2300
2311
|
...field,
|
|
2301
2312
|
customId: `${customId}_input`,
|
|
2302
|
-
placeholder: "placeholder" in field && field.placeholder ? field.placeholder : `Enter ${field.label.toLowerCase()}
|
|
2313
|
+
placeholder: "placeholder" in field && field.placeholder ? field.placeholder : `Enter ${field.label.toLowerCase()}`,
|
|
2314
|
+
value: field.value
|
|
2303
2315
|
};
|
|
2304
2316
|
modal.addLabelComponents(this._createField(opt));
|
|
2305
2317
|
return modal;
|
|
@@ -2551,7 +2563,7 @@ var ComponentManager = class {
|
|
|
2551
2563
|
if (option?.thumbnailUrl) {
|
|
2552
2564
|
const headerSection = new SectionBuilder().addTextDisplayComponents(
|
|
2553
2565
|
new TextDisplayBuilder().setContent(
|
|
2554
|
-
option?.title ?
|
|
2566
|
+
option?.title ? option.title : "\u200B"
|
|
2555
2567
|
)
|
|
2556
2568
|
).setThumbnailAccessory(
|
|
2557
2569
|
new ThumbnailBuilder().setURL(option.thumbnailUrl)
|
|
@@ -2559,10 +2571,15 @@ var ComponentManager = class {
|
|
|
2559
2571
|
container.addSectionComponents(headerSection);
|
|
2560
2572
|
} else {
|
|
2561
2573
|
container.addTextDisplayComponents(
|
|
2562
|
-
new TextDisplayBuilder().setContent(
|
|
2574
|
+
new TextDisplayBuilder().setContent(option.title)
|
|
2563
2575
|
);
|
|
2564
2576
|
}
|
|
2565
|
-
|
|
2577
|
+
if (option?.description) {
|
|
2578
|
+
container.addTextDisplayComponents(new TextDisplayBuilder().setContent(option.description));
|
|
2579
|
+
}
|
|
2580
|
+
if (option?.separator) {
|
|
2581
|
+
container.addSeparatorComponents(this.separator(option.separator));
|
|
2582
|
+
}
|
|
2566
2583
|
}
|
|
2567
2584
|
return container;
|
|
2568
2585
|
}
|
|
@@ -2602,10 +2619,11 @@ var ComponentManager = class {
|
|
|
2602
2619
|
*/
|
|
2603
2620
|
static field(container, field) {
|
|
2604
2621
|
if ("button" in field || "thumbnailUrl" in field) {
|
|
2605
|
-
const section = new SectionBuilder()
|
|
2606
|
-
|
|
2607
|
-
new TextDisplayBuilder().setContent(field.
|
|
2608
|
-
|
|
2622
|
+
const section = new SectionBuilder();
|
|
2623
|
+
if (field.name) {
|
|
2624
|
+
section.addTextDisplayComponents(new TextDisplayBuilder().setContent(`__**${field.name}**__`));
|
|
2625
|
+
}
|
|
2626
|
+
section.addTextDisplayComponents(new TextDisplayBuilder().setContent(field.value));
|
|
2609
2627
|
if ("button" in field) {
|
|
2610
2628
|
section.setButtonAccessory(field.button);
|
|
2611
2629
|
} else if ("thumbnailUrl" in field) {
|
|
@@ -2613,12 +2631,14 @@ var ComponentManager = class {
|
|
|
2613
2631
|
}
|
|
2614
2632
|
container.addSectionComponents(section);
|
|
2615
2633
|
} else {
|
|
2616
|
-
|
|
2617
|
-
new TextDisplayBuilder().setContent(`**${field.name}**`)
|
|
2618
|
-
|
|
2619
|
-
);
|
|
2634
|
+
if (field.name) {
|
|
2635
|
+
container.addTextDisplayComponents(new TextDisplayBuilder().setContent(`**${field.name}**`));
|
|
2636
|
+
}
|
|
2637
|
+
container.addTextDisplayComponents(new TextDisplayBuilder().setContent(field.value));
|
|
2638
|
+
}
|
|
2639
|
+
if (field.separator !== false) {
|
|
2640
|
+
container.addSeparatorComponents(this.separator(field.separator));
|
|
2620
2641
|
}
|
|
2621
|
-
container.addSeparatorComponents(this.separator());
|
|
2622
2642
|
return container;
|
|
2623
2643
|
}
|
|
2624
2644
|
/*static field(container: ContainerBuilder, field: ComponentManagerField): ContainerBuilder {
|
|
@@ -2723,7 +2743,7 @@ import {
|
|
|
2723
2743
|
MessageFlags as MessageFlags5
|
|
2724
2744
|
} from "discord.js";
|
|
2725
2745
|
var ButtonManager = class _ButtonManager {
|
|
2726
|
-
static
|
|
2746
|
+
static create(options) {
|
|
2727
2747
|
const btn = new ButtonBuilder2().setCustomId(options.customId).setLabel(options.label ?? "Button").setStyle(options.style).setDisabled(options.disabled ?? false);
|
|
2728
2748
|
if (options.emoji) {
|
|
2729
2749
|
btn.setEmoji(options.emoji);
|
|
@@ -2731,16 +2751,16 @@ var ButtonManager = class _ButtonManager {
|
|
|
2731
2751
|
return btn;
|
|
2732
2752
|
}
|
|
2733
2753
|
static primary(options) {
|
|
2734
|
-
return this.
|
|
2754
|
+
return this.create({ ...options, style: ButtonStyle.Primary });
|
|
2735
2755
|
}
|
|
2736
2756
|
static success(options) {
|
|
2737
|
-
return this.
|
|
2757
|
+
return this.create({ ...options, style: ButtonStyle.Success });
|
|
2738
2758
|
}
|
|
2739
2759
|
static secondary(options) {
|
|
2740
|
-
return this.
|
|
2760
|
+
return this.create({ ...options, style: ButtonStyle.Secondary });
|
|
2741
2761
|
}
|
|
2742
2762
|
static danger(options) {
|
|
2743
|
-
return this.
|
|
2763
|
+
return this.create({ ...options, style: ButtonStyle.Danger });
|
|
2744
2764
|
}
|
|
2745
2765
|
static link(options) {
|
|
2746
2766
|
const btn = new ButtonBuilder2().setLabel(options.label).setStyle(ButtonStyle.Link).setURL(options.url);
|
|
@@ -2759,16 +2779,16 @@ var ButtonManager = class _ButtonManager {
|
|
|
2759
2779
|
}
|
|
2760
2780
|
static toMessage(button) {
|
|
2761
2781
|
return {
|
|
2762
|
-
components: this.
|
|
2782
|
+
components: this.createRowsToReturn(button)
|
|
2763
2783
|
};
|
|
2764
2784
|
}
|
|
2765
2785
|
static toInteraction(button, ephemeral = false) {
|
|
2766
2786
|
return {
|
|
2767
|
-
components: this.
|
|
2787
|
+
components: this.createRowsToReturn(button),
|
|
2768
2788
|
flags: ephemeral ? [MessageFlags5.Ephemeral] : []
|
|
2769
2789
|
};
|
|
2770
2790
|
}
|
|
2771
|
-
static
|
|
2791
|
+
static createRowsToReturn(button) {
|
|
2772
2792
|
if (Array.isArray(button)) {
|
|
2773
2793
|
return button.map(
|
|
2774
2794
|
(btn) => btn instanceof ActionRowBuilder4 ? btn : _ButtonManager.row(btn)
|
|
@@ -2819,7 +2839,7 @@ var SimpleMutex = class {
|
|
|
2819
2839
|
// package.json
|
|
2820
2840
|
var package_default = {
|
|
2821
2841
|
name: "@spatulox/simplediscordbot",
|
|
2822
|
-
version: "1.5.
|
|
2842
|
+
version: "1.5.2",
|
|
2823
2843
|
author: "Spatulox",
|
|
2824
2844
|
description: "Simple discord bot framework to set up a bot under 30 secondes",
|
|
2825
2845
|
exports: {
|
|
@@ -2841,7 +2861,7 @@ var package_default = {
|
|
|
2841
2861
|
},
|
|
2842
2862
|
license: "MIT",
|
|
2843
2863
|
dependencies: {
|
|
2844
|
-
"@spatulox/discord-interaction-manager": "^1.0.
|
|
2864
|
+
"@spatulox/discord-interaction-manager": "^1.0.22",
|
|
2845
2865
|
"discord.js": "^14.25.1"
|
|
2846
2866
|
},
|
|
2847
2867
|
devDependencies: {
|
|
@@ -2885,6 +2905,7 @@ export {
|
|
|
2885
2905
|
FileManager,
|
|
2886
2906
|
GuildManager,
|
|
2887
2907
|
Log,
|
|
2908
|
+
ModalFieldType,
|
|
2888
2909
|
ModalManager,
|
|
2889
2910
|
ReactionManager,
|
|
2890
2911
|
SelectMenuManager,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spatulox/simplediscordbot",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"author": "Spatulox",
|
|
5
5
|
"description": "Simple discord bot framework to set up a bot under 30 secondes",
|
|
6
6
|
"exports": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@spatulox/discord-interaction-manager": "^1.0.
|
|
25
|
+
"@spatulox/discord-interaction-manager": "^1.0.22",
|
|
26
26
|
"discord.js": "^14.25.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|