@spatulox/simplediscordbot 1.6.0 → 1.6.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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +13 -11
- package/dist/index.mjs +19 -16
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -678,7 +678,7 @@ interface ComponentManagerFieldThumbnail extends BasicComponentManagerField {
|
|
|
678
678
|
thumbnailUrl: string;
|
|
679
679
|
}
|
|
680
680
|
interface ComponentManagerFieldAccessory extends BasicComponentManagerField {
|
|
681
|
-
button: ButtonBuilder;
|
|
681
|
+
button: ButtonBuilder | ButtonBuilder[];
|
|
682
682
|
}
|
|
683
683
|
type ComponentManagerField = ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | BasicComponentManagerField;
|
|
684
684
|
interface ComponentManagerCreate {
|
|
@@ -719,6 +719,7 @@ declare class ComponentManager {
|
|
|
719
719
|
/**
|
|
720
720
|
* Quick field adder
|
|
721
721
|
*/
|
|
722
|
+
private static fieldAddText;
|
|
722
723
|
static field(container: ContainerBuilder, field: ComponentManagerField): ContainerBuilder;
|
|
723
724
|
/**
|
|
724
725
|
* Multiple fields
|
package/dist/index.d.ts
CHANGED
|
@@ -678,7 +678,7 @@ interface ComponentManagerFieldThumbnail extends BasicComponentManagerField {
|
|
|
678
678
|
thumbnailUrl: string;
|
|
679
679
|
}
|
|
680
680
|
interface ComponentManagerFieldAccessory extends BasicComponentManagerField {
|
|
681
|
-
button: ButtonBuilder;
|
|
681
|
+
button: ButtonBuilder | ButtonBuilder[];
|
|
682
682
|
}
|
|
683
683
|
type ComponentManagerField = ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | BasicComponentManagerField;
|
|
684
684
|
interface ComponentManagerCreate {
|
|
@@ -719,6 +719,7 @@ declare class ComponentManager {
|
|
|
719
719
|
/**
|
|
720
720
|
* Quick field adder
|
|
721
721
|
*/
|
|
722
|
+
private static fieldAddText;
|
|
722
723
|
static field(container: ContainerBuilder, field: ComponentManagerField): ContainerBuilder;
|
|
723
724
|
/**
|
|
724
725
|
* Multiple fields
|
package/dist/index.js
CHANGED
|
@@ -2629,24 +2629,26 @@ var ComponentManager = class {
|
|
|
2629
2629
|
/**
|
|
2630
2630
|
* Quick field adder
|
|
2631
2631
|
*/
|
|
2632
|
+
static fieldAddText(container, options) {
|
|
2633
|
+
options.name && container.addTextDisplayComponents(new import_discord17.TextDisplayBuilder().setContent(`__**${options.name}**__`));
|
|
2634
|
+
container.addTextDisplayComponents(new import_discord17.TextDisplayBuilder().setContent(options.value));
|
|
2635
|
+
}
|
|
2632
2636
|
static field(container, field) {
|
|
2633
|
-
if ("button" in field
|
|
2637
|
+
if ("button" in field && Array.isArray(field.button) && field.button.length > 0) {
|
|
2638
|
+
const actionRow = new import_discord17.ActionRowBuilder().addComponents(field.button);
|
|
2639
|
+
this.fieldAddText(container, { name: field.name, value: field.value });
|
|
2640
|
+
container.addActionRowComponents(actionRow);
|
|
2641
|
+
} else if ("button" in field && !Array.isArray(field.button) || "thumbnailUrl" in field) {
|
|
2634
2642
|
const section = new import_discord17.SectionBuilder();
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
}
|
|
2638
|
-
section.addTextDisplayComponents(new import_discord17.TextDisplayBuilder().setContent(field.value));
|
|
2639
|
-
if ("button" in field) {
|
|
2643
|
+
this.fieldAddText(section, { name: field.name, value: field.value });
|
|
2644
|
+
if ("button" in field && !Array.isArray(field.button)) {
|
|
2640
2645
|
section.setButtonAccessory(field.button);
|
|
2641
2646
|
} else if ("thumbnailUrl" in field) {
|
|
2642
2647
|
section.setThumbnailAccessory(new import_discord17.ThumbnailBuilder().setURL(field.thumbnailUrl));
|
|
2643
2648
|
}
|
|
2644
2649
|
container.addSectionComponents(section);
|
|
2645
2650
|
} else {
|
|
2646
|
-
|
|
2647
|
-
container.addTextDisplayComponents(new import_discord17.TextDisplayBuilder().setContent(`**${field.name}**`));
|
|
2648
|
-
}
|
|
2649
|
-
container.addTextDisplayComponents(new import_discord17.TextDisplayBuilder().setContent(field.value));
|
|
2651
|
+
this.fieldAddText(container, { name: field.name, value: field.value });
|
|
2650
2652
|
}
|
|
2651
2653
|
if (field.separator !== false) {
|
|
2652
2654
|
container.addSeparatorComponents(this.separator(field.separator));
|
|
@@ -2846,7 +2848,7 @@ var SimpleMutex = class {
|
|
|
2846
2848
|
// package.json
|
|
2847
2849
|
var package_default = {
|
|
2848
2850
|
name: "@spatulox/simplediscordbot",
|
|
2849
|
-
version: "1.
|
|
2851
|
+
version: "1.6.0",
|
|
2850
2852
|
author: "Spatulox",
|
|
2851
2853
|
description: "Simple discord bot framework to set up a bot under 30 secondes",
|
|
2852
2854
|
exports: {
|
package/dist/index.mjs
CHANGED
|
@@ -2544,7 +2544,8 @@ import {
|
|
|
2544
2544
|
MediaGalleryBuilder,
|
|
2545
2545
|
MediaGalleryItemBuilder,
|
|
2546
2546
|
AttachmentBuilder,
|
|
2547
|
-
FileBuilder
|
|
2547
|
+
FileBuilder,
|
|
2548
|
+
ActionRowBuilder as ActionRowBuilder4
|
|
2548
2549
|
} from "discord.js";
|
|
2549
2550
|
var ComponentManager = class {
|
|
2550
2551
|
static get DEFAULT_COLOR() {
|
|
@@ -2617,24 +2618,26 @@ var ComponentManager = class {
|
|
|
2617
2618
|
/**
|
|
2618
2619
|
* Quick field adder
|
|
2619
2620
|
*/
|
|
2621
|
+
static fieldAddText(container, options) {
|
|
2622
|
+
options.name && container.addTextDisplayComponents(new TextDisplayBuilder().setContent(`__**${options.name}**__`));
|
|
2623
|
+
container.addTextDisplayComponents(new TextDisplayBuilder().setContent(options.value));
|
|
2624
|
+
}
|
|
2620
2625
|
static field(container, field) {
|
|
2621
|
-
if ("button" in field
|
|
2626
|
+
if ("button" in field && Array.isArray(field.button) && field.button.length > 0) {
|
|
2627
|
+
const actionRow = new ActionRowBuilder4().addComponents(field.button);
|
|
2628
|
+
this.fieldAddText(container, { name: field.name, value: field.value });
|
|
2629
|
+
container.addActionRowComponents(actionRow);
|
|
2630
|
+
} else if ("button" in field && !Array.isArray(field.button) || "thumbnailUrl" in field) {
|
|
2622
2631
|
const section = new SectionBuilder();
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
}
|
|
2626
|
-
section.addTextDisplayComponents(new TextDisplayBuilder().setContent(field.value));
|
|
2627
|
-
if ("button" in field) {
|
|
2632
|
+
this.fieldAddText(section, { name: field.name, value: field.value });
|
|
2633
|
+
if ("button" in field && !Array.isArray(field.button)) {
|
|
2628
2634
|
section.setButtonAccessory(field.button);
|
|
2629
2635
|
} else if ("thumbnailUrl" in field) {
|
|
2630
2636
|
section.setThumbnailAccessory(new ThumbnailBuilder().setURL(field.thumbnailUrl));
|
|
2631
2637
|
}
|
|
2632
2638
|
container.addSectionComponents(section);
|
|
2633
2639
|
} else {
|
|
2634
|
-
|
|
2635
|
-
container.addTextDisplayComponents(new TextDisplayBuilder().setContent(`**${field.name}**`));
|
|
2636
|
-
}
|
|
2637
|
-
container.addTextDisplayComponents(new TextDisplayBuilder().setContent(field.value));
|
|
2640
|
+
this.fieldAddText(container, { name: field.name, value: field.value });
|
|
2638
2641
|
}
|
|
2639
2642
|
if (field.separator !== false) {
|
|
2640
2643
|
container.addSeparatorComponents(this.separator(field.separator));
|
|
@@ -2739,7 +2742,7 @@ var ComponentManager = class {
|
|
|
2739
2742
|
import {
|
|
2740
2743
|
ButtonBuilder as ButtonBuilder2,
|
|
2741
2744
|
ButtonStyle,
|
|
2742
|
-
ActionRowBuilder as
|
|
2745
|
+
ActionRowBuilder as ActionRowBuilder5,
|
|
2743
2746
|
MessageFlags as MessageFlags5
|
|
2744
2747
|
} from "discord.js";
|
|
2745
2748
|
var ButtonManager = class _ButtonManager {
|
|
@@ -2775,7 +2778,7 @@ var ButtonManager = class _ButtonManager {
|
|
|
2775
2778
|
}
|
|
2776
2779
|
static row(but) {
|
|
2777
2780
|
const buttons = Array.isArray(but) ? but.slice(0, 5) : [but];
|
|
2778
|
-
return new
|
|
2781
|
+
return new ActionRowBuilder5().addComponents(buttons);
|
|
2779
2782
|
}
|
|
2780
2783
|
static toMessage(button) {
|
|
2781
2784
|
return {
|
|
@@ -2791,10 +2794,10 @@ var ButtonManager = class _ButtonManager {
|
|
|
2791
2794
|
static createRowsToReturn(button) {
|
|
2792
2795
|
if (Array.isArray(button)) {
|
|
2793
2796
|
return button.map(
|
|
2794
|
-
(btn) => btn instanceof
|
|
2797
|
+
(btn) => btn instanceof ActionRowBuilder5 ? btn : _ButtonManager.row(btn)
|
|
2795
2798
|
);
|
|
2796
2799
|
}
|
|
2797
|
-
return button instanceof
|
|
2800
|
+
return button instanceof ActionRowBuilder5 ? [button] : [_ButtonManager.row(button)];
|
|
2798
2801
|
}
|
|
2799
2802
|
};
|
|
2800
2803
|
|
|
@@ -2839,7 +2842,7 @@ var SimpleMutex = class {
|
|
|
2839
2842
|
// package.json
|
|
2840
2843
|
var package_default = {
|
|
2841
2844
|
name: "@spatulox/simplediscordbot",
|
|
2842
|
-
version: "1.
|
|
2845
|
+
version: "1.6.0",
|
|
2843
2846
|
author: "Spatulox",
|
|
2844
2847
|
description: "Simple discord bot framework to set up a bot under 30 secondes",
|
|
2845
2848
|
exports: {
|