@spatulox/simplediscordbot 2.0.2 → 2.1.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,16 @@
1
1
  # Changelog
2
2
  Date format : dd/mm/yyy
3
3
 
4
+ ### 15/04/2026 - 2.1.0
5
+ - Add a CacheManager for simple persisting data
6
+ - Add QoL method to FileManager (fileExist(), deleteFile())
7
+ - Fix :
8
+ - SimpleDiscordBotInfo.version showing license instead of version
9
+ - FileManager should be able to create hidden folder
10
+
11
+ ### 13/04/2026 - 2.0.3
12
+ - Fix : WebhookManager can now send webhooks in threads
13
+
4
14
  ### 08/04/2026 - 2.0.1
5
15
  - Fix the README.md to match the new BotLog system
6
16
 
package/dist/index.d.mts CHANGED
@@ -160,6 +160,12 @@ declare const BotEnv: {
160
160
  };
161
161
 
162
162
  declare class FileManager {
163
+ /**
164
+ * Check if a file exist
165
+ * @param filePath File path with file name
166
+ * @returns true si le fichier existe, false sinon
167
+ */
168
+ static fileExists(filePath: string): Promise<boolean>;
163
169
  /**
164
170
  * Reads a JSON file synchronously.
165
171
  * @param filePath Full path to the JSON file
@@ -194,6 +200,12 @@ declare class FileManager {
194
200
  * @returns true on success, false on failure
195
201
  */
196
202
  static writeJsonFile(directoryPath: string, filename: string, data: any, sendErrorToErrorChannel?: boolean): Promise<boolean>;
203
+ /**
204
+ * Delete a file
205
+ * @param filePath Full file path
206
+ * @returns true si supprimé avec succès, false sinon
207
+ */
208
+ static deleteFile(filePath: string): Promise<boolean>;
197
209
  }
198
210
 
