@spatulox/simplediscordbot 1.6.1 → 1.6.2
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/README.md +3 -3
- package/dist/index.d.mts +104 -95
- package/dist/index.d.ts +104 -95
- package/dist/index.js +120 -80
- package/dist/index.mjs +123 -82
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
> - Include the [DiscordInterationManager](https://github.com/Spatulox/DiscordInteractionManager) package
|
|
13
13
|
> - Simple Log package
|
|
14
14
|
> - Provides easy Managers to avoid repetitive code everywhere
|
|
15
|
-
> - Simple yet powerful builders (Embeds, Modals, SelectMenus, Components) that rely on discord.js for full compatibility
|
|
15
|
+
> - Simple yet powerful builders (Embeds, Modals, SelectMenus, Components, Buttons) that rely on discord.js for full compatibility
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
@@ -29,7 +29,7 @@ DISCORD_BOT_CLIENTID="" // Yout bot client id
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
```typescript
|
|
32
|
-
import {Bot, BotConfig,
|
|
32
|
+
import {Bot, BotConfig, SimpleColor, Time} from "@spatulox/simplediscordbot";
|
|
33
33
|
import {Client, Events, GatewayIntentBits} from "discord.js";
|
|
34
34
|
|
|
35
35
|
const client = new Client({
|
|
@@ -37,7 +37,7 @@ const client = new Client({
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
const config: BotConfig = {
|
|
40
|
-
|
|
40
|
+
defaultSimpleColor: SimpleColor.blue,
|
|
41
41
|
botName: "Simple Discord Bot",
|
|
42
42
|
log: {
|
|
43
43
|
logChannelId: "YOUR_LOG_CHANNEL_ID",
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EmbedBuilder, ActionRowBuilder, MessageActionRowComponentBuilder, Message,
|
|
1
|
+
import { EmbedBuilder, ContainerBuilder, ActionRowBuilder, MessageActionRowComponentBuilder, Message, TextChannel, DMChannel, ThreadChannel, MessageCreateOptions, User, GuildMember, BaseInteraction, InteractionResponse, Client, ActivityType, InteractionDeferReplyOptions, InteractionReplyOptions, InteractionEditReplyOptions, WebhookMessageCreateOptions, EmojiResolvable, Guild, BanOptions, Snowflake, GuildBasedChannel, GuildChannelCreateOptions, ForumChannel, NewsChannel, StageChannel, StartThreadOptions, VoiceChannel, Invite, Channel, Collection, GuildBan, ModalBuilder, StringSelectMenuBuilder, UserSelectMenuBuilder, RoleSelectMenuBuilder, MentionableSelectMenuBuilder, ChannelSelectMenuBuilder, ChannelType, SeparatorSpacingSize, ButtonBuilder, AttachmentBuilder, ButtonStyle } from 'discord.js';
|
|
2
2
|
|
|
3
|
-
type SendableComponent = EmbedBuilder | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
3
|
+
type SendableComponent = EmbedBuilder | ContainerBuilder | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
4
4
|
|
|
5
5
|
type ConfigLog = {
|
|
6
6
|
logChannelId: string;
|
|
@@ -53,7 +53,44 @@ declare class BotLog {
|
|
|
53
53
|
static debug(content: string | SendableComponent): Promise<Message | void>;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
declare
|
|
56
|
+
declare class BotMessage {
|
|
57
|
+
/**
|
|
58
|
+
* Send message to any text-based channel
|
|
59
|
+
*/
|
|
60
|
+
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content?: string | null, component?: SendableComponent): Promise<Message | null>;
|
|
61
|
+
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content: SendableComponent): Promise<Message | null>;
|
|
62
|
+
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content: MessageCreateOptions): Promise<Message | null>;
|
|
63
|
+
static sendDM(user: User | GuildMember | string, content?: string, component?: SendableComponent): Promise<Message | null>;
|
|
64
|
+
/**
|
|
65
|
+
* Quick success message
|
|
66
|
+
*/
|
|
67
|
+
static success(channel: TextChannel | DMChannel | ThreadChannel | User | GuildMember, message: string): Promise<Message | null>;
|
|
68
|
+
/**
|
|
69
|
+
* Quick error message
|
|
70
|
+
*/
|
|
71
|
+
static error(channel: TextChannel | DMChannel | ThreadChannel | User | GuildMember, message: string): Promise<Message | null>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare class BotInteraction {
|
|
75
|
+
/**
|
|
76
|
+
* InteractionReplyOptions && InteractionUpdateOptions
|
|
77
|
+
* The two have "content", "embeds" & "flags" field, so an internal cast is ok, unless discord/discordjs deprecate it
|
|
78
|
+
*/
|
|
79
|
+
private static buildReplyOptions;
|
|
80
|
+
private static buildUpdateOptions;
|
|
81
|
+
private static _buildOptions;
|
|
82
|
+
static send(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
83
|
+
static send(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
84
|
+
static reply(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
85
|
+
static reply(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
86
|
+
static followUp(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
87
|
+
static followUp(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
88
|
+
static defer(interaction: BaseInteraction): Promise<void>;
|
|
89
|
+
static update(interaction: BaseInteraction, content: SendableComponent): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
90
|
+
static update(interaction: BaseInteraction, content: string, component: SendableComponent): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare enum SimpleColor {
|
|
57
94
|
transparent = "transparent",
|
|
58
95
|
error = 8912917,
|
|
59
96
|
success = 65280,
|
|
@@ -92,95 +129,9 @@ declare enum EmbedColor {
|
|
|
92
129
|
default = 6064856,
|
|
93
130
|
minecraft = 25600
|
|
94
131
|
}
|
|
95
|
-
declare class EmbedManager {
|
|
96
|
-
private static get BOT_ICON();
|
|
97
|
-
private static get DEFAULT_COLOR();
|
|
98
|
-
/**
|
|
99
|
-
* Creates base embed - SAME SIMPLE API !
|
|
100
|
-
*/
|
|
101
|
-
static create(color?: EmbedColor | null): EmbedBuilder;
|
|
102
|
-
/**
|
|
103
|
-
* Creates simple embed with just description
|
|
104
|
-
*/
|
|
105
|
-
static simple(description: string, color?: EmbedColor | null): EmbedBuilder;
|
|
106
|
-
/**
|
|
107
|
-
* Creates error embed
|
|
108
|
-
*/
|
|
109
|
-
static error(description: string): EmbedBuilder;
|
|
110
|
-
/**
|
|
111
|
-
* Creates success embed
|
|
112
|
-
*/
|
|
113
|
-
static success(description: string): EmbedBuilder;
|
|
114
|
-
/**
|
|
115
|
-
* Creates a simple description embed
|
|
116
|
-
*/
|
|
117
|
-
static description(description: string): EmbedBuilder;
|
|
118
|
-
/**
|
|
119
|
-
* Creates debug embed
|
|
120
|
-
*/
|
|
121
|
-
static debug(description: string): EmbedBuilder;
|
|
122
|
-
/**
|
|
123
|
-
* Defer ephemeral reply
|
|
124
|
-
*/
|
|
125
|
-
static deferEphemeral(): InteractionDeferReplyOptions;
|
|
126
|
-
/**
|
|
127
|
-
* Quick field adder
|
|
128
|
-
*/
|
|
129
|
-
static field(embed: EmbedBuilder, name: string, value: string, inline?: boolean): EmbedBuilder;
|
|
130
|
-
static fields(embed: EmbedBuilder, fields: {
|
|
131
|
-
name: string;
|
|
132
|
-
value: string;
|
|
133
|
-
inline?: boolean;
|
|
134
|
-
}[]): EmbedBuilder;
|
|
135
|
-
/**
|
|
136
|
-
* Transform embed into objet for interaction.reply()
|
|
137
|
-
*/
|
|
138
|
-
static toInteraction(embed: EmbedBuilder, ephemeral?: boolean): InteractionReplyOptions | InteractionEditReplyOptions;
|
|
139
|
-
/**
|
|
140
|
-
* Transform embed into objet to send a message
|
|
141
|
-
*/
|
|
142
|
-
static toMessage(embed: EmbedBuilder): MessageCreateOptions;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
declare class BotMessage {
|
|
146
|
-
/**
|
|
147
|
-
* Send message to any text-based channel
|
|
148
|
-
*/
|
|
149
|
-
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content?: string | null, component?: SendableComponent): Promise<Message | null>;
|
|
150
|
-
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content: SendableComponent): Promise<Message | null>;
|
|
151
|
-
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content: MessageCreateOptions): Promise<Message | null>;
|
|
152
|
-
static sendDM(user: User | GuildMember | string, content?: string, component?: SendableComponent): Promise<Message | null>;
|
|
153
|
-
/**
|
|
154
|
-
* Quick success message
|
|
155
|
-
*/
|
|
156
|
-
static success(channel: TextChannel | DMChannel | ThreadChannel | User | GuildMember, message: string): Promise<Message | null>;
|
|
157
|
-
/**
|
|
158
|
-
* Quick error message
|
|
159
|
-
*/
|
|
160
|
-
static error(channel: TextChannel | DMChannel | ThreadChannel | User | GuildMember, message: string): Promise<Message | null>;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
declare class BotInteraction {
|
|
164
|
-
/**
|
|
165
|
-
* InteractionReplyOptions && InteractionUpdateOptions
|
|
166
|
-
* The two have "content", "embeds" & "flags" field, so an internal cast is ok, unless discord/discordjs deprecate it
|
|
167
|
-
*/
|
|
168
|
-
private static buildReplyOptions;
|
|
169
|
-
private static buildUpdateOptions;
|
|
170
|
-
private static _buildOptions;
|
|
171
|
-
static send(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
172
|
-
static send(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
173
|
-
static reply(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
174
|
-
static reply(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
175
|
-
static followUp(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
176
|
-
static followUp(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
177
|
-
static defer(interaction: BaseInteraction): Promise<void>;
|
|
178
|
-
static update(interaction: BaseInteraction, content: SendableComponent): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
179
|
-
static update(interaction: BaseInteraction, content: string, component: SendableComponent): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
180
|
-
}
|
|
181
132
|
|
|
182
133
|
type BotConfig = {
|
|
183
|
-
|
|
134
|
+
defaultSimpleColor?: number | SimpleColor;
|
|
184
135
|
botName?: string;
|
|
185
136
|
log?: ConfigLog;
|
|
186
137
|
};
|
|
@@ -251,6 +202,60 @@ declare class FileManager {
|
|
|
251
202
|
static writeJsonFile(directoryPath: string, filename: string, data: any, sendErrorToErrorChannel?: boolean): Promise<boolean>;
|
|
252
203
|
}
|
|
253
204
|
|
|
205
|
+
declare class EmbedManager {
|
|
206
|
+
private static get BOT_ICON();
|
|
207
|
+
private static get DEFAULT_COLOR();
|
|
208
|
+
/**
|
|
209
|
+
* Creates base embed - SAME SIMPLE API !
|
|
210
|
+
*/
|
|
211
|
+
static create(color?: SimpleColor | null): EmbedBuilder;
|
|
212
|
+
/**
|
|
213
|
+
* Creates simple embed with just description
|
|
214
|
+
*/
|
|
215
|
+
static simple(description: string, color?: SimpleColor | null): EmbedBuilder;
|
|
216
|
+
/**
|
|
217
|
+
* Creates error embed
|
|
218
|
+
*/
|
|
219
|
+
static error(description: string): EmbedBuilder;
|
|
220
|
+
/**
|
|
221
|
+
* Creates success embed
|
|
222
|
+
*/
|
|
223
|
+
static success(description: string): EmbedBuilder;
|
|
224
|
+
/**
|
|
225
|
+
* Creates a simple description embed
|
|
226
|
+
*/
|
|
227
|
+
static description(description: string): EmbedBuilder;
|
|
228
|
+
/**
|
|
229
|
+
* Creates debug embed
|
|
230
|
+
*/
|
|
231
|
+
static debug(description: string): EmbedBuilder;
|
|
232
|
+
/**
|
|
233
|
+
* Defer ephemeral reply
|
|
234
|
+
*/
|
|
235
|
+
static deferEphemeral(): InteractionDeferReplyOptions;
|
|
236
|
+
/**
|
|
237
|
+
* Quick field adder
|
|
238
|
+
*/
|
|
239
|
+
static field(embed: EmbedBuilder, name: string, value: string, inline?: boolean): EmbedBuilder;
|
|
240
|
+
static fields(embed: EmbedBuilder, fields: {
|
|
241
|
+
name: string;
|
|
242
|
+
value: string;
|
|
243
|
+
inline?: boolean;
|
|
244
|
+
}[]): EmbedBuilder;
|
|
245
|
+
/**
|
|
246
|
+
* Transform embed into objet for interaction.reply()
|
|
247
|
+
*/
|
|
248
|
+
static toInteraction(embed: EmbedBuilder, ephemeral?: boolean): InteractionReplyOptions;
|
|
249
|
+
/**
|
|
250
|
+
* Transform embed into objet for interaction.editReply()
|
|
251
|
+
*/
|
|
252
|
+
static toInteractionEdit(embed: EmbedBuilder): InteractionEditReplyOptions;
|
|
253
|
+
/**
|
|
254
|
+
* Transform embed into objet to send a message
|
|
255
|
+
*/
|
|
256
|
+
static toMessage(embed: EmbedBuilder): MessageCreateOptions;
|
|
257
|
+
}
|
|
258
|
+
|
|
254
259
|
declare class WebhookManager {
|
|
255
260
|
private readonly channel;
|
|
256
261
|
private readonly name;
|
|
@@ -665,7 +670,8 @@ declare class SelectMenuManager {
|
|
|
665
670
|
*/
|
|
666
671
|
static rows(...components: MessageActionRowComponentBuilder[]): ActionRowBuilder<MessageActionRowComponentBuilder>[];
|
|
667
672
|
static toMessage(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[]): MessageCreateOptions;
|
|
668
|
-
static toInteraction(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[], ephemeral?: boolean): InteractionReplyOptions
|
|
673
|
+
static toInteraction(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[], ephemeral?: boolean): InteractionReplyOptions;
|
|
674
|
+
static toInteractionEdit(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[]): InteractionEditReplyOptions;
|
|
669
675
|
private static _createRowsToReturn;
|
|
670
676
|
}
|
|
671
677
|
|
|
@@ -684,7 +690,7 @@ type ComponentManagerField = ComponentManagerFieldAccessory | ComponentManagerFi
|
|
|
684
690
|
interface ComponentManagerCreate {
|
|
685
691
|
title?: string | null;
|
|
686
692
|
description?: string | null;
|
|
687
|
-
color?:
|
|
693
|
+
color?: SimpleColor | null;
|
|
688
694
|
thumbnailUrl?: string;
|
|
689
695
|
separator?: SeparatorSpacingSize | false;
|
|
690
696
|
}
|
|
@@ -702,7 +708,7 @@ declare class ComponentManager {
|
|
|
702
708
|
/**
|
|
703
709
|
* Creates simple ComponentV2 with just description
|
|
704
710
|
*/
|
|
705
|
-
static simple(description: string, color?:
|
|
711
|
+
static simple(description: string, color?: SimpleColor | null): ContainerBuilder;
|
|
706
712
|
/**
|
|
707
713
|
* Creates success ComponentV2
|
|
708
714
|
*/
|
|
@@ -757,6 +763,8 @@ declare class ComponentManager {
|
|
|
757
763
|
* @param footer Sometimes you don't want to have the Bot name neither the timestamp...
|
|
758
764
|
*/
|
|
759
765
|
static toMessage(container: ContainerBuilder, file?: AttachmentBuilder | AttachmentBuilder[] | null, footer?: boolean): MessageCreateOptions;
|
|
766
|
+
static toInteraction(container: ContainerBuilder, file?: AttachmentBuilder | AttachmentBuilder[] | null, footer?: boolean): InteractionReplyOptions;
|
|
767
|
+
static toInteractionEdit(container: ContainerBuilder, file?: AttachmentBuilder | AttachmentBuilder[] | null, footer?: boolean): InteractionEditReplyOptions;
|
|
760
768
|
}
|
|
761
769
|
|
|
762
770
|
interface ButtonOptions {
|
|
@@ -782,7 +790,8 @@ declare class ButtonManager {
|
|
|
782
790
|
static row(but: ButtonBuilder): ActionRowBuilder<ButtonBuilder>;
|
|
783
791
|
static row(but: ButtonBuilder[]): ActionRowBuilder<ButtonBuilder>;
|
|
784
792
|
static toMessage(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[]): MessageCreateOptions;
|
|
785
|
-
static toInteraction(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[], ephemeral?: boolean): InteractionReplyOptions
|
|
793
|
+
static toInteraction(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[], ephemeral?: boolean): InteractionReplyOptions;
|
|
794
|
+
static toInteractionEdit(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[]): InteractionEditReplyOptions;
|
|
786
795
|
private static createRowsToReturn;
|
|
787
796
|
}
|
|
788
797
|
|
|
@@ -1071,4 +1080,4 @@ declare const SimpleDiscordBotInfo: {
|
|
|
1071
1080
|
license: string;
|
|
1072
1081
|
};
|
|
1073
1082
|
|
|
1074
|
-
export { Bot, type BotConfig, BotEnv, ButtonManager, ComponentManager, type ComponentManagerField,
|
|
1083
|
+
export { Bot, type BotConfig, BotEnv, ButtonManager, type ButtonOptions, ComponentManager, type ComponentManagerCreate, type ComponentManagerField, type ComponentManagerFileInput, DiscordRegex, EmbedManager, FileManager, GuildManager, Log, type ModalField, ModalFieldType, ModalManager, type RandomBotActivity, ReactionManager, type SelectMenuCreateOption, type SelectMenuList, SelectMenuManager, SimpleColor, SimpleDiscordBotInfo, SimpleMutex, Time, UserManager, WebhookManager };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EmbedBuilder, ActionRowBuilder, MessageActionRowComponentBuilder, Message,
|
|
1
|
+
import { EmbedBuilder, ContainerBuilder, ActionRowBuilder, MessageActionRowComponentBuilder, Message, TextChannel, DMChannel, ThreadChannel, MessageCreateOptions, User, GuildMember, BaseInteraction, InteractionResponse, Client, ActivityType, InteractionDeferReplyOptions, InteractionReplyOptions, InteractionEditReplyOptions, WebhookMessageCreateOptions, EmojiResolvable, Guild, BanOptions, Snowflake, GuildBasedChannel, GuildChannelCreateOptions, ForumChannel, NewsChannel, StageChannel, StartThreadOptions, VoiceChannel, Invite, Channel, Collection, GuildBan, ModalBuilder, StringSelectMenuBuilder, UserSelectMenuBuilder, RoleSelectMenuBuilder, MentionableSelectMenuBuilder, ChannelSelectMenuBuilder, ChannelType, SeparatorSpacingSize, ButtonBuilder, AttachmentBuilder, ButtonStyle } from 'discord.js';
|
|
2
2
|
|
|
3
|
-
type SendableComponent = EmbedBuilder | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
3
|
+
type SendableComponent = EmbedBuilder | ContainerBuilder | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
4
4
|
|
|
5
5
|
type ConfigLog = {
|
|
6
6
|
logChannelId: string;
|
|
@@ -53,7 +53,44 @@ declare class BotLog {
|
|
|
53
53
|
static debug(content: string | SendableComponent): Promise<Message | void>;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
declare
|
|
56
|
+
declare class BotMessage {
|
|
57
|
+
/**
|
|
58
|
+
* Send message to any text-based channel
|
|
59
|
+
*/
|
|
60
|
+
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content?: string | null, component?: SendableComponent): Promise<Message | null>;
|
|
61
|
+
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content: SendableComponent): Promise<Message | null>;
|
|
62
|
+
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content: MessageCreateOptions): Promise<Message | null>;
|
|
63
|
+
static sendDM(user: User | GuildMember | string, content?: string, component?: SendableComponent): Promise<Message | null>;
|
|
64
|
+
/**
|
|
65
|
+
* Quick success message
|
|
66
|
+
*/
|
|
67
|
+
static success(channel: TextChannel | DMChannel | ThreadChannel | User | GuildMember, message: string): Promise<Message | null>;
|
|
68
|
+
/**
|
|
69
|
+
* Quick error message
|
|
70
|
+
*/
|
|
71
|
+
static error(channel: TextChannel | DMChannel | ThreadChannel | User | GuildMember, message: string): Promise<Message | null>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare class BotInteraction {
|
|
75
|
+
/**
|
|
76
|
+
* InteractionReplyOptions && InteractionUpdateOptions
|
|
77
|
+
* The two have "content", "embeds" & "flags" field, so an internal cast is ok, unless discord/discordjs deprecate it
|
|
78
|
+
*/
|
|
79
|
+
private static buildReplyOptions;
|
|
80
|
+
private static buildUpdateOptions;
|
|
81
|
+
private static _buildOptions;
|
|
82
|
+
static send(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
83
|
+
static send(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
84
|
+
static reply(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
85
|
+
static reply(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
86
|
+
static followUp(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
87
|
+
static followUp(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
88
|
+
static defer(interaction: BaseInteraction): Promise<void>;
|
|
89
|
+
static update(interaction: BaseInteraction, content: SendableComponent): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
90
|
+
static update(interaction: BaseInteraction, content: string, component: SendableComponent): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare enum SimpleColor {
|
|
57
94
|
transparent = "transparent",
|
|
58
95
|
error = 8912917,
|
|
59
96
|
success = 65280,
|
|
@@ -92,95 +129,9 @@ declare enum EmbedColor {
|
|
|
92
129
|
default = 6064856,
|
|
93
130
|
minecraft = 25600
|
|
94
131
|
}
|
|
95
|
-
declare class EmbedManager {
|
|
96
|
-
private static get BOT_ICON();
|
|
97
|
-
private static get DEFAULT_COLOR();
|
|
98
|
-
/**
|
|
99
|
-
* Creates base embed - SAME SIMPLE API !
|
|
100
|
-
*/
|
|
101
|
-
static create(color?: EmbedColor | null): EmbedBuilder;
|
|
102
|
-
/**
|
|
103
|
-
* Creates simple embed with just description
|
|
104
|
-
*/
|
|
105
|
-
static simple(description: string, color?: EmbedColor | null): EmbedBuilder;
|
|
106
|
-
/**
|
|
107
|
-
* Creates error embed
|
|
108
|
-
*/
|
|
109
|
-
static error(description: string): EmbedBuilder;
|
|
110
|
-
/**
|
|
111
|
-
* Creates success embed
|
|
112
|
-
*/
|
|
113
|
-
static success(description: string): EmbedBuilder;
|
|
114
|
-
/**
|
|
115
|
-
* Creates a simple description embed
|
|
116
|
-
*/
|
|
117
|
-
static description(description: string): EmbedBuilder;
|
|
118
|
-
/**
|
|
119
|
-
* Creates debug embed
|
|
120
|
-
*/
|
|
121
|
-
static debug(description: string): EmbedBuilder;
|
|
122
|
-
/**
|
|
123
|
-
* Defer ephemeral reply
|
|
124
|
-
*/
|
|
125
|
-
static deferEphemeral(): InteractionDeferReplyOptions;
|
|
126
|
-
/**
|
|
127
|
-
* Quick field adder
|
|
128
|
-
*/
|
|
129
|
-
static field(embed: EmbedBuilder, name: string, value: string, inline?: boolean): EmbedBuilder;
|
|
130
|
-
static fields(embed: EmbedBuilder, fields: {
|
|
131
|
-
name: string;
|
|
132
|
-
value: string;
|
|
133
|
-
inline?: boolean;
|
|
134
|
-
}[]): EmbedBuilder;
|
|
135
|
-
/**
|
|
136
|
-
* Transform embed into objet for interaction.reply()
|
|
137
|
-
*/
|
|
138
|
-
static toInteraction(embed: EmbedBuilder, ephemeral?: boolean): InteractionReplyOptions | InteractionEditReplyOptions;
|
|
139
|
-
/**
|
|
140
|
-
* Transform embed into objet to send a message
|
|
141
|
-
*/
|
|
142
|
-
static toMessage(embed: EmbedBuilder): MessageCreateOptions;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
declare class BotMessage {
|
|
146
|
-
/**
|
|
147
|
-
* Send message to any text-based channel
|
|
148
|
-
*/
|
|
149
|
-
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content?: string | null, component?: SendableComponent): Promise<Message | null>;
|
|
150
|
-
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content: SendableComponent): Promise<Message | null>;
|
|
151
|
-
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content: MessageCreateOptions): Promise<Message | null>;
|
|
152
|
-
static sendDM(user: User | GuildMember | string, content?: string, component?: SendableComponent): Promise<Message | null>;
|
|
153
|
-
/**
|
|
154
|
-
* Quick success message
|
|
155
|
-
*/
|
|
156
|
-
static success(channel: TextChannel | DMChannel | ThreadChannel | User | GuildMember, message: string): Promise<Message | null>;
|
|
157
|
-
/**
|
|
158
|
-
* Quick error message
|
|
159
|
-
*/
|
|
160
|
-
static error(channel: TextChannel | DMChannel | ThreadChannel | User | GuildMember, message: string): Promise<Message | null>;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
declare class BotInteraction {
|
|
164
|
-
/**
|
|
165
|
-
* InteractionReplyOptions && InteractionUpdateOptions
|
|
166
|
-
* The two have "content", "embeds" & "flags" field, so an internal cast is ok, unless discord/discordjs deprecate it
|
|
167
|
-
*/
|
|
168
|
-
private static buildReplyOptions;
|
|
169
|
-
private static buildUpdateOptions;
|
|
170
|
-
private static _buildOptions;
|
|
171
|
-
static send(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
172
|
-
static send(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
173
|
-
static reply(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
174
|
-
static reply(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
175
|
-
static followUp(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
176
|
-
static followUp(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
177
|
-
static defer(interaction: BaseInteraction): Promise<void>;
|
|
178
|
-
static update(interaction: BaseInteraction, content: SendableComponent): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
179
|
-
static update(interaction: BaseInteraction, content: string, component: SendableComponent): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
180
|
-
}
|
|
181
132
|
|
|
182
133
|
type BotConfig = {
|
|
183
|
-
|
|
134
|
+
defaultSimpleColor?: number | SimpleColor;
|
|
184
135
|
botName?: string;
|
|
185
136
|
log?: ConfigLog;
|
|
186
137
|
};
|
|
@@ -251,6 +202,60 @@ declare class FileManager {
|
|
|
251
202
|
static writeJsonFile(directoryPath: string, filename: string, data: any, sendErrorToErrorChannel?: boolean): Promise<boolean>;
|
|
252
203
|
}
|
|
253
204
|
|
|
205
|
+
declare class EmbedManager {
|
|
206
|
+
private static get BOT_ICON();
|
|
207
|
+
private static get DEFAULT_COLOR();
|
|
208
|
+
/**
|
|
209
|
+
* Creates base embed - SAME SIMPLE API !
|
|
210
|
+
*/
|
|
211
|
+
static create(color?: SimpleColor | null): EmbedBuilder;
|
|
212
|
+
/**
|
|
213
|
+
* Creates simple embed with just description
|
|
214
|
+
*/
|
|
215
|
+
static simple(description: string, color?: SimpleColor | null): EmbedBuilder;
|
|
216
|
+
/**
|
|
217
|
+
* Creates error embed
|
|
218
|
+
*/
|
|
219
|
+
static error(description: string): EmbedBuilder;
|
|
220
|
+
/**
|
|
221
|
+
* Creates success embed
|
|
222
|
+
*/
|
|
223
|
+
static success(description: string): EmbedBuilder;
|
|
224
|
+
/**
|
|
225
|
+
* Creates a simple description embed
|
|
226
|
+
*/
|
|
227
|
+
static description(description: string): EmbedBuilder;
|
|
228
|
+
/**
|
|
229
|
+
* Creates debug embed
|
|
230
|
+
*/
|
|
231
|
+
static debug(description: string): EmbedBuilder;
|
|
232
|
+
/**
|
|
233
|
+
* Defer ephemeral reply
|
|
234
|
+
*/
|
|
235
|
+
static deferEphemeral(): InteractionDeferReplyOptions;
|
|
236
|
+
/**
|
|
237
|
+
* Quick field adder
|
|
238
|
+
*/
|
|
239
|
+
static field(embed: EmbedBuilder, name: string, value: string, inline?: boolean): EmbedBuilder;
|
|
240
|
+
static fields(embed: EmbedBuilder, fields: {
|
|
241
|
+
name: string;
|
|
242
|
+
value: string;
|
|
243
|
+
inline?: boolean;
|
|
244
|
+
}[]): EmbedBuilder;
|
|
245
|
+
/**
|
|
246
|
+
* Transform embed into objet for interaction.reply()
|
|
247
|
+
*/
|
|
248
|
+
static toInteraction(embed: EmbedBuilder, ephemeral?: boolean): InteractionReplyOptions;
|
|
249
|
+
/**
|
|
250
|
+
* Transform embed into objet for interaction.editReply()
|
|
251
|
+
*/
|
|
252
|
+
static toInteractionEdit(embed: EmbedBuilder): InteractionEditReplyOptions;
|
|
253
|
+
/**
|
|
254
|
+
* Transform embed into objet to send a message
|
|
255
|
+
*/
|
|
256
|
+
static toMessage(embed: EmbedBuilder): MessageCreateOptions;
|
|
257
|
+
}
|
|
258
|
+
|
|
254
259
|
declare class WebhookManager {
|
|
255
260
|
private readonly channel;
|
|
256
261
|
private readonly name;
|
|
@@ -665,7 +670,8 @@ declare class SelectMenuManager {
|
|
|
665
670
|
*/
|
|
666
671
|
static rows(...components: MessageActionRowComponentBuilder[]): ActionRowBuilder<MessageActionRowComponentBuilder>[];
|
|
667
672
|
static toMessage(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[]): MessageCreateOptions;
|
|
668
|
-
static toInteraction(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[], ephemeral?: boolean): InteractionReplyOptions
|
|
673
|
+
static toInteraction(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[], ephemeral?: boolean): InteractionReplyOptions;
|
|
674
|
+
static toInteractionEdit(menus: SelectMenuList | SelectMenuList[] | ActionRowBuilder<MessageActionRowComponentBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>[]): InteractionEditReplyOptions;
|
|
669
675
|
private static _createRowsToReturn;
|
|
670
676
|
}
|
|
671
677
|
|
|
@@ -684,7 +690,7 @@ type ComponentManagerField = ComponentManagerFieldAccessory | ComponentManagerFi
|
|
|
684
690
|
interface ComponentManagerCreate {
|
|
685
691
|
title?: string | null;
|
|
686
692
|
description?: string | null;
|
|
687
|
-
color?:
|
|
693
|
+
color?: SimpleColor | null;
|
|
688
694
|
thumbnailUrl?: string;
|
|
689
695
|
separator?: SeparatorSpacingSize | false;
|
|
690
696
|
}
|
|
@@ -702,7 +708,7 @@ declare class ComponentManager {
|
|
|
702
708
|
/**
|
|
703
709
|
* Creates simple ComponentV2 with just description
|
|
704
710
|
*/
|
|
705
|
-
static simple(description: string, color?:
|
|
711
|
+
static simple(description: string, color?: SimpleColor | null): ContainerBuilder;
|
|
706
712
|
/**
|
|
707
713
|
* Creates success ComponentV2
|
|
708
714
|
*/
|
|
@@ -757,6 +763,8 @@ declare class ComponentManager {
|
|
|
757
763
|
* @param footer Sometimes you don't want to have the Bot name neither the timestamp...
|
|
758
764
|
*/
|
|
759
765
|
static toMessage(container: ContainerBuilder, file?: AttachmentBuilder | AttachmentBuilder[] | null, footer?: boolean): MessageCreateOptions;
|
|
766
|
+
static toInteraction(container: ContainerBuilder, file?: AttachmentBuilder | AttachmentBuilder[] | null, footer?: boolean): InteractionReplyOptions;
|
|
767
|
+
static toInteractionEdit(container: ContainerBuilder, file?: AttachmentBuilder | AttachmentBuilder[] | null, footer?: boolean): InteractionEditReplyOptions;
|
|
760
768
|
}
|
|
761
769
|
|
|
762
770
|
interface ButtonOptions {
|
|
@@ -782,7 +790,8 @@ declare class ButtonManager {
|
|
|
782
790
|
static row(but: ButtonBuilder): ActionRowBuilder<ButtonBuilder>;
|
|
783
791
|
static row(but: ButtonBuilder[]): ActionRowBuilder<ButtonBuilder>;
|
|
784
792
|
static toMessage(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[]): MessageCreateOptions;
|
|
785
|
-
static toInteraction(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[], ephemeral?: boolean): InteractionReplyOptions
|
|
793
|
+
static toInteraction(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[], ephemeral?: boolean): InteractionReplyOptions;
|
|
794
|
+
static toInteractionEdit(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[]): InteractionEditReplyOptions;
|
|
786
795
|
private static createRowsToReturn;
|
|
787
796
|
}
|
|
788
797
|
|
|
@@ -1071,4 +1080,4 @@ declare const SimpleDiscordBotInfo: {
|
|
|
1071
1080
|
license: string;
|
|
1072
1081
|
};
|
|
1073
1082
|
|
|
1074
|
-
export { Bot, type BotConfig, BotEnv, ButtonManager, ComponentManager, type ComponentManagerField,
|
|
1083
|
+
export { Bot, type BotConfig, BotEnv, ButtonManager, type ButtonOptions, ComponentManager, type ComponentManagerCreate, type ComponentManagerField, type ComponentManagerFileInput, DiscordRegex, EmbedManager, FileManager, GuildManager, Log, type ModalField, ModalFieldType, ModalManager, type RandomBotActivity, ReactionManager, type SelectMenuCreateOption, type SelectMenuList, SelectMenuManager, SimpleColor, SimpleDiscordBotInfo, SimpleMutex, Time, UserManager, WebhookManager };
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,6 @@ __export(index_exports, {
|
|
|
35
35
|
ButtonManager: () => ButtonManager,
|
|
36
36
|
ComponentManager: () => ComponentManager,
|
|
37
37
|
DiscordRegex: () => DiscordRegex,
|
|
38
|
-
EmbedColor: () => EmbedColor,
|
|
39
38
|
EmbedManager: () => EmbedManager,
|
|
40
39
|
FileManager: () => FileManager,
|
|
41
40
|
GuildManager: () => GuildManager,
|
|
@@ -44,6 +43,7 @@ __export(index_exports, {
|
|
|
44
43
|
ModalManager: () => ModalManager,
|
|
45
44
|
ReactionManager: () => ReactionManager,
|
|
46
45
|
SelectMenuManager: () => SelectMenuManager,
|
|
46
|
+
SimpleColor: () => SimpleColor,
|
|
47
47
|
SimpleDiscordBotInfo: () => SimpleDiscordBotInfo,
|
|
48
48
|
SimpleMutex: () => SimpleMutex,
|
|
49
49
|
Time: () => Time,
|
|
@@ -52,10 +52,10 @@ __export(index_exports, {
|
|
|
52
52
|
});
|
|
53
53
|
module.exports = __toCommonJS(index_exports);
|
|
54
54
|
|
|
55
|
-
// src/
|
|
55
|
+
// src/core/Bot.ts
|
|
56
56
|
var import_discord5 = require("discord.js");
|
|
57
57
|
|
|
58
|
-
// src/utils/
|
|
58
|
+
// src/utils/UnitTime.ts
|
|
59
59
|
var UnitTime = class {
|
|
60
60
|
constructor(val) {
|
|
61
61
|
this.val = val;
|
|
@@ -295,7 +295,7 @@ var Log = class {
|
|
|
295
295
|
}
|
|
296
296
|
};
|
|
297
297
|
|
|
298
|
-
// src/utils/
|
|
298
|
+
// src/utils/InternetChecker.ts
|
|
299
299
|
var InternetChecker = class {
|
|
300
300
|
/**
|
|
301
301
|
* Check internet connection towards 1.1.1.1 (Cloudflare DNS)
|
|
@@ -342,7 +342,7 @@ InternetChecker.TARGET = "https://1.1.1.1";
|
|
|
342
342
|
// Cloudflare DNS HTTPS
|
|
343
343
|
InternetChecker.RETRY_TIME = Time.second.SEC_30;
|
|
344
344
|
|
|
345
|
-
// src/
|
|
345
|
+
// src/core/BotLog.ts
|
|
346
346
|
var import_discord = require("discord.js");
|
|
347
347
|
var _BotLog = class _BotLog {
|
|
348
348
|
constructor() {
|
|
@@ -470,52 +470,56 @@ var BotLog = _BotLog;
|
|
|
470
470
|
|
|
471
471
|
// src/manager/messages/EmbedManager.ts
|
|
472
472
|
var import_discord2 = require("discord.js");
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
473
|
+
|
|
474
|
+
// src/constants/SimpleColor.ts
|
|
475
|
+
var SimpleColor = /* @__PURE__ */ ((SimpleColor2) => {
|
|
476
|
+
SimpleColor2["transparent"] = "transparent";
|
|
477
|
+
SimpleColor2[SimpleColor2["error"] = 8912917] = "error";
|
|
478
|
+
SimpleColor2[SimpleColor2["success"] = 65280] = "success";
|
|
479
|
+
SimpleColor2[SimpleColor2["black"] = 0] = "black";
|
|
480
|
+
SimpleColor2[SimpleColor2["white"] = 16777215] = "white";
|
|
481
|
+
SimpleColor2[SimpleColor2["red"] = 16711680] = "red";
|
|
482
|
+
SimpleColor2[SimpleColor2["green"] = 65280] = "green";
|
|
483
|
+
SimpleColor2[SimpleColor2["blue"] = 255] = "blue";
|
|
484
|
+
SimpleColor2[SimpleColor2["yellow"] = 16776960] = "yellow";
|
|
485
|
+
SimpleColor2[SimpleColor2["cyan"] = 65535] = "cyan";
|
|
486
|
+
SimpleColor2[SimpleColor2["magenta"] = 16711935] = "magenta";
|
|
487
|
+
SimpleColor2[SimpleColor2["gray"] = 8421504] = "gray";
|
|
488
|
+
SimpleColor2[SimpleColor2["lightgray"] = 13882323] = "lightgray";
|
|
489
|
+
SimpleColor2[SimpleColor2["darkgray"] = 11119017] = "darkgray";
|
|
490
|
+
SimpleColor2[SimpleColor2["orange"] = 16753920] = "orange";
|
|
491
|
+
SimpleColor2[SimpleColor2["purple"] = 8388736] = "purple";
|
|
492
|
+
SimpleColor2[SimpleColor2["pink"] = 16761035] = "pink";
|
|
493
|
+
SimpleColor2[SimpleColor2["brown"] = 10824234] = "brown";
|
|
494
|
+
SimpleColor2[SimpleColor2["lime"] = 65280] = "lime";
|
|
495
|
+
SimpleColor2[SimpleColor2["navy"] = 128] = "navy";
|
|
496
|
+
SimpleColor2[SimpleColor2["teal"] = 32896] = "teal";
|
|
497
|
+
SimpleColor2[SimpleColor2["olive"] = 8421376] = "olive";
|
|
498
|
+
SimpleColor2[SimpleColor2["gold"] = 16766720] = "gold";
|
|
499
|
+
SimpleColor2[SimpleColor2["silver"] = 12632256] = "silver";
|
|
500
|
+
SimpleColor2[SimpleColor2["coral"] = 16744272] = "coral";
|
|
501
|
+
SimpleColor2[SimpleColor2["salmon"] = 16416882] = "salmon";
|
|
502
|
+
SimpleColor2[SimpleColor2["khaki"] = 15787660] = "khaki";
|
|
503
|
+
SimpleColor2[SimpleColor2["plum"] = 14524637] = "plum";
|
|
504
|
+
SimpleColor2[SimpleColor2["lavender"] = 15132410] = "lavender";
|
|
505
|
+
SimpleColor2[SimpleColor2["beige"] = 16119260] = "beige";
|
|
506
|
+
SimpleColor2[SimpleColor2["mint"] = 10026904] = "mint";
|
|
507
|
+
SimpleColor2[SimpleColor2["peach"] = 16767673] = "peach";
|
|
508
|
+
SimpleColor2[SimpleColor2["chocolate"] = 13789470] = "chocolate";
|
|
509
|
+
SimpleColor2[SimpleColor2["crimson"] = 14423100] = "crimson";
|
|
510
|
+
SimpleColor2[SimpleColor2["youtube"] = 16718362] = "youtube";
|
|
511
|
+
SimpleColor2[SimpleColor2["default"] = 6064856] = "default";
|
|
512
|
+
SimpleColor2[SimpleColor2["minecraft"] = 25600] = "minecraft";
|
|
513
|
+
return SimpleColor2;
|
|
514
|
+
})(SimpleColor || {});
|
|
515
|
+
|
|
516
|
+
// src/manager/messages/EmbedManager.ts
|
|
513
517
|
var EmbedManager = class {
|
|
514
518
|
static get BOT_ICON() {
|
|
515
519
|
return Bot.client?.user?.displayAvatarURL({ forceStatic: false, size: 128 }) || "";
|
|
516
520
|
}
|
|
517
521
|
static get DEFAULT_COLOR() {
|
|
518
|
-
return Bot.config.
|
|
522
|
+
return Bot.config.defaultSimpleColor || 6064856 /* default */;
|
|
519
523
|
}
|
|
520
524
|
/**
|
|
521
525
|
* Creates base embed - SAME SIMPLE API !
|
|
@@ -591,7 +595,15 @@ var EmbedManager = class {
|
|
|
591
595
|
static toInteraction(embed, ephemeral = false) {
|
|
592
596
|
return {
|
|
593
597
|
embeds: [embed],
|
|
594
|
-
flags: ephemeral ? [import_discord2.MessageFlags.Ephemeral] :
|
|
598
|
+
flags: ephemeral ? [import_discord2.MessageFlags.Ephemeral] : []
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Transform embed into objet for interaction.editReply()
|
|
603
|
+
*/
|
|
604
|
+
static toInteractionEdit(embed) {
|
|
605
|
+
return {
|
|
606
|
+
embeds: [embed]
|
|
595
607
|
};
|
|
596
608
|
}
|
|
597
609
|
/**
|
|
@@ -604,14 +616,14 @@ var EmbedManager = class {
|
|
|
604
616
|
}
|
|
605
617
|
};
|
|
606
618
|
|
|
607
|
-
// src/
|
|
619
|
+
// src/core/BotMessage.ts
|
|
608
620
|
var import_discord4 = require("discord.js");
|
|
609
621
|
|
|
610
622
|
// src/manager/builder/SendableComponentBuilder.ts
|
|
611
623
|
var import_discord3 = require("discord.js");
|
|
612
624
|
var SendableComponentBuilder = class {
|
|
613
625
|
static isSendableComponent(thing) {
|
|
614
|
-
return thing instanceof import_discord3.EmbedBuilder || thing instanceof import_discord3.ActionRowBuilder;
|
|
626
|
+
return thing instanceof import_discord3.EmbedBuilder || thing instanceof import_discord3.ContainerBuilder || thing instanceof import_discord3.ActionRowBuilder;
|
|
615
627
|
}
|
|
616
628
|
static build(base, content, components) {
|
|
617
629
|
if (content) {
|
|
@@ -623,6 +635,10 @@ var SendableComponentBuilder = class {
|
|
|
623
635
|
base.embeds = base.embeds || [];
|
|
624
636
|
base.embeds.push(comp);
|
|
625
637
|
}
|
|
638
|
+
if (comp instanceof import_discord3.ContainerBuilder) {
|
|
639
|
+
base.components = base.components || [];
|
|
640
|
+
base.components.push(comp);
|
|
641
|
+
}
|
|
626
642
|
if (comp instanceof import_discord3.ActionRowBuilder) {
|
|
627
643
|
base.components = base.components || [];
|
|
628
644
|
base.components.push(comp);
|
|
@@ -653,7 +669,7 @@ var SendableComponentBuilder = class {
|
|
|
653
669
|
}
|
|
654
670
|
};
|
|
655
671
|
|
|
656
|
-
// src/
|
|
672
|
+
// src/core/BotMessage.ts
|
|
657
673
|
var BotMessage = class {
|
|
658
674
|
static async send(channel, content, component) {
|
|
659
675
|
try {
|
|
@@ -744,7 +760,7 @@ var BotMessage = class {
|
|
|
744
760
|
}
|
|
745
761
|
};
|
|
746
762
|
|
|
747
|
-
// src/
|
|
763
|
+
// src/constants/DiscordRegex.ts
|
|
748
764
|
var _DiscordRegex = class _DiscordRegex {
|
|
749
765
|
/**
|
|
750
766
|
* Validate Discord ID Discord (18)
|
|
@@ -859,7 +875,7 @@ _DiscordRegex.INVITE = /^discord(?:app\.com\/invite|gg)\/[a-zA-Z0-9]+$/;
|
|
|
859
875
|
_DiscordRegex.EMOJI = /^<a?:[a-zA-Z0-9_]{2,32}:[0-9]{18}>$|^[\u{1F300}-\u{1F5FF}\u{1F600}-\u{1F64F}\u{1F680}-\u{1F6FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}]+$/u;
|
|
860
876
|
var DiscordRegex = _DiscordRegex;
|
|
861
877
|
|
|
862
|
-
// src/
|
|
878
|
+
// src/core/BotEnv.ts
|
|
863
879
|
var BotEnv = {
|
|
864
880
|
get token() {
|
|
865
881
|
const token = process.env.DISCORD_BOT_TOKEN;
|
|
@@ -879,7 +895,7 @@ var BotEnv = {
|
|
|
879
895
|
}
|
|
880
896
|
};
|
|
881
897
|
|
|
882
|
-
// src/
|
|
898
|
+
// src/core/BotInteraction.ts
|
|
883
899
|
var BotInteraction = class {
|
|
884
900
|
/**
|
|
885
901
|
* InteractionReplyOptions && InteractionUpdateOptions
|
|
@@ -955,7 +971,7 @@ var BotInteraction = class {
|
|
|
955
971
|
}
|
|
956
972
|
};
|
|
957
973
|
|
|
958
|
-
// src/
|
|
974
|
+
// src/core/Bot.ts
|
|
959
975
|
var _Bot = class _Bot {
|
|
960
976
|
get config() {
|
|
961
977
|
return _Bot._config;
|
|
@@ -2546,6 +2562,11 @@ var SelectMenuManager = class _SelectMenuManager {
|
|
|
2546
2562
|
flags: ephemeral ? [import_discord16.MessageFlags.Ephemeral] : []
|
|
2547
2563
|
};
|
|
2548
2564
|
}
|
|
2565
|
+
static toInteractionEdit(menus) {
|
|
2566
|
+
return {
|
|
2567
|
+
components: this._createRowsToReturn(menus)
|
|
2568
|
+
};
|
|
2569
|
+
}
|
|
2549
2570
|
static _createRowsToReturn(menus) {
|
|
2550
2571
|
if (Array.isArray(menus)) {
|
|
2551
2572
|
return menus.map(
|
|
@@ -2560,7 +2581,7 @@ var SelectMenuManager = class _SelectMenuManager {
|
|
|
2560
2581
|
var import_discord17 = require("discord.js");
|
|
2561
2582
|
var ComponentManager = class {
|
|
2562
2583
|
static get DEFAULT_COLOR() {
|
|
2563
|
-
return Bot.config?.
|
|
2584
|
+
return Bot.config?.defaultSimpleColor || 6064856 /* default */;
|
|
2564
2585
|
}
|
|
2565
2586
|
/**
|
|
2566
2587
|
* Creates base ComponentV2
|
|
@@ -2655,33 +2676,16 @@ var ComponentManager = class {
|
|
|
2655
2676
|
}
|
|
2656
2677
|
return container;
|
|
2657
2678
|
}
|
|
2658
|
-
/*static field(container: ContainerBuilder, field: ComponentManagerField): ContainerBuilder {
|
|
2659
|
-
const section = new SectionBuilder()
|
|
2660
|
-
.addTextDisplayComponents(
|
|
2661
|
-
new TextDisplayBuilder().setContent(`**${field.name}**`),
|
|
2662
|
-
new TextDisplayBuilder().setContent(field.value)
|
|
2663
|
-
);
|
|
2664
|
-
|
|
2665
|
-
if (field.thumbnailUrl) {
|
|
2666
|
-
section.setThumbnailAccessory(
|
|
2667
|
-
new ThumbnailBuilder().setURL(field.thumbnailUrl)
|
|
2668
|
-
);
|
|
2669
|
-
}
|
|
2670
|
-
|
|
2671
|
-
if (field.button && field.button.length > 0) {
|
|
2672
|
-
section.setButtonAccessory(field.button[0]!);
|
|
2673
|
-
}
|
|
2674
|
-
|
|
2675
|
-
container.addSectionComponents(section);
|
|
2676
|
-
container.addSeparatorComponents(this.separator());
|
|
2677
|
-
return container;
|
|
2678
|
-
}*/
|
|
2679
2679
|
/**
|
|
2680
2680
|
* Multiple fields
|
|
2681
2681
|
*/
|
|
2682
2682
|
static fields(container, fields) {
|
|
2683
|
-
fields.forEach((
|
|
2684
|
-
|
|
2683
|
+
fields.forEach((field, index) => {
|
|
2684
|
+
const finalField = { ...field };
|
|
2685
|
+
if (index === fields.length - 1 && finalField.separator === void 0) {
|
|
2686
|
+
finalField.separator = false;
|
|
2687
|
+
}
|
|
2688
|
+
this.field(container, finalField);
|
|
2685
2689
|
});
|
|
2686
2690
|
return container;
|
|
2687
2691
|
}
|
|
@@ -2747,6 +2751,37 @@ var ComponentManager = class {
|
|
|
2747
2751
|
flags: [import_discord17.MessageFlags.IsComponentsV2]
|
|
2748
2752
|
};
|
|
2749
2753
|
}
|
|
2754
|
+
static toInteraction(container, file = null, footer = true) {
|
|
2755
|
+
if (footer) {
|
|
2756
|
+
this.footer(container);
|
|
2757
|
+
}
|
|
2758
|
+
const base = {
|
|
2759
|
+
components: [container],
|
|
2760
|
+
flags: [import_discord17.MessageFlags.IsComponentsV2]
|
|
2761
|
+
};
|
|
2762
|
+
if (file) {
|
|
2763
|
+
return {
|
|
2764
|
+
...base,
|
|
2765
|
+
files: Array.isArray(file) ? file : [file]
|
|
2766
|
+
};
|
|
2767
|
+
}
|
|
2768
|
+
return base;
|
|
2769
|
+
}
|
|
2770
|
+
static toInteractionEdit(container, file = null, footer = true) {
|
|
2771
|
+
if (footer) {
|
|
2772
|
+
this.footer(container);
|
|
2773
|
+
}
|
|
2774
|
+
const base = {
|
|
2775
|
+
components: [container]
|
|
2776
|
+
};
|
|
2777
|
+
if (file) {
|
|
2778
|
+
return {
|
|
2779
|
+
...base,
|
|
2780
|
+
files: Array.isArray(file) ? file : [file]
|
|
2781
|
+
};
|
|
2782
|
+
}
|
|
2783
|
+
return base;
|
|
2784
|
+
}
|
|
2750
2785
|
};
|
|
2751
2786
|
|
|
2752
2787
|
// src/manager/interactions/ButtonManager.ts
|
|
@@ -2797,6 +2832,11 @@ var ButtonManager = class _ButtonManager {
|
|
|
2797
2832
|
flags: ephemeral ? [import_discord18.MessageFlags.Ephemeral] : []
|
|
2798
2833
|
};
|
|
2799
2834
|
}
|
|
2835
|
+
static toInteractionEdit(button) {
|
|
2836
|
+
return {
|
|
2837
|
+
components: this.createRowsToReturn(button)
|
|
2838
|
+
};
|
|
2839
|
+
}
|
|
2800
2840
|
static createRowsToReturn(button) {
|
|
2801
2841
|
if (Array.isArray(button)) {
|
|
2802
2842
|
return button.map(
|
|
@@ -2848,7 +2888,7 @@ var SimpleMutex = class {
|
|
|
2848
2888
|
// package.json
|
|
2849
2889
|
var package_default = {
|
|
2850
2890
|
name: "@spatulox/simplediscordbot",
|
|
2851
|
-
version: "1.6.
|
|
2891
|
+
version: "1.6.1",
|
|
2852
2892
|
author: "Spatulox",
|
|
2853
2893
|
description: "Simple discord bot framework to set up a bot under 30 secondes",
|
|
2854
2894
|
exports: {
|
|
@@ -2910,7 +2950,6 @@ var SimpleDiscordBotInfo = {
|
|
|
2910
2950
|
ButtonManager,
|
|
2911
2951
|
ComponentManager,
|
|
2912
2952
|
DiscordRegex,
|
|
2913
|
-
EmbedColor,
|
|
2914
2953
|
EmbedManager,
|
|
2915
2954
|
FileManager,
|
|
2916
2955
|
GuildManager,
|
|
@@ -2919,6 +2958,7 @@ var SimpleDiscordBotInfo = {
|
|
|
2919
2958
|
ModalManager,
|
|
2920
2959
|
ReactionManager,
|
|
2921
2960
|
SelectMenuManager,
|
|
2961
|
+
SimpleColor,
|
|
2922
2962
|
SimpleDiscordBotInfo,
|
|
2923
2963
|
SimpleMutex,
|
|
2924
2964
|
Time,
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/core/Bot.ts
|
|
2
2
|
import { Events, version } from "discord.js";
|
|
3
3
|
|
|
4
|
-
// src/utils/
|
|
4
|
+
// src/utils/UnitTime.ts
|
|
5
5
|
var UnitTime = class {
|
|
6
6
|
constructor(val) {
|
|
7
7
|
this.val = val;
|
|
@@ -241,7 +241,7 @@ var Log = class {
|
|
|
241
241
|
}
|
|
242
242
|
};
|
|
243
243
|
|
|
244
|
-
// src/utils/
|
|
244
|
+
// src/utils/InternetChecker.ts
|
|
245
245
|
var InternetChecker = class {
|
|
246
246
|
/**
|
|
247
247
|
* Check internet connection towards 1.1.1.1 (Cloudflare DNS)
|
|
@@ -288,7 +288,7 @@ InternetChecker.TARGET = "https://1.1.1.1";
|
|
|
288
288
|
// Cloudflare DNS HTTPS
|
|
289
289
|
InternetChecker.RETRY_TIME = Time.second.SEC_30;
|
|
290
290
|
|
|
291
|
-
// src/
|
|
291
|
+
// src/core/BotLog.ts
|
|
292
292
|
import { EmbedBuilder, ActionRowBuilder } from "discord.js";
|
|
293
293
|
var _BotLog = class _BotLog {
|
|
294
294
|
constructor() {
|
|
@@ -419,52 +419,56 @@ import {
|
|
|
419
419
|
EmbedBuilder as EmbedBuilder2,
|
|
420
420
|
MessageFlags
|
|
421
421
|
} from "discord.js";
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
422
|
+
|
|
423
|
+
// src/constants/SimpleColor.ts
|
|
424
|
+
var SimpleColor = /* @__PURE__ */ ((SimpleColor2) => {
|
|
425
|
+
SimpleColor2["transparent"] = "transparent";
|
|
426
|
+
SimpleColor2[SimpleColor2["error"] = 8912917] = "error";
|
|
427
|
+
SimpleColor2[SimpleColor2["success"] = 65280] = "success";
|
|
428
|
+
SimpleColor2[SimpleColor2["black"] = 0] = "black";
|
|
429
|
+
SimpleColor2[SimpleColor2["white"] = 16777215] = "white";
|
|
430
|
+
SimpleColor2[SimpleColor2["red"] = 16711680] = "red";
|
|
431
|
+
SimpleColor2[SimpleColor2["green"] = 65280] = "green";
|
|
432
|
+
SimpleColor2[SimpleColor2["blue"] = 255] = "blue";
|
|
433
|
+
SimpleColor2[SimpleColor2["yellow"] = 16776960] = "yellow";
|
|
434
|
+
SimpleColor2[SimpleColor2["cyan"] = 65535] = "cyan";
|
|
435
|
+
SimpleColor2[SimpleColor2["magenta"] = 16711935] = "magenta";
|
|
436
|
+
SimpleColor2[SimpleColor2["gray"] = 8421504] = "gray";
|
|
437
|
+
SimpleColor2[SimpleColor2["lightgray"] = 13882323] = "lightgray";
|
|
438
|
+
SimpleColor2[SimpleColor2["darkgray"] = 11119017] = "darkgray";
|
|
439
|
+
SimpleColor2[SimpleColor2["orange"] = 16753920] = "orange";
|
|
440
|
+
SimpleColor2[SimpleColor2["purple"] = 8388736] = "purple";
|
|
441
|
+
SimpleColor2[SimpleColor2["pink"] = 16761035] = "pink";
|
|
442
|
+
SimpleColor2[SimpleColor2["brown"] = 10824234] = "brown";
|
|
443
|
+
SimpleColor2[SimpleColor2["lime"] = 65280] = "lime";
|
|
444
|
+
SimpleColor2[SimpleColor2["navy"] = 128] = "navy";
|
|
445
|
+
SimpleColor2[SimpleColor2["teal"] = 32896] = "teal";
|
|
446
|
+
SimpleColor2[SimpleColor2["olive"] = 8421376] = "olive";
|
|
447
|
+
SimpleColor2[SimpleColor2["gold"] = 16766720] = "gold";
|
|
448
|
+
SimpleColor2[SimpleColor2["silver"] = 12632256] = "silver";
|
|
449
|
+
SimpleColor2[SimpleColor2["coral"] = 16744272] = "coral";
|
|
450
|
+
SimpleColor2[SimpleColor2["salmon"] = 16416882] = "salmon";
|
|
451
|
+
SimpleColor2[SimpleColor2["khaki"] = 15787660] = "khaki";
|
|
452
|
+
SimpleColor2[SimpleColor2["plum"] = 14524637] = "plum";
|
|
453
|
+
SimpleColor2[SimpleColor2["lavender"] = 15132410] = "lavender";
|
|
454
|
+
SimpleColor2[SimpleColor2["beige"] = 16119260] = "beige";
|
|
455
|
+
SimpleColor2[SimpleColor2["mint"] = 10026904] = "mint";
|
|
456
|
+
SimpleColor2[SimpleColor2["peach"] = 16767673] = "peach";
|
|
457
|
+
SimpleColor2[SimpleColor2["chocolate"] = 13789470] = "chocolate";
|
|
458
|
+
SimpleColor2[SimpleColor2["crimson"] = 14423100] = "crimson";
|
|
459
|
+
SimpleColor2[SimpleColor2["youtube"] = 16718362] = "youtube";
|
|
460
|
+
SimpleColor2[SimpleColor2["default"] = 6064856] = "default";
|
|
461
|
+
SimpleColor2[SimpleColor2["minecraft"] = 25600] = "minecraft";
|
|
462
|
+
return SimpleColor2;
|
|
463
|
+
})(SimpleColor || {});
|
|
464
|
+
|
|
465
|
+
// src/manager/messages/EmbedManager.ts
|
|
462
466
|
var EmbedManager = class {
|
|
463
467
|
static get BOT_ICON() {
|
|
464
468
|
return Bot.client?.user?.displayAvatarURL({ forceStatic: false, size: 128 }) || "";
|
|
465
469
|
}
|
|
466
470
|
static get DEFAULT_COLOR() {
|
|
467
|
-
return Bot.config.
|
|
471
|
+
return Bot.config.defaultSimpleColor || 6064856 /* default */;
|
|
468
472
|
}
|
|
469
473
|
/**
|
|
470
474
|
* Creates base embed - SAME SIMPLE API !
|
|
@@ -540,7 +544,15 @@ var EmbedManager = class {
|
|
|
540
544
|
static toInteraction(embed, ephemeral = false) {
|
|
541
545
|
return {
|
|
542
546
|
embeds: [embed],
|
|
543
|
-
flags: ephemeral ? [MessageFlags.Ephemeral] :
|
|
547
|
+
flags: ephemeral ? [MessageFlags.Ephemeral] : []
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Transform embed into objet for interaction.editReply()
|
|
552
|
+
*/
|
|
553
|
+
static toInteractionEdit(embed) {
|
|
554
|
+
return {
|
|
555
|
+
embeds: [embed]
|
|
544
556
|
};
|
|
545
557
|
}
|
|
546
558
|
/**
|
|
@@ -553,7 +565,7 @@ var EmbedManager = class {
|
|
|
553
565
|
}
|
|
554
566
|
};
|
|
555
567
|
|
|
556
|
-
// src/
|
|
568
|
+
// src/core/BotMessage.ts
|
|
557
569
|
import {
|
|
558
570
|
User,
|
|
559
571
|
GuildMember
|
|
@@ -563,11 +575,12 @@ import {
|
|
|
563
575
|
import {
|
|
564
576
|
ActionRowBuilder as ActionRowBuilder2,
|
|
565
577
|
EmbedBuilder as EmbedBuilder3,
|
|
566
|
-
MessageFlags as MessageFlags2
|
|
578
|
+
MessageFlags as MessageFlags2,
|
|
579
|
+
ContainerBuilder
|
|
567
580
|
} from "discord.js";
|
|
568
581
|
var SendableComponentBuilder = class {
|
|
569
582
|
static isSendableComponent(thing) {
|
|
570
|
-
return thing instanceof EmbedBuilder3 || thing instanceof ActionRowBuilder2;
|
|
583
|
+
return thing instanceof EmbedBuilder3 || thing instanceof ContainerBuilder || thing instanceof ActionRowBuilder2;
|
|
571
584
|
}
|
|
572
585
|
static build(base, content, components) {
|
|
573
586
|
if (content) {
|
|
@@ -579,6 +592,10 @@ var SendableComponentBuilder = class {
|
|
|
579
592
|
base.embeds = base.embeds || [];
|
|
580
593
|
base.embeds.push(comp);
|
|
581
594
|
}
|
|
595
|
+
if (comp instanceof ContainerBuilder) {
|
|
596
|
+
base.components = base.components || [];
|
|
597
|
+
base.components.push(comp);
|
|
598
|
+
}
|
|
582
599
|
if (comp instanceof ActionRowBuilder2) {
|
|
583
600
|
base.components = base.components || [];
|
|
584
601
|
base.components.push(comp);
|
|
@@ -609,7 +626,7 @@ var SendableComponentBuilder = class {
|
|
|
609
626
|
}
|
|
610
627
|
};
|
|
611
628
|
|
|
612
|
-
// src/
|
|
629
|
+
// src/core/BotMessage.ts
|
|
613
630
|
var BotMessage = class {
|
|
614
631
|
static async send(channel, content, component) {
|
|
615
632
|
try {
|
|
@@ -700,7 +717,7 @@ var BotMessage = class {
|
|
|
700
717
|
}
|
|
701
718
|
};
|
|
702
719
|
|
|
703
|
-
// src/
|
|
720
|
+
// src/constants/DiscordRegex.ts
|
|
704
721
|
var _DiscordRegex = class _DiscordRegex {
|
|
705
722
|
/**
|
|
706
723
|
* Validate Discord ID Discord (18)
|
|
@@ -815,7 +832,7 @@ _DiscordRegex.INVITE = /^discord(?:app\.com\/invite|gg)\/[a-zA-Z0-9]+$/;
|
|
|
815
832
|
_DiscordRegex.EMOJI = /^<a?:[a-zA-Z0-9_]{2,32}:[0-9]{18}>$|^[\u{1F300}-\u{1F5FF}\u{1F600}-\u{1F64F}\u{1F680}-\u{1F6FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}]+$/u;
|
|
816
833
|
var DiscordRegex = _DiscordRegex;
|
|
817
834
|
|
|
818
|
-
// src/
|
|
835
|
+
// src/core/BotEnv.ts
|
|
819
836
|
var BotEnv = {
|
|
820
837
|
get token() {
|
|
821
838
|
const token = process.env.DISCORD_BOT_TOKEN;
|
|
@@ -835,7 +852,7 @@ var BotEnv = {
|
|
|
835
852
|
}
|
|
836
853
|
};
|
|
837
854
|
|
|
838
|
-
// src/
|
|
855
|
+
// src/core/BotInteraction.ts
|
|
839
856
|
var BotInteraction = class {
|
|
840
857
|
/**
|
|
841
858
|
* InteractionReplyOptions && InteractionUpdateOptions
|
|
@@ -911,7 +928,7 @@ var BotInteraction = class {
|
|
|
911
928
|
}
|
|
912
929
|
};
|
|
913
930
|
|
|
914
|
-
// src/
|
|
931
|
+
// src/core/Bot.ts
|
|
915
932
|
var _Bot = class _Bot {
|
|
916
933
|
get config() {
|
|
917
934
|
return _Bot._config;
|
|
@@ -2522,6 +2539,11 @@ var SelectMenuManager = class _SelectMenuManager {
|
|
|
2522
2539
|
flags: ephemeral ? [MessageFlags3.Ephemeral] : []
|
|
2523
2540
|
};
|
|
2524
2541
|
}
|
|
2542
|
+
static toInteractionEdit(menus) {
|
|
2543
|
+
return {
|
|
2544
|
+
components: this._createRowsToReturn(menus)
|
|
2545
|
+
};
|
|
2546
|
+
}
|
|
2525
2547
|
static _createRowsToReturn(menus) {
|
|
2526
2548
|
if (Array.isArray(menus)) {
|
|
2527
2549
|
return menus.map(
|
|
@@ -2534,7 +2556,7 @@ var SelectMenuManager = class _SelectMenuManager {
|
|
|
2534
2556
|
|
|
2535
2557
|
// src/manager/messages/ComponentManager.ts
|
|
2536
2558
|
import {
|
|
2537
|
-
ContainerBuilder,
|
|
2559
|
+
ContainerBuilder as ContainerBuilder2,
|
|
2538
2560
|
TextDisplayBuilder,
|
|
2539
2561
|
SeparatorBuilder,
|
|
2540
2562
|
SeparatorSpacingSize,
|
|
@@ -2549,13 +2571,13 @@ import {
|
|
|
2549
2571
|
} from "discord.js";
|
|
2550
2572
|
var ComponentManager = class {
|
|
2551
2573
|
static get DEFAULT_COLOR() {
|
|
2552
|
-
return Bot.config?.
|
|
2574
|
+
return Bot.config?.defaultSimpleColor || 6064856 /* default */;
|
|
2553
2575
|
}
|
|
2554
2576
|
/**
|
|
2555
2577
|
* Creates base ComponentV2
|
|
2556
2578
|
*/
|
|
2557
2579
|
static create(option) {
|
|
2558
|
-
const container = new
|
|
2580
|
+
const container = new ContainerBuilder2();
|
|
2559
2581
|
const colorC = option?.color ?? this.DEFAULT_COLOR;
|
|
2560
2582
|
if (colorC !== "transparent" /* transparent */) {
|
|
2561
2583
|
container.setAccentColor(colorC);
|
|
@@ -2644,33 +2666,16 @@ var ComponentManager = class {
|
|
|
2644
2666
|
}
|
|
2645
2667
|
return container;
|
|
2646
2668
|
}
|
|
2647
|
-
/*static field(container: ContainerBuilder, field: ComponentManagerField): ContainerBuilder {
|
|
2648
|
-
const section = new SectionBuilder()
|
|
2649
|
-
.addTextDisplayComponents(
|
|
2650
|
-
new TextDisplayBuilder().setContent(`**${field.name}**`),
|
|
2651
|
-
new TextDisplayBuilder().setContent(field.value)
|
|
2652
|
-
);
|
|
2653
|
-
|
|
2654
|
-
if (field.thumbnailUrl) {
|
|
2655
|
-
section.setThumbnailAccessory(
|
|
2656
|
-
new ThumbnailBuilder().setURL(field.thumbnailUrl)
|
|
2657
|
-
);
|
|
2658
|
-
}
|
|
2659
|
-
|
|
2660
|
-
if (field.button && field.button.length > 0) {
|
|
2661
|
-
section.setButtonAccessory(field.button[0]!);
|
|
2662
|
-
}
|
|
2663
|
-
|
|
2664
|
-
container.addSectionComponents(section);
|
|
2665
|
-
container.addSeparatorComponents(this.separator());
|
|
2666
|
-
return container;
|
|
2667
|
-
}*/
|
|
2668
2669
|
/**
|
|
2669
2670
|
* Multiple fields
|
|
2670
2671
|
*/
|
|
2671
2672
|
static fields(container, fields) {
|
|
2672
|
-
fields.forEach((
|
|
2673
|
-
|
|
2673
|
+
fields.forEach((field, index) => {
|
|
2674
|
+
const finalField = { ...field };
|
|
2675
|
+
if (index === fields.length - 1 && finalField.separator === void 0) {
|
|
2676
|
+
finalField.separator = false;
|
|
2677
|
+
}
|
|
2678
|
+
this.field(container, finalField);
|
|
2674
2679
|
});
|
|
2675
2680
|
return container;
|
|
2676
2681
|
}
|
|
@@ -2736,6 +2741,37 @@ var ComponentManager = class {
|
|
|
2736
2741
|
flags: [MessageFlags4.IsComponentsV2]
|
|
2737
2742
|
};
|
|
2738
2743
|
}
|
|
2744
|
+
static toInteraction(container, file = null, footer = true) {
|
|
2745
|
+
if (footer) {
|
|
2746
|
+
this.footer(container);
|
|
2747
|
+
}
|
|
2748
|
+
const base = {
|
|
2749
|
+
components: [container],
|
|
2750
|
+
flags: [MessageFlags4.IsComponentsV2]
|
|
2751
|
+
};
|
|
2752
|
+
if (file) {
|
|
2753
|
+
return {
|
|
2754
|
+
...base,
|
|
2755
|
+
files: Array.isArray(file) ? file : [file]
|
|
2756
|
+
};
|
|
2757
|
+
}
|
|
2758
|
+
return base;
|
|
2759
|
+
}
|
|
2760
|
+
static toInteractionEdit(container, file = null, footer = true) {
|
|
2761
|
+
if (footer) {
|
|
2762
|
+
this.footer(container);
|
|
2763
|
+
}
|
|
2764
|
+
const base = {
|
|
2765
|
+
components: [container]
|
|
2766
|
+
};
|
|
2767
|
+
if (file) {
|
|
2768
|
+
return {
|
|
2769
|
+
...base,
|
|
2770
|
+
files: Array.isArray(file) ? file : [file]
|
|
2771
|
+
};
|
|
2772
|
+
}
|
|
2773
|
+
return base;
|
|
2774
|
+
}
|
|
2739
2775
|
};
|
|
2740
2776
|
|
|
2741
2777
|
// src/manager/interactions/ButtonManager.ts
|
|
@@ -2791,6 +2827,11 @@ var ButtonManager = class _ButtonManager {
|
|
|
2791
2827
|
flags: ephemeral ? [MessageFlags5.Ephemeral] : []
|
|
2792
2828
|
};
|
|
2793
2829
|
}
|
|
2830
|
+
static toInteractionEdit(button) {
|
|
2831
|
+
return {
|
|
2832
|
+
components: this.createRowsToReturn(button)
|
|
2833
|
+
};
|
|
2834
|
+
}
|
|
2794
2835
|
static createRowsToReturn(button) {
|
|
2795
2836
|
if (Array.isArray(button)) {
|
|
2796
2837
|
return button.map(
|
|
@@ -2842,7 +2883,7 @@ var SimpleMutex = class {
|
|
|
2842
2883
|
// package.json
|
|
2843
2884
|
var package_default = {
|
|
2844
2885
|
name: "@spatulox/simplediscordbot",
|
|
2845
|
-
version: "1.6.
|
|
2886
|
+
version: "1.6.1",
|
|
2846
2887
|
author: "Spatulox",
|
|
2847
2888
|
description: "Simple discord bot framework to set up a bot under 30 secondes",
|
|
2848
2889
|
exports: {
|
|
@@ -2903,7 +2944,6 @@ export {
|
|
|
2903
2944
|
ButtonManager,
|
|
2904
2945
|
ComponentManager,
|
|
2905
2946
|
DiscordRegex,
|
|
2906
|
-
EmbedColor,
|
|
2907
2947
|
EmbedManager,
|
|
2908
2948
|
FileManager,
|
|
2909
2949
|
GuildManager,
|
|
@@ -2912,6 +2952,7 @@ export {
|
|
|
2912
2952
|
ModalManager,
|
|
2913
2953
|
ReactionManager,
|
|
2914
2954
|
SelectMenuManager,
|
|
2955
|
+
SimpleColor,
|
|
2915
2956
|
SimpleDiscordBotInfo,
|
|
2916
2957
|
SimpleMutex,
|
|
2917
2958
|
Time,
|