@spatulox/simplediscordbot 2.1.1 → 2.2.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 +17 -1
- package/README.md +12 -3
- package/dist/index.d.mts +20 -16
- package/dist/index.d.ts +20 -16
- package/dist/index.js +896 -14045
- package/dist/index.mjs +794 -13966
- package/package.json +2 -2
- package/prompt-message-for-wiki.txt +18 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
Date format : dd/mm/yyy
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
### 27/04/2026 - 2.2.0
|
|
6
|
+
- Add :
|
|
7
|
+
- Add a full wiki matching this version
|
|
8
|
+
- Changes:
|
|
9
|
+
- `DISCORD_BOT_DEV` now enable/disable the Bot.log.debug() / Log.debug()
|
|
10
|
+
- Removed `DISCORD_BOT_CLIENTID`
|
|
11
|
+
- Add overloading for `BotMessage.sendDM()` : Should now match all other `send()` from the framework for consistency
|
|
12
|
+
- Rework the type of `ComponentManagerField` to mandatory/optionally allow the 'name' & 'value' fields (both need to be present (or not) at the same time)
|
|
13
|
+
- Fix :
|
|
14
|
+
- `Bot.interaction.xxx()` logic : some interaction were enable to pass some requirement because of a wrong check logic
|
|
15
|
+
- RoleManager : take the member.guild.role instead of member.role to assign an exsiting role to a GuildMember
|
|
16
|
+
|
|
17
|
+
### 15/04/2026 - 2.1.2
|
|
18
|
+
- CacheManager should now take the botname in lowercase and escape weird char from it
|
|
19
|
+
|
|
20
|
+
### 15/04/2026 - 2.1.0 & 2.1.1
|
|
5
21
|
- Add a CacheManager for simple persisting data
|
|
6
22
|
- Add QoL method to FileManager (fileExist(), deleteFile())
|
|
7
23
|
- Fix :
|
package/README.md
CHANGED
|
@@ -14,19 +14,28 @@
|
|
|
14
14
|
> - Provides easy Managers to avoid repetitive code everywhere
|
|
15
15
|
> - Simple yet powerful builders (Embeds, Modals, SelectMenus, Components, Buttons) that rely on discord.js for full compatibility
|
|
16
16
|
|
|
17
|
+
# Don't forget to check the [wiki](https://github.com/spatulox-discord/SimpleDiscordBot/wiki)
|
|
17
18
|
|
|
18
19
|
## Installation
|
|
19
20
|
```bash
|
|
20
|
-
npm i @spatulox/simplediscordbot
|
|
21
|
+
npm i @spatulox/simplediscordbot
|
|
21
22
|
```
|
|
22
23
|
|
|
23
24
|
## Quick Start
|
|
24
25
|
|
|
25
26
|
Env Variables:
|
|
26
|
-
```
|
|
27
|
+
```
|
|
27
28
|
DISCORD_BOT_TOKEN="" // Your bot Token
|
|
28
|
-
DISCORD_BOT_CLIENTID="" // Yout bot client id
|
|
29
29
|
```
|
|
30
|
+
<details>
|
|
31
|
+
<summary>Note for v2.1.2 and older</summary>
|
|
32
|
+
|
|
33
|
+
> You also need to set up this env var :
|
|
34
|
+
> ```
|
|
35
|
+
> DISCORD_BOT_CLIENTID="" // You bot ClientID
|
|
36
|
+
> ```
|
|
37
|
+
|
|
38
|
+
</details>
|
|
30
39
|
|
|
31
40
|
```typescript
|
|
32
41
|
import {Bot, BotConfig, SimpleColor, Time} from "@spatulox/simplediscordbot";
|
package/dist/index.d.mts
CHANGED
|
@@ -54,7 +54,8 @@ declare class BotMessage {
|
|
|
54
54
|
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content?: string | null, component?: SendableComponent): Promise<Message | null>;
|
|
55
55
|
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content: SendableComponent): Promise<Message | null>;
|
|
56
56
|
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content: MessageCreateOptions): Promise<Message | null>;
|
|
57
|
-
static sendDM(
|
|
57
|
+
static sendDM(userOrId: User | GuildMember | string, content: string, component: SendableComponent): Promise<Message | null>;
|
|
58
|
+
static sendDM(userOrId: User | GuildMember | string, content: string | SendableComponent | MessageCreateOptions): Promise<Message | null>;
|
|
58
59
|
/**
|
|
59
60
|
* Quick success message
|
|
60
61
|
*/
|
|
@@ -79,7 +80,7 @@ declare class BotInteraction {
|
|
|
79
80
|
static reply(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
80
81
|
static followUp(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
81
82
|
static followUp(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
82
|
-
static defer(interaction: BaseInteraction): Promise<void>;
|
|
83
|
+
static defer(interaction: BaseInteraction): Promise<InteractionResponse<boolean> | void>;
|
|
83
84
|
static update(interaction: BaseInteraction, content: SendableComponent): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
84
85
|
static update(interaction: BaseInteraction, content: string, component: SendableComponent): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
85
86
|
}
|
|
@@ -129,9 +130,7 @@ type BotConfig = {
|
|
|
129
130
|
botName?: string;
|
|
130
131
|
log?: ConfigLog;
|
|
131
132
|
};
|
|
132
|
-
type InternalBotConfig = {
|
|
133
|
-
clientId: string;
|
|
134
|
-
} & BotConfig;
|
|
133
|
+
type InternalBotConfig = {} & BotConfig;
|
|
135
134
|
type RandomBotActivity = {
|
|
136
135
|
type: ActivityType;
|
|
137
136
|
message: string;
|
|
@@ -147,7 +146,7 @@ declare class Bot {
|
|
|
147
146
|
get client(): Client;
|
|
148
147
|
static get client(): Client;
|
|
149
148
|
static get config(): InternalBotConfig;
|
|
150
|
-
constructor(client: Client, config
|
|
149
|
+
constructor(client: Client, config?: BotConfig);
|
|
151
150
|
login(maxTries?: number): Promise<boolean>;
|
|
152
151
|
static setActivity(message: string, type: ActivityType): void;
|
|
153
152
|
static setRandomActivity(randomActivity: RandomBotActivity, intervalMs?: number | null): void;
|
|
@@ -156,7 +155,6 @@ declare class Bot {
|
|
|
156
155
|
declare const BotEnv: {
|
|
157
156
|
readonly token: string;
|
|
158
157
|
readonly dev: boolean;
|
|
159
|
-
readonly clientId: string;
|
|
160
158
|
};
|
|
161
159
|
|
|
162
160
|
declare class FileManager {
|
|
@@ -755,18 +753,24 @@ declare class SelectMenuManager {
|
|
|
755
753
|
private static _createRowsToReturn;
|
|
756
754
|
}
|
|
757
755
|
|
|
758
|
-
|
|
759
|
-
name?: string;
|
|
760
|
-
value: string;
|
|
756
|
+
type OptionalText = {
|
|
761
757
|
separator?: SeparatorSpacingSize | false;
|
|
762
|
-
|
|
763
|
-
|
|
758
|
+
name?: never;
|
|
759
|
+
value?: never;
|
|
760
|
+
};
|
|
761
|
+
type RequiredText = {
|
|
762
|
+
separator?: SeparatorSpacingSize | false;
|
|
763
|
+
name: string;
|
|
764
|
+
value: string;
|
|
765
|
+
};
|
|
766
|
+
type BasicComponentManagerField = OptionalText | RequiredText;
|
|
767
|
+
type ComponentManagerFieldThumbnail = RequiredText & {
|
|
764
768
|
thumbnailUrl: string;
|
|
765
|
-
}
|
|
766
|
-
|
|
769
|
+
};
|
|
770
|
+
type ComponentManagerFieldAccessory = BasicComponentManagerField & {
|
|
767
771
|
button: ButtonBuilder | ButtonBuilder[];
|
|
768
|
-
}
|
|
769
|
-
type ComponentManagerField = ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | BasicComponentManagerField;
|
|
772
|
+
};
|
|
773
|
+
type ComponentManagerField = (ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | BasicComponentManagerField);
|
|
770
774
|
interface ComponentManagerCreate {
|
|
771
775
|
title?: string | null;
|
|
772
776
|
description?: string | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -54,7 +54,8 @@ declare class BotMessage {
|
|
|
54
54
|
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content?: string | null, component?: SendableComponent): Promise<Message | null>;
|
|
55
55
|
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content: SendableComponent): Promise<Message | null>;
|
|
56
56
|
static send(channel: TextChannel | DMChannel | ThreadChannel | string, content: MessageCreateOptions): Promise<Message | null>;
|
|
57
|
-
static sendDM(
|
|
57
|
+
static sendDM(userOrId: User | GuildMember | string, content: string, component: SendableComponent): Promise<Message | null>;
|
|
58
|
+
static sendDM(userOrId: User | GuildMember | string, content: string | SendableComponent | MessageCreateOptions): Promise<Message | null>;
|
|
58
59
|
/**
|
|
59
60
|
* Quick success message
|
|
60
61
|
*/
|
|
@@ -79,7 +80,7 @@ declare class BotInteraction {
|
|
|
79
80
|
static reply(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
80
81
|
static followUp(interaction: BaseInteraction, content: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
81
82
|
static followUp(interaction: BaseInteraction, content: string, component: SendableComponent, ephemeral?: boolean): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
82
|
-
static defer(interaction: BaseInteraction): Promise<void>;
|
|
83
|
+
static defer(interaction: BaseInteraction): Promise<InteractionResponse<boolean> | void>;
|
|
83
84
|
static update(interaction: BaseInteraction, content: SendableComponent): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
84
85
|
static update(interaction: BaseInteraction, content: string, component: SendableComponent): Promise<InteractionResponse<boolean> | Message<boolean> | boolean>;
|
|
85
86
|
}
|
|
@@ -129,9 +130,7 @@ type BotConfig = {
|
|
|
129
130
|
botName?: string;
|
|
130
131
|
log?: ConfigLog;
|
|
131
132
|
};
|
|
132
|
-
type InternalBotConfig = {
|
|
133
|
-
clientId: string;
|
|
134
|
-
} & BotConfig;
|
|
133
|
+
type InternalBotConfig = {} & BotConfig;
|
|
135
134
|
type RandomBotActivity = {
|
|
136
135
|
type: ActivityType;
|
|
137
136
|
message: string;
|
|
@@ -147,7 +146,7 @@ declare class Bot {
|
|
|
147
146
|
get client(): Client;
|
|
148
147
|
static get client(): Client;
|
|
149
148
|
static get config(): InternalBotConfig;
|
|
150
|
-
constructor(client: Client, config
|
|
149
|
+
constructor(client: Client, config?: BotConfig);
|
|
151
150
|
login(maxTries?: number): Promise<boolean>;
|
|
152
151
|
static setActivity(message: string, type: ActivityType): void;
|
|
153
152
|
static setRandomActivity(randomActivity: RandomBotActivity, intervalMs?: number | null): void;
|
|
@@ -156,7 +155,6 @@ declare class Bot {
|
|
|
156
155
|
declare const BotEnv: {
|
|
157
156
|
readonly token: string;
|
|
158
157
|
readonly dev: boolean;
|
|
159
|
-
readonly clientId: string;
|
|
160
158
|
};
|
|
161
159
|
|
|
162
160
|
declare class FileManager {
|
|
@@ -755,18 +753,24 @@ declare class SelectMenuManager {
|
|
|
755
753
|
private static _createRowsToReturn;
|
|
756
754
|
}
|
|
757
755
|
|
|
758
|
-
|
|
759
|
-
name?: string;
|
|
760
|
-
value: string;
|
|
756
|
+
type OptionalText = {
|
|
761
757
|
separator?: SeparatorSpacingSize | false;
|
|
762
|
-
|
|
763
|
-
|
|
758
|
+
name?: never;
|
|
759
|
+
value?: never;
|
|
760
|
+
};
|
|
761
|
+
type RequiredText = {
|
|
762
|
+
separator?: SeparatorSpacingSize | false;
|
|
763
|
+
name: string;
|
|
764
|
+
value: string;
|
|
765
|
+
};
|
|
766
|
+
type BasicComponentManagerField = OptionalText | RequiredText;
|
|
767
|
+
type ComponentManagerFieldThumbnail = RequiredText & {
|
|
764
768
|
thumbnailUrl: string;
|
|
765
|
-
}
|
|
766
|
-
|
|
769
|
+
};
|
|
770
|
+
type ComponentManagerFieldAccessory = BasicComponentManagerField & {
|
|
767
771
|
button: ButtonBuilder | ButtonBuilder[];
|
|
768
|
-
}
|
|
769
|
-
type ComponentManagerField = ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | BasicComponentManagerField;
|
|
772
|
+
};
|
|
773
|
+
type ComponentManagerField = (ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | BasicComponentManagerField);
|
|
770
774
|
interface ComponentManagerCreate {
|
|
771
775
|
title?: string | null;
|
|
772
776
|
description?: string | null;
|