@spatulox/simplediscordbot 4.0.1 → 5.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 CHANGED
@@ -1,6 +1,15 @@
1
1
  # Changelog
2
2
  Date format : dd/mm/yyyy
3
3
 
4
+ ### 14/10/2026 - 5.0.0
5
+ - Breaking :
6
+ - `BotConfig.botName` is removed : the bot name is read from the Discord account (`client.user.displayName`) once the client is ready. Remove `botName` from your config
7
+ - Add :
8
+ - `Bot.botName` (read-only, `""` before the client is ready)
9
+ - The embed footer (bot name + icon) is always set once the client is ready, not only when `botName` was configured
10
+ - Fix :
11
+ - `Bot.log` no longer fetches the log channels whose `discord` field is `false`
12
+
4
13
  ### 29/09/2026 - 4.0.1
5
14
  - Fix :
6
15
  - `BotEnv.dev` follows the same rule as the `dim` CLI (`@spatulox/discord-interaction-manager`) : only `DISCORD_BOT_DEV=true` or `1` enable the dev mode. Other values (`yes`, `dev`...) enabled it on the bot but not in `dim`, so the bot loaded the `_dev` interactions while `dim` deployed the prod ones
package/README.md CHANGED
@@ -57,7 +57,6 @@ const client = new Client({
57
57
 
58
58
  const config: BotConfig = {
59
59
  defaultSimpleColor: SimpleColor.blue,
60
- botName: "Simple Discord Bot",
61
60
  log: {
62
61
  info: {channelId: "YOUR_LOG_CHANNEL_ID", console: true, discord: true},
63
62
  error: {channelId: "YOUR_LOG_CHANNEL_ID", console: true, discord: true},
package/dist/index.d.mts CHANGED
@@ -153,7 +153,6 @@ declare enum SimpleColor {
153
153
 
154
154
  type BotConfig = {
155
155
  defaultSimpleColor?: number | SimpleColor;
156
- botName?: string;
157
156
  log?: ConfigLog;
158
157
  };
159
158
  type RandomBotActivity = {
@@ -167,11 +166,14 @@ declare class Bot {
167
166
  private static _client;
168
167
  private static token;
169
168
  private static _config;
169
+ private static _botName;
170
170
  private static randomActivityInterval;
171
171
  get config(): BotConfig;
172
172
  get client(): Client;
173
+ get botName(): string;
173
174
  static get client(): Client;
174
175
  static get config(): BotConfig;
176
+ static get botName(): string;
175
177
  /**
176
178
  * Resolves once the login is done (true) or has definitively failed (false)
177
179
  */
package/dist/index.d.ts CHANGED
@@ -153,7 +153,6 @@ declare enum SimpleColor {
153
153
 
154
154
  type BotConfig = {
155
155
  defaultSimpleColor?: number | SimpleColor;
156
- botName?: string;
157
156
  log?: ConfigLog;
158
157
  };
159
158
  type RandomBotActivity = {
@@ -167,11 +166,14 @@ declare class Bot {
167
166
  private static _client;
168
167
  private static token;
169
168
  private static _config;
169
+ private static _botName;
170
170
  private static randomActivityInterval;
171
171
  get config(): BotConfig;
172
172
  get client(): Client;
173
+ get botName(): string;
173
174
  static get client(): Client;
174
175
  static get config(): BotConfig;
176
+ static get botName(): string;
175
177
  /**
176
178
  * Resolves once the login is done (true) or has definitively failed (false)
177
179
  */
package/dist/index.js CHANGED
@@ -286,8 +286,9 @@ var BotLog = class _BotLog {
286
286
  { config: "debug", prop: "debugChannel" }
287
287
  ];
288
288
  for (const { config, prop } of logTypes) {
289
- const channelId = Bot.config.log?.[config]?.channelId;
290
- if (!channelId) continue;
289
+ const logConfig = Bot.config.log?.[config];
290
+ if (!logConfig?.discord || !logConfig.channelId) continue;
291
+ const channelId = logConfig.channelId;
291
292
  try {
292
293
  const channel = await Bot.client.channels.fetch(channelId);
293
294
  if (channel?.isTextBased()) {
@@ -448,9 +449,9 @@ var EmbedManager = class {
448
449
  if (colorC !== "transparent" /* transparent */) {
449
450
  embed.setColor(colorC);
450
451
  }
451
- if (Bot.config?.botName) {
452
+ if (Bot.botName) {
452
453
  const footer = {
453
- text: Bot.config.botName
454
+ text: Bot.botName
454
455
  };
455
456
  if (this.BOT_ICON) {
456
457
  footer.iconURL = this.BOT_ICON;
@@ -704,7 +705,7 @@ var BotInteraction = class {
704
705
 
705
706
  // package.json
706
707
  var name = "@spatulox/simplediscordbot";
707
- var version = "4.0.0";
708
+ var version = "4.0.2";
708
709
  var author = "Spatulox";
709
710
  var description = "Simple discord bot framework to set up a bot under 30 secondes";
710
711
  var license = "MIT";
@@ -728,6 +729,7 @@ var Bot = class _Bot {
728
729
  static _client;
729
730
  static token;
730
731
  static _config;
732
+ static _botName = "";
731
733
  static randomActivityInterval = null;
732
734
  get config() {
733
735
  return _Bot._config;
@@ -735,12 +737,18 @@ var Bot = class _Bot {
735
737
  get client() {
736
738
  return _Bot._client;
737
739
  }
740
+ get botName() {
741
+ return _Bot._botName;
742
+ }
738
743
  static get client() {
739
744
  return _Bot._client;
740
745
  }
741
746
  static get config() {
742
747
  return _Bot._config;
743
748
  }
749
+ static get botName() {
750
+ return _Bot._botName;
751
+ }
744
752
  /**
745
753
  * Resolves once the login is done (true) or has definitively failed (false)
746
754
  */
@@ -753,6 +761,7 @@ var Bot = class _Bot {
753
761
  _Bot._client = client;
754
762
  _Bot._client.once(import_discord7.Events.ClientReady, async () => {
755
763
  if (_Bot._client.user) {
764
+ _Bot._botName = _Bot._client.user.displayName;
756
765
  await _Bot.log.initDiscordLogging();
757
766
  import_utils4.Log.info(`Connected on ${_Bot._client.guilds.cache.size} servers as ${_Bot._client.user.tag}`);
758
767
  _Bot.log.info(EmbedManager.description("Bot Started"));
@@ -2098,7 +2107,7 @@ var ModalManager = class {
2098
2107
  * Simple modal with ONE field - DIRECT ModalBuilder return !
2099
2108
  */
2100
2109
  static simple(customId, modalTitle, field) {
2101
- const modal = this.create(modalTitle ?? Bot.config?.botName ?? "Bot", customId);
2110
+ const modal = this.create(modalTitle ?? (Bot.botName || "Bot"), customId);
2102
2111
  const opt = {
2103
2112
  ...field,
2104
2113
  customId: field.customId ?? `${customId}_input`,
@@ -2379,7 +2388,7 @@ var ComponentManager = class {
2379
2388
  */
2380
2389
  static footer(container) {
2381
2390
  return new import_discord20.ContainerBuilder(container.toJSON()).addTextDisplayComponents(
2382
- new import_discord20.TextDisplayBuilder().setContent(`-# **${Bot.config?.botName || "Bot"} \xB7 <t:${Math.floor(Date.now() / 1e3)}:d> <t:${Math.floor(Date.now() / 1e3)}:t>**`)
2391
+ new import_discord20.TextDisplayBuilder().setContent(`-# **${Bot.botName || "Bot"} \xB7 <t:${Math.floor(Date.now() / 1e3)}:d> <t:${Math.floor(Date.now() / 1e3)}:t>**`)
2383
2392
  );
2384
2393
  }
2385
2394
  /**
package/dist/index.mjs CHANGED
@@ -257,8 +257,9 @@ var BotLog = class _BotLog {
257
257
  { config: "debug", prop: "debugChannel" }
258
258
  ];
259
259
  for (const { config, prop } of logTypes) {
260
- const channelId = Bot.config.log?.[config]?.channelId;
261
- if (!channelId) continue;
260
+ const logConfig = Bot.config.log?.[config];
261
+ if (!logConfig?.discord || !logConfig.channelId) continue;
262
+ const channelId = logConfig.channelId;
262
263
  try {
263
264
  const channel = await Bot.client.channels.fetch(channelId);
264
265
  if (channel?.isTextBased()) {
@@ -422,9 +423,9 @@ var EmbedManager = class {
422
423
  if (colorC !== "transparent" /* transparent */) {
423
424
  embed.setColor(colorC);
424
425
  }
425
- if (Bot.config?.botName) {
426
+ if (Bot.botName) {
426
427
  const footer = {
427
- text: Bot.config.botName
428
+ text: Bot.botName
428
429
  };
429
430
  if (this.BOT_ICON) {
430
431
  footer.iconURL = this.BOT_ICON;
@@ -683,7 +684,7 @@ var BotInteraction = class {
683
684
 
684
685
  // package.json
685
686
  var name = "@spatulox/simplediscordbot";
686
- var version = "4.0.0";
687
+ var version = "4.0.2";
687
688
  var author = "Spatulox";
688
689
  var description = "Simple discord bot framework to set up a bot under 30 secondes";
689
690
  var license = "MIT";
@@ -707,6 +708,7 @@ var Bot = class _Bot {
707
708
  static _client;
708
709
  static token;
709
710
  static _config;
711
+ static _botName = "";
710
712
  static randomActivityInterval = null;
711
713
  get config() {
712
714
  return _Bot._config;
@@ -714,12 +716,18 @@ var Bot = class _Bot {
714
716
  get client() {
715
717
  return _Bot._client;
716
718
  }
719
+ get botName() {
720
+ return _Bot._botName;
721
+ }
717
722
  static get client() {
718
723
  return _Bot._client;
719
724
  }
720
725
  static get config() {
721
726
  return _Bot._config;
722
727
  }
728
+ static get botName() {
729
+ return _Bot._botName;
730
+ }
723
731
  /**
724
732
  * Resolves once the login is done (true) or has definitively failed (false)
725
733
  */
@@ -732,6 +740,7 @@ var Bot = class _Bot {
732
740
  _Bot._client = client;
733
741
  _Bot._client.once(Events.ClientReady, async () => {
734
742
  if (_Bot._client.user) {
743
+ _Bot._botName = _Bot._client.user.displayName;
735
744
  await _Bot.log.initDiscordLogging();
736
745
  Log3.info(`Connected on ${_Bot._client.guilds.cache.size} servers as ${_Bot._client.user.tag}`);
737
746
  _Bot.log.info(EmbedManager.description("Bot Started"));
@@ -2092,7 +2101,7 @@ var ModalManager = class {
2092
2101
  * Simple modal with ONE field - DIRECT ModalBuilder return !
2093
2102
  */
2094
2103
  static simple(customId, modalTitle, field) {
2095
- const modal = this.create(modalTitle ?? Bot.config?.botName ?? "Bot", customId);
2104
+ const modal = this.create(modalTitle ?? (Bot.botName || "Bot"), customId);
2096
2105
  const opt = {
2097
2106
  ...field,
2098
2107
  customId: field.customId ?? `${customId}_input`,
@@ -2386,7 +2395,7 @@ var ComponentManager = class {
2386
2395
  */
2387
2396
  static footer(container) {
2388
2397
  return new ContainerBuilder2(container.toJSON()).addTextDisplayComponents(
2389
- new TextDisplayBuilder2().setContent(`-# **${Bot.config?.botName || "Bot"} \xB7 <t:${Math.floor(Date.now() / 1e3)}:d> <t:${Math.floor(Date.now() / 1e3)}:t>**`)
2398
+ new TextDisplayBuilder2().setContent(`-# **${Bot.botName || "Bot"} \xB7 <t:${Math.floor(Date.now() / 1e3)}:d> <t:${Math.floor(Date.now() / 1e3)}:t>**`)
2390
2399
  );
2391
2400
  }
2392
2401
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spatulox/simplediscordbot",
3
- "version": "4.0.1",
3
+ "version": "5.0.0",
4
4
  "author": "Spatulox",
5
5
  "description": "Simple discord bot framework to set up a bot under 30 secondes",
6
6
  "main": "./dist/index.js",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "license": "MIT",
39
39
  "dependencies": {
40
- "@spatulox/discord-interaction-manager": "^2.4.0",
40
+ "@spatulox/discord-interaction-manager": "^2.5.0",
41
41
  "@spatulox/utils": "^0.2.0"
42
42
  },
43
43
  "peerDependencies": {