199
211
  declare class EmbedManager {
@@ -264,9 +276,10 @@ declare class WebhookManager {
264
276
  /**
265
277
  * Récupère le channel à partir de l'ID ou utilise directement si TextChannel/ThreadChannel
266
278
  */
267
- private getTextChannel;
279
+ private getChannel;
268
280
  /**
269
281
  * Get or create webhook (lazy initialization)
282
+ * Create the webhook in the parent channel if it's in a thread
270
283
  */
271
284
  private getWebhook;
272
285
  /**
package/dist/index.d.ts CHANGED
@@ -160,6 +160,12 @@ declare const BotEnv: {
160
160
  };
161
161
 
162
162
  declare class FileManager {
163
+ /**
164
+ * Check if a file exist
165
+ * @param filePath File path with file name
166
+ * @returns true si le fichier existe, false sinon
167
+ */
168
+ static fileExists(filePath: string): Promise<boolean>;
163
169
  /**
164
170
  * Reads a JSON file synchronously.
165
171
  * @param filePath Full path to the JSON file
@@ -194,6 +200,12 @@ declare class FileManager {
194
200
  * @returns true on success, false on failure
195
201
  */
196
202
  static writeJsonFile(directoryPath: string, filename: string, data: any, sendErrorToErrorChannel?: boolean): Promise<boolean>;
203
+ /**
204
+ * Delete a file
205
+ * @param filePath Full file path
206
+ * @returns true si supprimé avec succès, false sinon
207
+ */
208
+ static deleteFile(filePath: string): Promise<boolean>;
197
209
  }
198
210
 
199
211
  declare class EmbedManager {
@@ -264,9 +276,10 @@ declare class WebhookManager {
264
276
  /**
265
277
  * Récupère le channel à partir de l'ID ou utilise directement si TextChannel/ThreadChannel
266
278
  */
267
- private getTextChannel;
279
+ private getChannel;
268
280
  /**
269
281
  * Get or create webhook (lazy initialization)
282
+ * Create the webhook in the parent channel if it's in a thread
270
283
  */
271
284
  private getWebhook;
272
285
  /**
package/dist/index.js CHANGED
@@ -5546,7 +5546,7 @@ var _BotLog = class _BotLog {
5546
5546
  * Send INFO log - TEXT or EMBED ! Respecte config.log.info
5547
5547
  */
5548
5548
  static async info(content) {
5549
- const logConfig = Bot.config.log;
5549
+ const logConfig = Bot.config?.log;
5550
5550
  if (!logConfig || logConfig.info.console) {
5551
5551
  if (typeof content == "string") {
5552
5552
  Log.info(content);
@@ -5667,7 +5667,7 @@ var EmbedManager = class {
5667
5667
  if (colorC !== "transparent" /* transparent */) {
5668
5668
  embed.setColor(colorC);
5669
5669
  }
5670
- if (Bot.config.botName) {
5670
+ if (Bot.config?.botName) {
5671
5671
  const footer = {
5672
5672
  text: Bot.config.botName
5673
5673
  };
@@ -14326,6 +14326,68 @@ var BotInteraction = class {
14326
14326
  }
14327
14327
  };
14328
14328
 
14329
+ // package.json
14330
+ var package_default = {
14331
+ name: "@spatulox/simplediscordbot",
14332
+ version: "2.0.3",
14333
+ author: "Spatulox",
14334
+ description: "Simple discord bot framework to set up a bot under 30 secondes",
14335
+ exports: {
14336
+ types: "./dist/index.d.ts",
14337
+ import: "./dist/index.js",
14338
+ require: "./dist/index.js"
14339
+ },
14340
+ types: "./dist/index.d.ts",
14341
+ scripts: {
14342
+ "type-check": "tsc --noEmit",
14343
+ build: "npm run type-check && rm -rf ./dist/ && tsup",
14344
+ dev: "npm run type-check && tsx watch src/test/index.ts",
14345
+ patch: "npm run build && npm version patch",
14346
+ minor: "npm run build && npm version minor",
14347
+ major: "npm run build && npm version major",
14348
+ "pub:patch": "npm run patch && npm publish --access public",
14349
+ "pub:minor": "npm run minor && npm publish --access public",
14350
+ "pub:major": "npm run major && npm publish --access public"
14351
+ },
14352
+ license: "MIT",
14353
+ dependencies: {
14354
+ "@spatulox/discord-interaction-manager": "^2.0.6"
14355
+ },
14356
+ peerDependencies: {
14357
+ "discord.js": "^14.26.0"
14358
+ },
14359
+ devDependencies: {
14360
+ "@types/node": "^22.14.0",
14361
+ "@types/node-schedule": "^2.1.7",
14362
+ "discord.js": "^14.26.0",
14363
+ dotenv: "^17.2.4",
14364
+ tsup: "^8.5.1",
14365
+ tsx: "^4.20.3",
14366
+ typescript: "^5.9.3"
14367
+ },
14368
+ keywords: [
14369
+ "discord",
14370
+ "framework",
14371
+ "bot",
14372
+ "client",
14373
+ "discordjs",
14374
+ "discord.js",
14375
+ "node"
14376
+ ],
14377
+ bugs: {
14378
+ url: "https://github.com/Spatulox/SimpleDiscordBot/issues"
14379
+ }
14380
+ };
14381
+
14382
+ // src/SimpleDiscordBotInfo.ts
14383
+ var SimpleDiscordBotInfo = {
14384
+ name: package_default.name,
14385
+ version: package_default.version,
14386
+ author: package_default.author,
14387
+ description: package_default.description,
14388
+ license: package_default.license
14389
+ };
14390
+
14329
14391
  // src/core/Bot.ts
14330
14392
  var _Bot = class _Bot {
14331
14393
  get config() {
@@ -14348,6 +14410,7 @@ var _Bot = class _Bot {
14348
14410
  _Bot._client = client;
14349
14411
  (async () => {
14350
14412
  Log.info(`Using discord.js version: ${import_discord6.version}`);
14413
+ Log.info(`Using simplediscordbot version: ${SimpleDiscordBotInfo.version}`);
14351
14414
  Log.info("Trying to connect to Discord Servers");
14352
14415
  await InternetChecker.checkConnection(3);
14353
14416
  await this.login();
@@ -14420,6 +14483,19 @@ var Bot = _Bot;
14420
14483
  var import_path = __toESM(require("path"));
14421
14484
  var import_promises = __toESM(require("fs/promises"));
14422
14485
  var FileManager = class {
14486
+ /**
14487
+ * Check if a file exist
14488
+ * @param filePath File path with file name
14489
+ * @returns true si le fichier existe, false sinon
14490
+ */
14491
+ static async fileExists(filePath) {
14492
+ try {
14493
+ await import_promises.default.access(filePath);
14494
+ return true;
14495
+ } catch {
14496
+ return false;
14497
+ }
14498
+ }
14423
14499
  /**
14424
14500
  * Reads a JSON file synchronously.
14425
14501
  * @param filePath Full path to the JSON file
@@ -14442,8 +14518,7 @@ var FileManager = class {
14442
14518
  static async listDirectories(directoryPath) {
14443
14519
  try {
14444
14520
  const files = await import_promises.default.readdir(directoryPath, { withFileTypes: true });
14445
- const directories = files.filter((file) => file.isDirectory()).map((dir) => dir.name);
14446
- return directories;
14521
+ return files.filter((file) => file.isDirectory()).map((dir) => dir.name);
14447
14522
  } catch (error) {
14448
14523
  Log.error(`Failed to read directory ${directoryPath}: ${error}`);
14449
14524
  return false;
@@ -14500,16 +14575,7 @@ var FileManager = class {
14500
14575
  return false;
14501
14576
  }
14502
14577
  try {
14503
- const directories = directoryPath.split(import_path.default.sep).filter(Boolean);
14504
- let currentPath = "";
14505
- for (const dir of directories) {
14506
- currentPath = import_path.default.join(currentPath, dir);
14507
- try {
14508
- await import_promises.default.access(currentPath);
14509
- } catch {
14510
- await import_promises.default.mkdir(currentPath, { recursive: true });
14511
- }
14512
- }
14578
+ await import_promises.default.mkdir(directoryPath, { recursive: true });
14513
14579
  if (!filename || filename.trim() === "") {
14514
14580
  Log.error("Cannot write JSON file: empty filename");
14515
14581
  return false;
@@ -14530,6 +14596,25 @@ var FileManager = class {
14530
14596
  return false;
14531
14597
  }
14532
14598
  }
14599
+ /**
14600
+ * Delete a file
14601
+ * @param filePath Full file path
14602
+ * @returns true si supprimé avec succès, false sinon
14603
+ */
14604
+ static async deleteFile(filePath) {
14605
+ try {
14606
+ if (!await this.fileExists(filePath)) {
14607
+ Log.warn(`File does not exist: ${filePath}`);
14608
+ return false;
14609
+ }
14610
+ await import_promises.default.unlink(filePath);
14611
+ Log.info(`Successfully deleted file: ${filePath}`);
14612
+ return true;
14613
+ } catch (error) {
14614
+ Log.error(`Failed to delete file ${filePath}: ${error}`);
14615
+ return false;
14616
+ }
14617
+ }
14533
14618
  };
14534
14619
 
14535
14620
  // src/manager/messages/WebhookManager.ts
@@ -14559,7 +14644,7 @@ var WebhookManager = class {
14559
14644
  /**
14560
14645
  * Récupère le channel à partir de l'ID ou utilise directement si TextChannel/ThreadChannel
14561
14646
  */
14562
- async getTextChannel(channelId) {
14647
+ async getChannel(channelId) {
14563
14648
  const channel = await this.client.channels.fetch(channelId);
14564
14649
  if (!channel) {
14565
14650
  throw new Error(`Channel ${channelId} not found`);
@@ -14571,16 +14656,17 @@ var WebhookManager = class {
14571
14656
  }
14572
14657
  /**
14573
14658
  * Get or create webhook (lazy initialization)
14659
+ * Create the webhook in the parent channel if it's in a thread
14574
14660
  */
14575
14661
  async getWebhook(channelId) {
14576
14662
  if (this.webhook) return this.webhook;
14577
14663
  try {
14578
- const textThreadChannel = await this.getTextChannel(channelId);
14664
+ const textThreadChannel = await this.getChannel(channelId);
14579
14665
  let textChannel;
14580
14666
  if (textThreadChannel instanceof import_discord7.ThreadChannel) {
14581
14667
  const parent = textThreadChannel.parent;
14582
- if (!parent || !(parent instanceof import_discord7.BaseGuildTextChannel)) {
14583
- throw new Error("Targeted channel parent is not a BaseGuildTextChannel");
14668
+ if (!parent || !(parent instanceof import_discord7.BaseGuildTextChannel) && !(parent instanceof import_discord7.ThreadOnlyChannel)) {
14669
+ throw new Error("Targeted channel parent is not a BaseGuildTextChannel or ThreadOnlyChannel");
14584
14670
  }
14585
14671
  textChannel = parent;
14586
14672
  } else {
@@ -14613,6 +14699,10 @@ var WebhookManager = class {
14613
14699
  } else {
14614
14700
  options.content = String(content);
14615
14701
  }
14702
+ const channelType = await this.getChannel(channelId);
14703
+ if (channelType instanceof import_discord7.ThreadChannel) {
14704
+ options.threadId = channelId;
14705
+ }
14616
14706
  try {
14617
14707
  return await webhook.send(options);
14618
14708
  } catch (error) {
@@ -16143,68 +16233,6 @@ var SimpleMutex = class {
16143
16233
  return this._locked;
16144
16234
  }
16145
16235
  };
16146
-
16147
- // package.json
16148
- var package_default = {
16149
- name: "@spatulox/simplediscordbot",
16150
- version: "2.0.1",
16151
- author: "Spatulox",
16152
- description: "Simple discord bot framework to set up a bot under 30 secondes",
16153
- exports: {
16154
- types: "./dist/index.d.ts",
16155
- import: "./dist/index.js",
16156
- require: "./dist/index.js"
16157
- },
16158
- types: "./dist/index.d.ts",
16159
- scripts: {
16160
- "type-check": "tsc --noEmit",
16161
- build: "npm run type-check && rm -rf ./dist/ && tsup",
16162
- dev: "npm run type-check && tsx watch src/test/index.ts",
16163
- patch: "npm run build && npm version patch",
16164
- minor: "npm run build && npm version minor",
16165
- major: "npm run build && npm version major",
16166
- "pub:patch": "npm run patch && npm publish --access public",
16167
- "pub:minor": "npm run minor && npm publish --access public",
16168
- "pub:major": "npm run major && npm publish --access public"
16169
- },
16170
- license: "MIT",
16171
- dependencies: {
16172
- "@spatulox/discord-interaction-manager": "^2.0.6"
16173
- },
16174
- peerDependencies: {
16175
- "discord.js": "^14.26.0"
16176
- },
16177
- devDependencies: {
16178
- "@types/node": "^22.14.0",
16179
- "@types/node-schedule": "^2.1.7",
16180
- "discord.js": "^14.26.0",
16181
- dotenv: "^17.2.4",
16182
- tsup: "^8.5.1",
16183
- tsx: "^4.20.3",
16184
- typescript: "^5.9.3"
16185
- },
16186
- keywords: [
16187
- "discord",
16188
- "framework",
16189
- "bot",
16190
- "client",
16191
- "discordjs",
16192
- "discord.js",
16193
- "node"
16194
- ],
16195
- bugs: {
16196
- url: "https://github.com/Spatulox/SimpleDiscordBot/issues"
16197
- }
16198
- };
16199
-
16200
- // src/SimpleDiscordBotInfo.ts
16201
- var SimpleDiscordBotInfo = {
16202
- name: package_default.name,
16203
- version: package_default.license,
16204
- author: package_default.author,
16205
- description: package_default.description,
16206
- license: package_default.license
16207
- };
16208
16236
  // Annotate the CommonJS export names for ESM import in node:
16209
16237
  0 && (module.exports = {
16210
16238
  Bot,
package/dist/index.mjs CHANGED
@@ -5529,7 +5529,7 @@ var _BotLog = class _BotLog {
5529
5529
  * Send INFO log - TEXT or EMBED ! Respecte config.log.info
5530
5530
  */
5531
5531
  static async info(content) {
5532
- const logConfig = Bot.config.log;
5532
+ const logConfig = Bot.config?.log;
5533
5533
  if (!logConfig || logConfig.info.console) {
5534
5534
  if (typeof content == "string") {
5535
5535
  Log.info(content);
@@ -5653,7 +5653,7 @@ var EmbedManager = class {
5653
5653
  if (colorC !== "transparent" /* transparent */) {
5654
5654
  embed.setColor(colorC);
5655
5655
  }
5656
- if (Bot.config.botName) {
5656
+ if (Bot.config?.botName) {
5657
5657
  const footer = {
5658
5658
  text: Bot.config.botName
5659
5659
  };
@@ -14320,6 +14320,68 @@ var BotInteraction = class {
14320
14320
  }
14321
14321
  };
14322
14322
 
14323
+ // package.json
14324
+ var package_default = {
14325
+ name: "@spatulox/simplediscordbot",
14326
+ version: "2.0.3",
14327
+ author: "Spatulox",
14328
+ description: "Simple discord bot framework to set up a bot under 30 secondes",
14329
+ exports: {
14330
+ types: "./dist/index.d.ts",
14331
+ import: "./dist/index.js",
14332
+ require: "./dist/index.js"
14333
+ },
14334
+ types: "./dist/index.d.ts",
14335
+ scripts: {
14336
+ "type-check": "tsc --noEmit",
14337
+ build: "npm run type-check && rm -rf ./dist/ && tsup",
14338
+ dev: "npm run type-check && tsx watch src/test/index.ts",
14339
+ patch: "npm run build && npm version patch",
14340
+ minor: "npm run build && npm version minor",
14341
+ major: "npm run build && npm version major",
14342
+ "pub:patch": "npm run patch && npm publish --access public",
14343
+ "pub:minor": "npm run minor && npm publish --access public",
14344
+ "pub:major": "npm run major && npm publish --access public"
14345
+ },
14346
+ license: "MIT",
14347
+ dependencies: {
14348
+ "@spatulox/discord-interaction-manager": "^2.0.6"
14349
+ },
14350
+ peerDependencies: {
14351
+ "discord.js": "^14.26.0"
14352
+ },
14353
+ devDependencies: {
14354
+ "@types/node": "^22.14.0",
14355
+ "@types/node-schedule": "^2.1.7",
14356
+ "discord.js": "^14.26.0",
14357
+ dotenv: "^17.2.4",
14358
+ tsup: "^8.5.1",
14359
+ tsx: "^4.20.3",
14360
+ typescript: "^5.9.3"
14361
+ },
14362
+ keywords: [
14363
+ "discord",
14364
+ "framework",
14365
+ "bot",
14366
+ "client",
14367
+ "discordjs",
14368
+ "discord.js",
14369
+ "node"
14370
+ ],
14371
+ bugs: {
14372
+ url: "https://github.com/Spatulox/SimpleDiscordBot/issues"
14373
+ }
14374
+ };
14375
+
14376
+ // src/SimpleDiscordBotInfo.ts
14377
+ var SimpleDiscordBotInfo = {
14378
+ name: package_default.name,
14379
+ version: package_default.version,
14380
+ author: package_default.author,
14381
+ description: package_default.description,
14382
+ license: package_default.license
14383
+ };
14384
+
14323
14385
  // src/core/Bot.ts
14324
14386
  var _Bot = class _Bot {
14325
14387
  get config() {
@@ -14342,6 +14404,7 @@ var _Bot = class _Bot {
14342
14404
  _Bot._client = client;
14343
14405
  (async () => {
14344
14406
  Log.info(`Using discord.js version: ${version}`);
14407
+ Log.info(`Using simplediscordbot version: ${SimpleDiscordBotInfo.version}`);
14345
14408
  Log.info("Trying to connect to Discord Servers");
14346
14409
  await InternetChecker.checkConnection(3);
14347
14410
  await this.login();
@@ -14414,6 +14477,19 @@ var Bot = _Bot;
14414
14477
  import path from "path";
14415
14478
  import fs from "fs/promises";
14416
14479
  var FileManager = class {
14480
+ /**
14481
+ * Check if a file exist
14482
+ * @param filePath File path with file name
14483
+ * @returns true si le fichier existe, false sinon
14484
+ */
14485
+ static async fileExists(filePath) {
14486
+ try {
14487
+ await fs.access(filePath);
14488
+ return true;
14489
+ } catch {
14490
+ return false;
14491
+ }
14492
+ }
14417
14493
  /**
14418
14494
  * Reads a JSON file synchronously.
14419
14495
  * @param filePath Full path to the JSON file
@@ -14436,8 +14512,7 @@ var FileManager = class {
14436
14512
  static async listDirectories(directoryPath) {
14437
14513
  try {
14438
14514
  const files = await fs.readdir(directoryPath, { withFileTypes: true });
14439
- const directories = files.filter((file) => file.isDirectory()).map((dir) => dir.name);
14440
- return directories;
14515
+ return files.filter((file) => file.isDirectory()).map((dir) => dir.name);
14441
14516
  } catch (error) {
14442
14517
  Log.error(`Failed to read directory ${directoryPath}: ${error}`);
14443
14518
  return false;
@@ -14494,16 +14569,7 @@ var FileManager = class {
14494
14569
  return false;
14495
14570
  }
14496
14571
  try {
14497
- const directories = directoryPath.split(path.sep).filter(Boolean);
14498
- let currentPath = "";
14499
- for (const dir of directories) {
14500
- currentPath = path.join(currentPath, dir);
14501
- try {
14502
- await fs.access(currentPath);
14503
- } catch {
14504
- await fs.mkdir(currentPath, { recursive: true });
14505
- }
14506
- }
14572
+ await fs.mkdir(directoryPath, { recursive: true });
14507
14573
  if (!filename || filename.trim() === "") {
14508
14574
  Log.error("Cannot write JSON file: empty filename");
14509
14575
  return false;
@@ -14524,13 +14590,33 @@ var FileManager = class {
14524
14590
  return false;
14525
14591
  }
14526
14592
  }
14593
+ /**
14594
+ * Delete a file
14595
+ * @param filePath Full file path
14596
+ * @returns true si supprimé avec succès, false sinon
14597
+ */
14598
+ static async deleteFile(filePath) {
14599
+ try {
14600
+ if (!await this.fileExists(filePath)) {
14601
+ Log.warn(`File does not exist: ${filePath}`);
14602
+ return false;
14603
+ }
14604
+ await fs.unlink(filePath);
14605
+ Log.info(`Successfully deleted file: ${filePath}`);
14606
+ return true;
14607
+ } catch (error) {
14608
+ Log.error(`Failed to delete file ${filePath}: ${error}`);
14609
+ return false;
14610
+ }
14611
+ }
14527
14612
  };
14528
14613
 
14529
14614
  // src/manager/messages/WebhookManager.ts
14530
14615
  import {
14531
14616
  BaseGuildTextChannel,
14532
14617
  TextChannel as TextChannel3,
14533
- ThreadChannel as ThreadChannel2
14618
+ ThreadChannel as ThreadChannel2,
14619
+ ThreadOnlyChannel
14534
14620
  } from "discord.js";
14535
14621
  import { readFile } from "fs/promises";
14536
14622
  import { resolve } from "path";
@@ -14557,7 +14643,7 @@ var WebhookManager = class {
14557
14643
  /**
14558
14644
  * Récupère le channel à partir de l'ID ou utilise directement si TextChannel/ThreadChannel
14559
14645
  */
14560
- async getTextChannel(channelId) {
14646
+ async getChannel(channelId) {
14561
14647
  const channel = await this.client.channels.fetch(channelId);
14562
14648
  if (!channel) {
14563
14649
  throw new Error(`Channel ${channelId} not found`);
@@ -14569,16 +14655,17 @@ var WebhookManager = class {
14569
14655
  }
14570
14656
  /**
14571
14657
  * Get or create webhook (lazy initialization)
14658
+ * Create the webhook in the parent channel if it's in a thread
14572
14659
  */
14573
14660
  async getWebhook(channelId) {
14574
14661
  if (this.webhook) return this.webhook;
14575
14662
  try {
14576
- const textThreadChannel = await this.getTextChannel(channelId);
14663
+ const textThreadChannel = await this.getChannel(channelId);
14577
14664
  let textChannel;
14578
14665
  if (textThreadChannel instanceof ThreadChannel2) {
14579
14666
  const parent = textThreadChannel.parent;
14580
- if (!parent || !(parent instanceof BaseGuildTextChannel)) {
14581
- throw new Error("Targeted channel parent is not a BaseGuildTextChannel");
14667
+ if (!parent || !(parent instanceof BaseGuildTextChannel) && !(parent instanceof ThreadOnlyChannel)) {
14668
+ throw new Error("Targeted channel parent is not a BaseGuildTextChannel or ThreadOnlyChannel");
14582
14669
  }
14583
14670
  textChannel = parent;
14584
14671
  } else {
@@ -14611,6 +14698,10 @@ var WebhookManager = class {
14611
14698
  } else {
14612
14699
  options.content = String(content);
14613
14700
  }
14701
+ const channelType = await this.getChannel(channelId);
14702
+ if (channelType instanceof ThreadChannel2) {
14703
+ options.threadId = channelId;
14704
+ }
14614
14705
  try {
14615
14706
  return await webhook.send(options);
14616
14707
  } catch (error) {
@@ -16164,68 +16255,6 @@ var SimpleMutex = class {
16164
16255
  return this._locked;
16165
16256
  }
16166
16257
  };
16167
-
16168
- // package.json
16169
- var package_default = {
16170
- name: "@spatulox/simplediscordbot",
16171
- version: "2.0.1",
16172
- author: "Spatulox",
16173
- description: "Simple discord bot framework to set up a bot under 30 secondes",
16174
- exports: {
16175
- types: "./dist/index.d.ts",
16176
- import: "./dist/index.js",
16177
- require: "./dist/index.js"
16178
- },
16179
- types: "./dist/index.d.ts",
16180
- scripts: {
16181
- "type-check": "tsc --noEmit",
16182
- build: "npm run type-check && rm -rf ./dist/ && tsup",
16183
- dev: "npm run type-check && tsx watch src/test/index.ts",
16184
- patch: "npm run build && npm version patch",
16185
- minor: "npm run build && npm version minor",
16186
- major: "npm run build && npm version major",
16187
- "pub:patch": "npm run patch && npm publish --access public",
16188
- "pub:minor": "npm run minor && npm publish --access public",
16189
- "pub:major": "npm run major && npm publish --access public"
16190
- },
16191
- license: "MIT",
16192
- dependencies: {
16193
- "@spatulox/discord-interaction-manager": "^2.0.6"
16194
- },
16195
- peerDependencies: {
16196
- "discord.js": "^14.26.0"
16197
- },
16198
- devDependencies: {
16199
- "@types/node": "^22.14.0",
16200
- "@types/node-schedule": "^2.1.7",
16201
- "discord.js": "^14.26.0",
16202
- dotenv: "^17.2.4",
16203
- tsup: "^8.5.1",
16204
- tsx: "^4.20.3",
16205
- typescript: "^5.9.3"
16206
- },
16207
- keywords: [
16208
- "discord",
16209
- "framework",
16210
- "bot",
16211
- "client",
16212
- "discordjs",
16213
- "discord.js",
16214
- "node"
16215
- ],
16216
- bugs: {
16217
- url: "https://github.com/Spatulox/SimpleDiscordBot/issues"
16218
- }
16219
- };
16220
-
16221
- // src/SimpleDiscordBotInfo.ts
16222
- var SimpleDiscordBotInfo = {
16223
- name: package_default.name,
16224
- version: package_default.license,
16225
- author: package_default.author,
16226
- description: package_default.description,
16227
- license: package_default.license
16228
- };
16229
16258
  export {
16230
16259
  Bot,
16231
16260
  BotEnv,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spatulox/simplediscordbot",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "author": "Spatulox",
5
5
  "description": "Simple discord bot framework to set up a bot under 30 secondes",
6
6
  "exports": {