@spatulox/simplediscordbot 1.6.0 → 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 +106 -96
- package/dist/index.d.ts +106 -96
- package/dist/index.js +132 -90
- package/dist/index.mjs +141 -97
- 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
|
|
|
@@ -678,13 +684,13 @@ interface ComponentManagerFieldThumbnail extends BasicComponentManagerField {
|
|
|
678
684
|
thumbnailUrl: string;
|
|
679
685
|
}
|
|
680
686
|
interface ComponentManagerFieldAccessory extends BasicComponentManagerField {
|
|
681
|
-
button: ButtonBuilder;
|
|
687
|
+
button: ButtonBuilder | ButtonBuilder[];
|
|
682
688
|
}
|
|
683
689
|
type ComponentManagerField = ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | BasicComponentManagerField;
|
|
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
|
*/
|
|
@@ -719,6 +725,7 @@ declare class ComponentManager {
|
|
|
719
725
|
/**
|
|
720
726
|
* Quick field adder
|
|
721
727
|
*/
|
|
728
|
+
private static fieldAddText;
|
|
722
729
|
static field(container: ContainerBuilder, field: ComponentManagerField): ContainerBuilder;
|
|
723
730
|
/**
|
|
724
731
|
* Multiple fields
|
|
@@ -756,6 +763,8 @@ declare class ComponentManager {
|
|
|
756
763
|
* @param footer Sometimes you don't want to have the Bot name neither the timestamp...
|
|
757
764
|
*/
|
|
758
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;
|
|
759
768
|
}
|
|
760
769
|
|
|
761
770
|
interface ButtonOptions {
|
|
@@ -781,7 +790,8 @@ declare class ButtonManager {
|
|
|
781
790
|
static row(but: ButtonBuilder): ActionRowBuilder<ButtonBuilder>;
|
|
782
791
|
static row(but: ButtonBuilder[]): ActionRowBuilder<ButtonBuilder>;
|
|
783
792
|
static toMessage(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[]): MessageCreateOptions;
|
|
784
|
-
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;
|
|
785
795
|
private static createRowsToReturn;
|
|
786
796
|
}
|
|
787
797
|
|
|
@@ -1070,4 +1080,4 @@ declare const SimpleDiscordBotInfo: {
|
|
|
1070
1080
|
license: string;
|
|
1071
1081
|
};
|
|
1072
1082
|
|
|
1073
|
-
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
|
|
|
@@ -678,13 +684,13 @@ interface ComponentManagerFieldThumbnail extends BasicComponentManagerField {
|
|
|
678
684
|
thumbnailUrl: string;
|
|
679
685
|
}
|
|
680
686
|
interface ComponentManagerFieldAccessory extends BasicComponentManagerField {
|
|
681
|
-
button: ButtonBuilder;
|
|
687
|
+
button: ButtonBuilder | ButtonBuilder[];
|
|
682
688
|
}
|
|
683
689
|
type ComponentManagerField = ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | BasicComponentManagerField;
|
|
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
|
*/
|
|
@@ -719,6 +725,7 @@ declare class ComponentManager {
|
|
|
719
725
|
/**
|
|
720
726
|
* Quick field adder
|
|
721
727
|
*/
|
|
728
|
+
private static fieldAddText;
|
|
722
729
|
static field(container: ContainerBuilder, field: ComponentManagerField): ContainerBuilder;
|
|
723
730
|
/**
|
|
724
731
|
* Multiple fields
|
|
@@ -756,6 +763,8 @@ declare class ComponentManager {
|
|
|
756
763
|
* @param footer Sometimes you don't want to have the Bot name neither the timestamp...
|
|
757
764
|
*/
|
|
758
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;
|
|
759
768
|
}
|
|
760
769
|
|
|
761
770
|
interface ButtonOptions {
|
|
@@ -781,7 +790,8 @@ declare class ButtonManager {
|
|
|
781
790
|
static row(but: ButtonBuilder): ActionRowBuilder<ButtonBuilder>;
|
|
782
791
|
static row(but: ButtonBuilder[]): ActionRowBuilder<ButtonBuilder>;
|
|
783
792
|
static toMessage(button: ButtonBuilder | ButtonBuilder[] | ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<ButtonBuilder>[]): MessageCreateOptions;
|
|
784
|
-
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;
|
|
785
795
|
private static createRowsToReturn;
|
|
786
796
|
}
|
|
787
797
|
|
|
@@ -1070,4 +1080,4 @@ declare const SimpleDiscordBotInfo: {
|
|
|
1070
1080
|
license: string;
|
|
1071
1081
|
};
|
|
1072
1082
|
|
|
1073
|
-
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 };
|