@spatulox/simplediscordbot 1.7.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/index.d.mts +32 -32
- package/dist/index.d.ts +32 -32
- package/dist/index.js +214 -148
- package/dist/index.mjs +146 -84
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
Date format : dd/mm/yyy
|
|
3
3
|
|
|
4
|
+
### 08/04/2026 - 2.0.0
|
|
5
|
+
- GuildManager.find now seach in cache then fetch. Now can return Guild | null
|
|
6
|
+
- BotLog now have separate channelId for each log type
|
|
7
|
+
- EmbedManager.field now use two parameter instead of 4 (embed: EmbedBuilder, field: {name: string, value: string, inline?: boolean})
|
|
8
|
+
- Rework of WebHookManager : Can use local image or http(s) link
|
|
9
|
+
- fix a crash when sending a Component V2 with webhook.send() method
|
|
10
|
+
|
|
4
11
|
### 08/04/2026 - 1.7.1
|
|
5
12
|
- WebHook Manager now don't crash when another bot with the same Webhook manager and webhook name try to access to the same webhook with the same name
|
|
6
13
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,30 +1,23 @@
|
|
|
1
|
-
import { EmbedBuilder, ContainerBuilder, ActionRowBuilder, MessageActionRowComponentBuilder, Message, TextChannel, DMChannel, ThreadChannel, MessageCreateOptions, User, GuildMember, BaseInteraction, InteractionResponse, Client, ActivityType, InteractionDeferReplyOptions, InteractionReplyOptions, InteractionEditReplyOptions, WebhookMessageCreateOptions, EmojiResolvable, Guild, BanOptions,
|
|
1
|
+
import { EmbedBuilder, ContainerBuilder, ActionRowBuilder, MessageActionRowComponentBuilder, Message, TextChannel, DMChannel, ThreadChannel, MessageCreateOptions, User, GuildMember, BaseInteraction, InteractionResponse, Client, ActivityType, InteractionDeferReplyOptions, InteractionReplyOptions, InteractionEditReplyOptions, Snowflake, WebhookMessageCreateOptions, EmojiResolvable, Guild, BanOptions, 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
|
import { BaseSelectMenuBuilder } from '@discordjs/builders';
|
|
3
3
|
|
|
4
4
|
type SendableComponent = EmbedBuilder | ContainerBuilder | BaseSelectMenuBuilder<any> | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
5
5
|
|
|
6
|
+
type PreciseLogConfig = {
|
|
7
|
+
channelId: string;
|
|
8
|
+
console: boolean;
|
|
9
|
+
discord: boolean;
|
|
10
|
+
};
|
|
6
11
|
type ConfigLog = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
discord: boolean;
|
|
12
|
-
};
|
|
13
|
-
error: {
|
|
14
|
-
console: boolean;
|
|
15
|
-
discord: boolean;
|
|
16
|
-
};
|
|
17
|
-
warn: {
|
|
18
|
-
console: boolean;
|
|
19
|
-
discord: boolean;
|
|
20
|
-
};
|
|
21
|
-
debug: {
|
|
22
|
-
console: boolean;
|
|
23
|
-
discord: boolean;
|
|
24
|
-
};
|
|
12
|
+
info: PreciseLogConfig;
|
|
13
|
+
error: PreciseLogConfig;
|
|
14
|
+
warn: PreciseLogConfig;
|
|
15
|
+
debug: PreciseLogConfig;
|
|
25
16
|
};
|
|
26
17
|
declare class BotLog {
|
|
27
18
|
private static logChannel;
|
|
19
|
+
private static warnChannel;
|
|
20
|
+
private static debugChannel;
|
|
28
21
|
private static errorChannel;
|
|
29
22
|
constructor();
|
|
30
23
|
static config(): ConfigLog | undefined;
|
|
@@ -237,7 +230,11 @@ declare class EmbedManager {
|
|
|
237
230
|
/**
|
|
238
231
|
* Quick field adder
|
|
239
232
|
*/
|
|
240
|
-
static field(embed: EmbedBuilder,
|
|
233
|
+
static field(embed: EmbedBuilder, field: {
|
|
234
|
+
name: string;
|
|
235
|
+
value: string;
|
|
236
|
+
inline?: boolean;
|
|
237
|
+
}): EmbedBuilder;
|
|
241
238
|
static fields(embed: EmbedBuilder, fields: {
|
|
242
239
|
name: string;
|
|
243
240
|
value: string;
|
|
@@ -258,12 +255,16 @@ declare class EmbedManager {
|
|
|
258
255
|
}
|
|
259
256
|
|
|
260
257
|
declare class WebhookManager {
|
|
261
|
-
private readonly
|
|
258
|
+
private readonly client;
|
|
262
259
|
private readonly name;
|
|
263
|
-
private readonly
|
|
260
|
+
private readonly avatarPathOrUrl?;
|
|
264
261
|
private webhook;
|
|
265
|
-
constructor(
|
|
266
|
-
private
|
|
262
|
+
constructor(client: Client, name: string, avatarPathOrUrl?: string | undefined);
|
|
263
|
+
private getAvatar;
|
|
264
|
+
/**
|
|
265
|
+
* Récupère le channel à partir de l'ID ou utilise directement si TextChannel/ThreadChannel
|
|
266
|
+
*/
|
|
267
|
+
private getTextChannel;
|
|
267
268
|
/**
|
|
268
269
|
* Get or create webhook (lazy initialization)
|
|
269
270
|
*/
|
|
@@ -271,21 +272,21 @@ declare class WebhookManager {
|
|
|
271
272
|
/**
|
|
272
273
|
* Send message/text/component !
|
|
273
274
|
*/
|
|
274
|
-
send(content: string): Promise<Message | null>;
|
|
275
|
-
send(content: SendableComponent): Promise<Message | null>;
|
|
276
|
-
send(content: WebhookMessageCreateOptions): Promise<Message | null>;
|
|
275
|
+
send(channelId: Snowflake, content: string): Promise<Message | null>;
|
|
276
|
+
send(channelId: Snowflake, content: SendableComponent): Promise<Message | null>;
|
|
277
|
+
send(channelId: Snowflake, content: WebhookMessageCreateOptions): Promise<Message | null>;
|
|
277
278
|
/**
|
|
278
279
|
* Quick success embed
|
|
279
280
|
*/
|
|
280
|
-
success(message: string): Promise<Message | null>;
|
|
281
|
+
success(channelId: Snowflake, message: string): Promise<Message | null>;
|
|
281
282
|
/**
|
|
282
283
|
* Quick error embed
|
|
283
284
|
*/
|
|
284
|
-
error(message: string): Promise<Message | null>;
|
|
285
|
+
error(channelId: Snowflake, message: string): Promise<Message | null>;
|
|
285
286
|
/**
|
|
286
287
|
* Delete webhook
|
|
287
288
|
*/
|
|
288
|
-
delete(reason?: string): Promise<void>;
|
|
289
|
+
delete(channelId: Snowflake, reason?: string): Promise<void>;
|
|
289
290
|
}
|
|
290
291
|
|
|
291
292
|
declare class ReactionManager {
|
|
@@ -339,7 +340,6 @@ declare abstract class BasicUserManager {
|
|
|
339
340
|
}
|
|
340
341
|
|
|
341
342
|
declare class GuildUserManager extends BasicUserManager {
|
|
342
|
-
static find(userId: string, guild: Guild | string): Promise<GuildMember | null>;
|
|
343
343
|
static rename(member: GuildMember, nickname: string, maxAttempts?: number): Promise<boolean>;
|
|
344
344
|
/**
|
|
345
345
|
* Check if user is banned from guild
|
|
@@ -527,7 +527,7 @@ declare class GuildManager {
|
|
|
527
527
|
static readonly channel: typeof GuildChannelList;
|
|
528
528
|
static readonly invite: typeof InviteManager;
|
|
529
529
|
static list(): Guild[];
|
|
530
|
-
static find(guild_id: string): Promise<Guild>;
|
|
530
|
+
static find(guild_id: string): Promise<Guild | null>;
|
|
531
531
|
/**
|
|
532
532
|
* Search channel by ID (TextChannel, DMChannel, ThreadChannel)
|
|
533
533
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,30 +1,23 @@
|
|
|
1
|
-
import { EmbedBuilder, ContainerBuilder, ActionRowBuilder, MessageActionRowComponentBuilder, Message, TextChannel, DMChannel, ThreadChannel, MessageCreateOptions, User, GuildMember, BaseInteraction, InteractionResponse, Client, ActivityType, InteractionDeferReplyOptions, InteractionReplyOptions, InteractionEditReplyOptions, WebhookMessageCreateOptions, EmojiResolvable, Guild, BanOptions,
|
|
1
|
+
import { EmbedBuilder, ContainerBuilder, ActionRowBuilder, MessageActionRowComponentBuilder, Message, TextChannel, DMChannel, ThreadChannel, MessageCreateOptions, User, GuildMember, BaseInteraction, InteractionResponse, Client, ActivityType, InteractionDeferReplyOptions, InteractionReplyOptions, InteractionEditReplyOptions, Snowflake, WebhookMessageCreateOptions, EmojiResolvable, Guild, BanOptions, 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
|
import { BaseSelectMenuBuilder } from '@discordjs/builders';
|
|
3
3
|
|
|
4
4
|
type SendableComponent = EmbedBuilder | ContainerBuilder | BaseSelectMenuBuilder<any> | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
5
5
|
|
|
6
|
+
type PreciseLogConfig = {
|
|
7
|
+
channelId: string;
|
|
8
|
+
console: boolean;
|
|
9
|
+
discord: boolean;
|
|
10
|
+
};
|
|
6
11
|
type ConfigLog = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
discord: boolean;
|
|
12
|
-
};
|
|
13
|
-
error: {
|
|
14
|
-
console: boolean;
|
|
15
|
-
discord: boolean;
|
|
16
|
-
};
|
|
17
|
-
warn: {
|
|
18
|
-
console: boolean;
|
|
19
|
-
discord: boolean;
|
|
20
|
-
};
|
|
21
|
-
debug: {
|
|
22
|
-
console: boolean;
|
|
23
|
-
discord: boolean;
|
|
24
|
-
};
|
|
12
|
+
info: PreciseLogConfig;
|
|
13
|
+
error: PreciseLogConfig;
|
|
14
|
+
warn: PreciseLogConfig;
|
|
15
|
+
debug: PreciseLogConfig;
|
|
25
16
|
};
|
|
26
17
|
declare class BotLog {
|
|
27
18
|
private static logChannel;
|
|
19
|
+
private static warnChannel;
|
|
20
|
+
private static debugChannel;
|
|
28
21
|
private static errorChannel;
|
|
29
22
|
constructor();
|
|
30
23
|
static config(): ConfigLog | undefined;
|
|
@@ -237,7 +230,11 @@ declare class EmbedManager {
|
|
|
237
230
|
/**
|
|
238
231
|
* Quick field adder
|
|
239
232
|
*/
|
|
240
|
-
static field(embed: EmbedBuilder,
|
|
233
|
+
static field(embed: EmbedBuilder, field: {
|
|
234
|
+
name: string;
|
|
235
|
+
value: string;
|
|
236
|
+
inline?: boolean;
|
|
237
|
+
}): EmbedBuilder;
|
|
241
238
|
static fields(embed: EmbedBuilder, fields: {
|
|
242
239
|
name: string;
|
|
243
240
|
value: string;
|
|
@@ -258,12 +255,16 @@ declare class EmbedManager {
|
|
|
258
255
|
}
|
|
259
256
|
|
|
260
257
|
declare class WebhookManager {
|
|
261
|
-
private readonly
|
|
258
|
+
private readonly client;
|
|
262
259
|
private readonly name;
|
|
263
|
-
private readonly
|
|
260
|
+
private readonly avatarPathOrUrl?;
|
|
264
261
|
private webhook;
|
|
265
|
-
constructor(
|
|
266
|
-
private
|
|
262
|
+
constructor(client: Client, name: string, avatarPathOrUrl?: string | undefined);
|
|
263
|
+
private getAvatar;
|
|
264
|
+
/**
|
|
265
|
+
* Récupère le channel à partir de l'ID ou utilise directement si TextChannel/ThreadChannel
|
|
266
|
+
*/
|
|
267
|
+
private getTextChannel;
|
|
267
268
|
/**
|
|
268
269
|
* Get or create webhook (lazy initialization)
|
|
269
270
|
*/
|
|
@@ -271,21 +272,21 @@ declare class WebhookManager {
|
|
|
271
272
|
/**
|
|
272
273
|
* Send message/text/component !
|
|
273
274
|
*/
|
|
274
|
-
send(content: string): Promise<Message | null>;
|
|
275
|
-
send(content: SendableComponent): Promise<Message | null>;
|
|
276
|
-
send(content: WebhookMessageCreateOptions): Promise<Message | null>;
|
|
275
|
+
send(channelId: Snowflake, content: string): Promise<Message | null>;
|
|
276
|
+
send(channelId: Snowflake, content: SendableComponent): Promise<Message | null>;
|
|
277
|
+
send(channelId: Snowflake, content: WebhookMessageCreateOptions): Promise<Message | null>;
|
|
277
278
|
/**
|
|
278
279
|
* Quick success embed
|
|
279
280
|
*/
|
|
280
|
-
success(message: string): Promise<Message | null>;
|
|
281
|
+
success(channelId: Snowflake, message: string): Promise<Message | null>;
|
|
281
282
|
/**
|
|
282
283
|
* Quick error embed
|
|
283
284
|
*/
|
|
284
|
-
error(message: string): Promise<Message | null>;
|
|
285
|
+
error(channelId: Snowflake, message: string): Promise<Message | null>;
|
|
285
286
|
/**
|
|
286
287
|
* Delete webhook
|
|
287
288
|
*/
|
|
288
|
-
delete(reason?: string): Promise<void>;
|
|
289
|
+
delete(channelId: Snowflake, reason?: string): Promise<void>;
|
|
289
290
|
}
|
|
290
291
|
|
|
291
292
|
declare class ReactionManager {
|
|
@@ -339,7 +340,6 @@ declare abstract class BasicUserManager {
|
|
|
339
340
|
}
|
|
340
341
|
|
|
341
342
|
declare class GuildUserManager extends BasicUserManager {
|
|
342
|
-
static find(userId: string, guild: Guild | string): Promise<GuildMember | null>;
|
|
343
343
|
static rename(member: GuildMember, nickname: string, maxAttempts?: number): Promise<boolean>;
|
|
344
344
|
/**
|
|
345
345
|
* Check if user is banned from guild
|
|
@@ -527,7 +527,7 @@ declare class GuildManager {
|
|
|
527
527
|
static readonly channel: typeof GuildChannelList;
|
|
528
528
|
static readonly invite: typeof InviteManager;
|
|
529
529
|
static list(): Guild[];
|
|
530
|
-
static find(guild_id: string): Promise<Guild>;
|
|
530
|
+
static find(guild_id: string): Promise<Guild | null>;
|
|
531
531
|
/**
|
|
532
532
|
* Search channel by ID (TextChannel, DMChannel, ThreadChannel)
|
|
533
533
|
*/
|