@spatulox/simplediscordbot 2.1.2 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,8 +1,21 @@
1
1
  # Changelog
2
2
  Date format : dd/mm/yyy
3
3
 
4
+
5
+ ### 27/04/2026 - 2.2.1
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` : 'name' & 'value' are now optional. 'value' is now only mandatory when using 'thumbnailUrl' field with
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
+
4
17
  ### 15/04/2026 - 2.1.2
5
- - CacheManager should now take the botname in lowercase and escape weird char
18
+ - CacheManager should now take the botname in lowercase and escape weird char from it
6
19
 
7
20
  ### 15/04/2026 - 2.1.0 & 2.1.1
8
21
  - Add a CacheManager for simple persisting data
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
- ```bash
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(user: User | GuildMember | string, content?: string, component?: SendableComponent): Promise<Message | null>;
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: BotConfig);
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,23 @@ declare class SelectMenuManager {
755
753
  private static _createRowsToReturn;
756
754
  }
757
755
 
758
- interface BasicComponentManagerField {
756
+ type BasicText = {
757
+ separator?: SeparatorSpacingSize | false;
759
758
  name?: string;
759
+ };
760
+ type OptionalText = BasicText & {
761
+ value?: string;
762
+ };
763
+ type RequiredText = BasicText & {
760
764
  value: string;
761
- separator?: SeparatorSpacingSize | false;
762
- }
763
- interface ComponentManagerFieldThumbnail extends BasicComponentManagerField {
765
+ };
766
+ type ComponentManagerFieldThumbnail = RequiredText & {
764
767
  thumbnailUrl: string;
765
- }
766
- interface ComponentManagerFieldAccessory extends BasicComponentManagerField {
768
+ };
769
+ type ComponentManagerFieldAccessory = OptionalText & {
767
770
  button: ButtonBuilder | ButtonBuilder[];
768
- }
769
- type ComponentManagerField = ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | BasicComponentManagerField;
771
+ };
772
+ type ComponentManagerField = (ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | OptionalText);
770
773
  interface ComponentManagerCreate {
771
774
  title?: string | null;
772
775
  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(user: User | GuildMember | string, content?: string, component?: SendableComponent): Promise<Message | null>;
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: BotConfig);
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,23 @@ declare class SelectMenuManager {
755
753
  private static _createRowsToReturn;
756
754
  }
757
755
 
758
- interface BasicComponentManagerField {
756
+ type BasicText = {
757
+ separator?: SeparatorSpacingSize | false;
759
758
  name?: string;
759
+ };
760
+ type OptionalText = BasicText & {
761
+ value?: string;
762
+ };
763
+ type RequiredText = BasicText & {
760
764
  value: string;
761
- separator?: SeparatorSpacingSize | false;
762
- }
763
- interface ComponentManagerFieldThumbnail extends BasicComponentManagerField {
765
+ };
766
+ type ComponentManagerFieldThumbnail = RequiredText & {
764
767
  thumbnailUrl: string;
765
- }
766
- interface ComponentManagerFieldAccessory extends BasicComponentManagerField {
768
+ };
769
+ type ComponentManagerFieldAccessory = OptionalText & {
767
770
  button: ButtonBuilder | ButtonBuilder[];
768
- }
769
- type ComponentManagerField = ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | BasicComponentManagerField;
771
+ };
772
+ type ComponentManagerField = (ComponentManagerFieldAccessory | ComponentManagerFieldThumbnail | OptionalText);
770
773
  interface ComponentManagerCreate {
771
774
  title?: string | null;
772
775
  description?: string | null;