@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/dist/index.js CHANGED
@@ -5279,7 +5279,7 @@ var InternetChecker = class {
5279
5279
  tries > 0 ? `Ping failed (${errorMsg}) - Attempt ${attempt}/${tries}` : `Ping failed (${errorMsg}) - Retrying in ${this.RETRY_TIME.toSeconds()} seconds...`
5280
5280
  );
5281
5281
  try {
5282
- await new Promise((resolve) => setTimeout(resolve, this.RETRY_TIME.toMilliseconds()));
5282
+ await new Promise((resolve2) => setTimeout(resolve2, this.RETRY_TIME.toMilliseconds()));
5283
5283
  } catch {
5284
5284
  Log.error("Retry delay failed.");
5285
5285
  }
@@ -5435,31 +5435,85 @@ var _BotLog = class _BotLog {
5435
5435
  Log.warn("Client not ready for Discord logging init");
5436
5436
  return;
5437
5437
  }
5438
- if (Bot.config.log?.logChannelId) {
5439
- try {
5440
- const logCh = await Bot.client.channels.fetch(Bot.config.log.logChannelId);
5441
- if (logCh?.isTextBased()) {
5442
- _BotLog.logChannel = logCh;
5443
- } else {
5444
- Log.warn(`Log channel ${Bot.config.log.logChannelId} invalid`);
5445
- }
5446
- } catch (error) {
5447
- Log.error(`Log channel fetch failed: ${error}`);
5448
- }
5449
- }
5450
- if (Bot.config.log?.errorChannelId) {
5438
+ const logTypes = [
5439
+ { config: "info", prop: "logChannel" },
5440
+ { config: "warn", prop: "warnChannel" },
5441
+ { config: "error", prop: "errorChannel" },
5442
+ { config: "debug", prop: "debugChannel" }
5443
+ ];
5444
+ for (const { config, prop } of logTypes) {
5445
+ const channelId = Bot.config.log?.[config]?.channelId;
5446
+ if (!channelId) continue;
5451
5447
  try {
5452
- const errorCh = await Bot.client.channels.fetch(Bot.config.log.errorChannelId);
5453
- if (errorCh?.isTextBased()) {
5454
- _BotLog.errorChannel = errorCh;
5448
+ const channel = await Bot.client.channels.fetch(channelId);
5449
+ if (channel?.isTextBased()) {
5450
+ _BotLog[prop] = channel;
5455
5451
  } else {
5456
- Log.warn(`Error channel ${Bot.config.log.errorChannelId} invalid`);
5452
+ Log.warn(`${config.charAt(0).toUpperCase() + config.slice(1)} channel ${channelId} invalid`);
5457
5453
  }
5458
5454
  } catch (error) {
5459
- Log.error(`Error channel fetch failed: ${error}`);
5455
+ Log.error(`${config.charAt(0).toUpperCase() + config.slice(1)} channel fetch failed: ${error}`);
5460
5456
  }
5461
5457
  }
5462
5458
  }
5459
+ /*public static async initDiscordLogging(): Promise<void> {
5460
+ if (!Bot.client.isReady()) {
5461
+ Log.warn('Client not ready for Discord logging init');
5462
+ return;
5463
+ }
5464
+
5465
+ if (Bot.config.log?.info.channelId) {
5466
+ try {
5467
+ const logCh = await Bot.client.channels.fetch(Bot.config.log.info.channelId) as TextChannel;
5468
+ if (logCh?.isTextBased()) {
5469
+ BotLog.logChannel = logCh;
5470
+ } else {
5471
+ Log.warn(`Log channel ${Bot.config.log.info.channelId} invalid`);
5472
+ }
5473
+ } catch (error) {
5474
+ Log.error(`Log channel fetch failed: ${error}`);
5475
+ }
5476
+ }
5477
+
5478
+ if (Bot.config.log?.warn.channelId) {
5479
+ try {
5480
+ const errorCh = await Bot.client.channels.fetch(Bot.config.log.warn.channelId) as TextChannel;
5481
+ if (errorCh?.isTextBased()) {
5482
+ BotLog.warnChannel = errorCh;
5483
+ } else {
5484
+ Log.warn(`Warn channel ${Bot.config.log.warn.channelId} invalid`);
5485
+ }
5486
+ } catch (error) {
5487
+ Log.error(`Warn channel fetch failed: ${error}`);
5488
+ }
5489
+ }
5490
+
5491
+ if (Bot.config.log?.error.channelId) {
5492
+ try {
5493
+ const errorCh = await Bot.client.channels.fetch(Bot.config.log.error.channelId) as TextChannel;
5494
+ if (errorCh?.isTextBased()) {
5495
+ BotLog.errorChannel = errorCh;
5496
+ } else {
5497
+ Log.warn(`Error channel ${Bot.config.log.error.channelId} invalid`);
5498
+ }
5499
+ } catch (error) {
5500
+ Log.error(`Error channel fetch failed: ${error}`);
5501
+ }
5502
+ }
5503
+
5504
+ if (Bot.config.log?.debug.channelId) {
5505
+ try {
5506
+ const errorCh = await Bot.client.channels.fetch(Bot.config.log.debug.channelId) as TextChannel;
5507
+ if (errorCh?.isTextBased()) {
5508
+ BotLog.debugChannel = errorCh;
5509
+ } else {
5510
+ Log.warn(`Debug channel ${Bot.config.log.debug.channelId} invalid`);
5511
+ }
5512
+ } catch (error) {
5513
+ Log.error(`Debug channel fetch failed: ${error}`);
5514
+ }
5515
+ }
5516
+ }*/
5463
5517
  /**
5464
5518
  * Send content to specific Discord channel
5465
5519
  */
@@ -5526,8 +5580,8 @@ var _BotLog = class _BotLog {
5526
5580
  Log.warn(content);
5527
5581
  }
5528
5582
  }
5529
- if (logConfig?.warn.discord && this.logChannel) {
5530
- return await this._sendToChannel(this.logChannel, content, "warn");
5583
+ if (logConfig?.warn.discord && this.warnChannel) {
5584
+ return await this._sendToChannel(this.warnChannel, content, "warn");
5531
5585
  }
5532
5586
  }
5533
5587
  /**
@@ -5540,12 +5594,14 @@ var _BotLog = class _BotLog {
5540
5594
  Log.debug(content);
5541
5595
  }
5542
5596
  }
5543
- if (logConfig?.debug.discord && this.logChannel) {
5544
- return await this._sendToChannel(this.logChannel, content, "debug");
5597
+ if (logConfig?.debug.discord && this.debugChannel) {
5598
+ return await this._sendToChannel(this.debugChannel, content, "debug");
5545
5599
  }
5546
5600
  }
5547
5601
  };
5548
5602
  _BotLog.logChannel = null;
5603
+ _BotLog.warnChannel = null;
5604
+ _BotLog.debugChannel = null;
5549
5605
  _BotLog.errorChannel = null;
5550
5606
  var BotLog = _BotLog;
5551
5607
 
@@ -5661,8 +5717,8 @@ var EmbedManager = class {
5661
5717
  /**
5662
5718
  * Quick field adder
5663
5719
  */
5664
- static field(embed, name, value, inline = false) {
5665
- return embed.addFields({ name, value, inline });
5720
+ static field(embed, field) {
5721
+ return embed.addFields({ name: field.name, value: field.value, inline: field.inline ?? false });
5666
5722
  }
5667
5723
  static fields(embed, fields) {
5668
5724
  fields.forEach((f3) => {
@@ -14315,7 +14371,7 @@ var _Bot = class _Bot {
14315
14371
  Log.error(`Connection error : ${error}. Trying again...`);
14316
14372
  tries++;
14317
14373
  await new Promise(
14318
- (resolve) => setTimeout(resolve, Time.second.SEC_03.toMilliseconds())
14374
+ (resolve2) => setTimeout(resolve2, Time.second.SEC_03.toMilliseconds())
14319
14375
  );
14320
14376
  }
14321
14377
  }
@@ -14478,86 +14534,102 @@ var FileManager = class {
14478
14534
 
14479
14535
  // src/manager/messages/WebhookManager.ts
14480
14536
  var import_discord7 = require("discord.js");
14537
+ var import_promises2 = require("fs/promises");
14538
+ var import_path2 = require("path");
14481
14539
  var WebhookManager = class {
14482
- constructor(channel, name = Bot.config.botName || "", avatarURL) {
14483
- this.channel = channel;
14540
+ constructor(client, name, avatarPathOrUrl) {
14541
+ this.client = client;
14484
14542
  this.name = name;
14485
- this.avatarURL = avatarURL;
14543
+ this.avatarPathOrUrl = avatarPathOrUrl;
14486
14544
  this.webhook = null;
14487
14545
  }
14488
- get textChannel() {
14489
- return this.channel instanceof import_discord7.ThreadChannel ? this.channel.parent : this.channel;
14546
+ async getAvatar() {
14547
+ if (!this.avatarPathOrUrl) return null;
14548
+ if (this.avatarPathOrUrl.startsWith("http://") || this.avatarPathOrUrl.startsWith("https://")) {
14549
+ return this.avatarPathOrUrl;
14550
+ }
14551
+ try {
14552
+ const resolvedPath = (0, import_path2.resolve)(process.cwd(), this.avatarPathOrUrl);
14553
+ return await (0, import_promises2.readFile)(resolvedPath);
14554
+ } catch (error) {
14555
+ Bot.log.warn(`Failed to load avatar from ${this.avatarPathOrUrl}: ${error}`);
14556
+ return null;
14557
+ }
14558
+ }
14559
+ /**
14560
+ * Récupère le channel à partir de l'ID ou utilise directement si TextChannel/ThreadChannel
14561
+ */
14562
+ async getTextChannel(channelId) {
14563
+ const channel = await this.client.channels.fetch(channelId);
14564
+ if (!channel || !(channel instanceof import_discord7.TextChannel)) {
14565
+ throw new Error(`Channel ${channelId} is not a TextChannel`);
14566
+ }
14567
+ return channel;
14490
14568
  }
14491
14569
  /**
14492
14570
  * Get or create webhook (lazy initialization)
14493
14571
  */
14494
- async getWebhook() {
14572
+ async getWebhook(channelId) {
14495
14573
  if (this.webhook) return this.webhook;
14496
14574
  try {
14497
- const webhooks = await this.textChannel.fetchWebhooks();
14498
- this.webhook = webhooks.find((h3) => h3.name === this.name && h3.owner?.id == Bot.client.user?.id) ?? await this.textChannel.createWebhook({
14575
+ const textChannel = await this.getTextChannel(channelId);
14576
+ const webhooks = await textChannel.fetchWebhooks();
14577
+ this.webhook = webhooks.find((h3) => h3.name === this.name && h3.owner?.id == this.client.user?.id) ?? await textChannel.createWebhook({
14499
14578
  name: this.name,
14500
- avatar: this.avatarURL,
14579
+ avatar: await this.getAvatar(),
14501
14580
  reason: "Auto-created by WebhookManager"
14502
14581
  });
14503
- Log.info(`Webhook ${this.webhook.id} ready for ${this.textChannel.id}`);
14582
+ Bot.log.debug(`Webhook ${this.webhook.id} ready for channel ${channelId}`);
14504
14583
  return this.webhook;
14505
14584
  } catch (error) {
14506
- Log.error(`Failed to setup webhook: ${error}`);
14585
+ Bot.log.error(`Failed to setup webhook for ${channelId}: ${error}`);
14507
14586
  throw error;
14508
14587
  }
14509
14588
  }
14510
- async send(content) {
14511
- const webhook = await this.getWebhook();
14512
- const options = {};
14589
+ async send(channelId, content) {
14590
+ const webhook = await this.getWebhook(channelId);
14591
+ let options = {};
14513
14592
  if (SendableComponentBuilder.isSendableComponent(content)) {
14514
- const t3 = SendableComponentBuilder.buildMessage(content);
14515
- options.embeds = t3.embeds;
14516
- options.components = t3.components;
14517
- } else if (typeof content == "string") {
14593
+ options = SendableComponentBuilder.buildMessage(content);
14594
+ } else if (typeof content === "string") {
14518
14595
  options.content = content;
14519
14596
  } else if (typeof content === "object") {
14520
14597
  Object.assign(options, content);
14521
14598
  } else {
14522
- options.content = content;
14523
- }
14524
- if (this.channel instanceof import_discord7.ThreadChannel) {
14525
- options.threadId = this.channel.id;
14599
+ options.content = String(content);
14526
14600
  }
14527
14601
  try {
14528
- const message = await webhook.send(options);
14529
- Log.info(`Webhook sent to ${this.channel.id}: ${content}`);
14530
- return message;
14602
+ return await webhook.send(options);
14531
14603
  } catch (error) {
14532
- Log.error(`Webhook send failed ${this.channel.id}: ${error}`);
14604
+ Bot.log.error(`Webhook send failed to ${channelId}: ${error}`);
14533
14605
  return null;
14534
14606
  }
14535
14607
  }
14536
14608
  /**
14537
14609
  * Quick success embed
14538
14610
  */
14539
- async success(message) {
14540
- return await this.send(EmbedManager.success(message));
14611
+ async success(channelId, message) {
14612
+ return await this.send(channelId, EmbedManager.success(message));
14541
14613
  }
14542
14614
  /**
14543
14615
  * Quick error embed
14544
14616
  */
14545
- async error(message) {
14546
- return await this.send(EmbedManager.error(message));
14617
+ async error(channelId, message) {
14618
+ return await this.send(channelId, EmbedManager.error(message));
14547
14619
  }
14548
14620
  /**
14549
14621
  * Delete webhook
14550
14622
  */
14551
- async delete(reason) {
14623
+ async delete(channelId, reason) {
14552
14624
  if (!this.webhook) return;
14553
14625
  try {
14554
14626
  await this.webhook.delete(reason ?? "Deleted by WebhookManager");
14555
- Log.info(`Webhook ${this.webhook.id} deleted`);
14627
+ Bot.log.info(`Webhook ${this.webhook.id} deleted from ${channelId}`);
14556
14628
  } catch (error) {
14557
14629
  if (error.message.includes("Unknown Webhook")) {
14558
- Log.warn("Webhook already deleted");
14630
+ Bot.log.warn(`Webhook already deleted from ${channelId}`);
14559
14631
  } else {
14560
- Log.error(`Failed to delete webhook: ${error}`);
14632
+ Bot.log.error(`Failed to delete webhook from ${channelId}: ${error}`);
14561
14633
  }
14562
14634
  } finally {
14563
14635
  this.webhook = null;
@@ -14863,7 +14935,7 @@ var ReactionManager = class {
14863
14935
  };
14864
14936
 
14865
14937
  // src/manager/guild/GuildManager.ts
14866
- var import_discord15 = require("discord.js");
14938
+ var import_discord14 = require("discord.js");
14867
14939
 
14868
14940
  // src/manager/direct/BasicUserManager.ts
14869
14941
  var import_discord9 = require("discord.js");
@@ -14938,22 +15010,9 @@ var BasicUserManager = class {
14938
15010
  };
14939
15011
 
14940
15012
  // src/manager/guild/GuildUserManager.ts
14941
- var import_discord10 = require("discord.js");
14942
- var import_promises2 = require("timers/promises");
15013
+ var import_promises3 = require("timers/promises");
14943
15014
  var MAX_NICKNAME_LENGTH = 32;
14944
15015
  var GuildUserManager = class extends BasicUserManager {
14945
- static async find(userId, guild) {
14946
- try {
14947
- if (guild instanceof import_discord10.Guild) {
14948
- return await guild.members.fetch(userId);
14949
- } else {
14950
- return await (await GuildManager.find(guild)).members.fetch(userId);
14951
- }
14952
- } catch (error) {
14953
- Log.error(`UserManager: Member ${userId} not found`);
14954
- return null;
14955
- }
14956
- }
14957
15016
  static async rename(member, nickname, maxAttempts = 3) {
14958
15017
  if (nickname.length > MAX_NICKNAME_LENGTH) {
14959
15018
  nickname = nickname.slice(0, MAX_NICKNAME_LENGTH);
@@ -14963,11 +15022,11 @@ var GuildUserManager = class extends BasicUserManager {
14963
15022
  const oldName = member.displayName;
14964
15023
  await member.setNickname(nickname.trim());
14965
15024
  Log.info(`Renaming user: ${oldName} \u2192 ${nickname.trim()}`);
14966
- await (0, import_promises2.setTimeout)(1500);
15025
+ await (0, import_promises3.setTimeout)(1500);
14967
15026
  return true;
14968
15027
  } catch (error) {
14969
15028
  console.error(`Attempt ${attempts + 1} failed when renaming ${member.displayName} into ${nickname.trim()}:`, error);
14970
- await (0, import_promises2.setTimeout)(1e3);
15029
+ await (0, import_promises3.setTimeout)(1e3);
14971
15030
  }
14972
15031
  }
14973
15032
  Bot.log.info(EmbedManager.error(`Failed to rename ${member.displayName} to ${nickname.trim()} after ${maxAttempts} attempts.`));
@@ -15242,15 +15301,15 @@ var RoleManager = class {
15242
15301
  };
15243
15302
 
15244
15303
  // src/manager/guild/ChannelManager/ForumChannelManager.ts
15245
- var import_discord11 = require("discord.js");
15304
+ var import_discord10 = require("discord.js");
15246
15305
  var ForumChannelManager = class extends GuildChannelManager {
15247
15306
  static async findInGuild(guildId, channelId) {
15248
15307
  const channel = await super.findInGuild(guildId, channelId);
15249
- return channel instanceof import_discord11.ForumChannel ? channel : null;
15308
+ return channel instanceof import_discord10.ForumChannel ? channel : null;
15250
15309
  }
15251
15310
  static async find(channelId) {
15252
15311
  const channel = await super.find(channelId);
15253
- return channel instanceof import_discord11.ForumChannel ? channel : null;
15312
+ return channel instanceof import_discord10.ForumChannel ? channel : null;
15254
15313
  }
15255
15314
  static findAll(guildId) {
15256
15315
  const guild = Bot.client.guilds.cache.get(guildId);
@@ -15258,27 +15317,27 @@ var ForumChannelManager = class extends GuildChannelManager {
15258
15317
  Log.warn(`Guild ${guildId} not found`);
15259
15318
  return [];
15260
15319
  }
15261
- return Array.from(guild.channels.cache.values()).filter((c3) => c3 instanceof import_discord11.ForumChannel);
15320
+ return Array.from(guild.channels.cache.values()).filter((c3) => c3 instanceof import_discord10.ForumChannel);
15262
15321
  }
15263
15322
  static async create(guildId, name, options) {
15264
15323
  return await super._create(guildId, {
15265
15324
  name,
15266
- type: import_discord11.ChannelType.GuildForum,
15325
+ type: import_discord10.ChannelType.GuildForum,
15267
15326
  ...options
15268
15327
  });
15269
15328
  }
15270
15329
  };
15271
15330
 
15272
15331
  // src/manager/guild/ChannelManager/NewsChannelManager.ts
15273
- var import_discord12 = require("discord.js");
15332
+ var import_discord11 = require("discord.js");
15274
15333
  var NewsChannelManager = class extends GuildChannelManager {
15275
15334
  static async findInGuild(guildId, channelId) {
15276
15335
  const channel = await super.findInGuild(guildId, channelId);
15277
- return channel instanceof import_discord12.NewsChannel ? channel : null;
15336
+ return channel instanceof import_discord11.NewsChannel ? channel : null;
15278
15337
  }
15279
15338
  static async find(channelId) {
15280
15339
  const channel = await super.find(channelId);
15281
- return channel instanceof import_discord12.NewsChannel ? channel : null;
15340
+ return channel instanceof import_discord11.NewsChannel ? channel : null;
15282
15341
  }
15283
15342
  static findAll(guildId) {
15284
15343
  const guild = Bot.client.guilds.cache.get(guildId);
@@ -15286,27 +15345,27 @@ var NewsChannelManager = class extends GuildChannelManager {
15286
15345
  Log.warn(`Guild ${guildId} not found`);
15287
15346
  return [];
15288
15347
  }
15289
- return Array.from(guild.channels.cache.values()).filter((c3) => c3 instanceof import_discord12.NewsChannel);
15348
+ return Array.from(guild.channels.cache.values()).filter((c3) => c3 instanceof import_discord11.NewsChannel);
15290
15349
  }
15291
15350
  static async create(guildId, name, options) {
15292
15351
  return await super._create(guildId, {
15293
15352
  name,
15294
- type: import_discord12.ChannelType.GuildAnnouncement,
15353
+ type: import_discord11.ChannelType.GuildAnnouncement,
15295
15354
  ...options
15296
15355
  });
15297
15356
  }
15298
15357
  };
15299
15358
 
15300
15359
  // src/manager/guild/ChannelManager/StageChannelManager.ts
15301
- var import_discord13 = require("discord.js");
15360
+ var import_discord12 = require("discord.js");
15302
15361
  var StageChannelManager = class extends GuildChannelManager {
15303
15362
  static async findInGuild(guildId, channelId) {
15304
15363
  const channel = await super.findInGuild(guildId, channelId);
15305
- return channel instanceof import_discord13.StageChannel ? channel : null;
15364
+ return channel instanceof import_discord12.StageChannel ? channel : null;
15306
15365
  }
15307
15366
  static async find(channelId) {
15308
15367
  const channel = await super.find(channelId);
15309
- return channel instanceof import_discord13.StageChannel ? channel : null;
15368
+ return channel instanceof import_discord12.StageChannel ? channel : null;
15310
15369
  }
15311
15370
  static findAll(guildId) {
15312
15371
  const guild = Bot.client.guilds.cache.get(guildId);
@@ -15314,12 +15373,12 @@ var StageChannelManager = class extends GuildChannelManager {
15314
15373
  Log.warn(`Guild ${guildId} not found`);
15315
15374
  return [];
15316
15375
  }
15317
- return Array.from(guild.channels.cache.values()).filter((c3) => c3 instanceof import_discord13.StageChannel);
15376
+ return Array.from(guild.channels.cache.values()).filter((c3) => c3 instanceof import_discord12.StageChannel);
15318
15377
  }
15319
15378
  static async create(guildId, name, options) {
15320
15379
  return await super._create(guildId, {
15321
15380
  name,
15322
- type: import_discord13.ChannelType.GuildStageVoice,
15381
+ type: import_discord12.ChannelType.GuildStageVoice,
15323
15382
  ...options
15324
15383
  });
15325
15384
  }
@@ -15367,7 +15426,7 @@ var ThreadChannelManager = class {
15367
15426
  };
15368
15427
 
15369
15428
  // src/manager/guild/ChannelManager/GuildVoiceChannelManager.ts
15370
- var import_discord14 = require("discord.js");
15429
+ var import_discord13 = require("discord.js");
15371
15430
  var GuildVoiceChannelManager = class extends GuildChannelManager {
15372
15431
  static async findInGuild(guildId, channelId) {
15373
15432
  const channel = await super.findInGuild(guildId, channelId);
@@ -15383,12 +15442,12 @@ var GuildVoiceChannelManager = class extends GuildChannelManager {
15383
15442
  Log.warn(`Guild ${guildId} not found`);
15384
15443
  return [];
15385
15444
  }
15386
- return Array.from(guild.channels.cache.values()).filter((c3) => c3 instanceof import_discord14.VoiceChannel);
15445
+ return Array.from(guild.channels.cache.values()).filter((c3) => c3 instanceof import_discord13.VoiceChannel);
15387
15446
  }
15388
15447
  static async create(guildId, name, options) {
15389
15448
  return await super._create(guildId, {
15390
15449
  name,
15391
- type: import_discord14.ChannelType.GuildVoice,
15450
+ type: import_discord13.ChannelType.GuildVoice,
15392
15451
  ...options
15393
15452
  });
15394
15453
  }
@@ -15470,7 +15529,14 @@ var GuildManager = class {
15470
15529
  return Array.from(Bot.client.guilds.cache.values());
15471
15530
  }
15472
15531
  static async find(guild_id) {
15473
- return await Bot.client.guilds.fetch(guild_id);
15532
+ try {
15533
+ const cached = Bot.client.guilds.cache.get(guild_id);
15534
+ if (cached) return cached;
15535
+ return await Bot.client.guilds.fetch(guild_id);
15536
+ } catch (error) {
15537
+ Log.error(`GuildManager: Guild ${guild_id} : ${error} `);
15538
+ return null;
15539
+ }
15474
15540
  }
15475
15541
  /**
15476
15542
  * Search channel by ID (TextChannel, DMChannel, ThreadChannel)
@@ -15509,7 +15575,7 @@ var GuildManager = class {
15509
15575
  */
15510
15576
  static async fetchAllMembers(guildId, MAX_ATTEMPTS = 3, RETRY_DELAY = Time.minute.MIN_05.toMilliseconds()) {
15511
15577
  let guild;
15512
- if (guildId instanceof import_discord15.Guild) {
15578
+ if (guildId instanceof import_discord14.Guild) {
15513
15579
  guild = guildId;
15514
15580
  } else {
15515
15581
  let tmp = Bot.client.guilds.cache.get(guildId);
@@ -15562,10 +15628,10 @@ var GuildManager = class {
15562
15628
  if (!toChannel) {
15563
15629
  throw new Error(`To channel ${toChannelId} not found`);
15564
15630
  }
15565
- if (!(fromChannel instanceof import_discord15.VoiceChannel || fromChannel instanceof import_discord15.StageChannel)) {
15631
+ if (!(fromChannel instanceof import_discord14.VoiceChannel || fromChannel instanceof import_discord14.StageChannel)) {
15566
15632
  throw new Error(`From channel ${fromChannelId} is not a voice/stage channel`);
15567
15633
  }
15568
- if (!(toChannel instanceof import_discord15.VoiceChannel || toChannel instanceof import_discord15.StageChannel)) {
15634
+ if (!(toChannel instanceof import_discord14.VoiceChannel || toChannel instanceof import_discord14.StageChannel)) {
15569
15635
  throw new Error(`To channel ${toChannelId} is not a voice/stage channel`);
15570
15636
  }
15571
15637
  if (member.voice.channelId !== fromChannelId) {
@@ -15602,7 +15668,7 @@ var UserManager = class extends BasicUserManager {
15602
15668
  };
15603
15669
 
15604
15670
  // src/manager/interactions/ModalManager.ts
15605
- var import_discord16 = require("discord.js");
15671
+ var import_discord15 = require("discord.js");
15606
15672
  var ModalFieldType = /* @__PURE__ */ ((ModalFieldType2) => {
15607
15673
  ModalFieldType2[ModalFieldType2["SHORT"] = 0] = "SHORT";
15608
15674
  ModalFieldType2[ModalFieldType2["LONG"] = 1] = "LONG";
@@ -15616,13 +15682,13 @@ var ModalManager = class {
15616
15682
  * Creates base Modal - SIMPLE API !
15617
15683
  */
15618
15684
  static create(modalTitle, customId) {
15619
- return new import_discord16.ModalBuilder().setTitle(modalTitle).setCustomId(customId);
15685
+ return new import_discord15.ModalBuilder().setTitle(modalTitle).setCustomId(customId);
15620
15686
  }
15621
15687
  /**
15622
15688
  * Individual field creator
15623
15689
  */
15624
15690
  static _createField(opt) {
15625
- const builder = new import_discord16.TextInputBuilder().setCustomId(opt.customId).setRequired(opt.required ?? false);
15691
+ const builder = new import_discord15.TextInputBuilder().setCustomId(opt.customId).setRequired(opt.required ?? false);
15626
15692
  if (opt.value) {
15627
15693
  builder.setValue(opt.value);
15628
15694
  }
@@ -15633,22 +15699,22 @@ var ModalManager = class {
15633
15699
  }
15634
15700
  switch (opt.type) {
15635
15701
  case 0 /* SHORT */:
15636
- builder.setStyle(import_discord16.TextInputStyle.Short).setMaxLength(4e3);
15702
+ builder.setStyle(import_discord15.TextInputStyle.Short).setMaxLength(4e3);
15637
15703
  break;
15638
15704
  case 1 /* LONG */:
15639
- builder.setStyle(import_discord16.TextInputStyle.Paragraph).setMaxLength(4e3);
15705
+ builder.setStyle(import_discord15.TextInputStyle.Paragraph).setMaxLength(4e3);
15640
15706
  break;
15641
15707
  case 2 /* NUMBER */:
15642
- builder.setStyle(import_discord16.TextInputStyle.Short).setMaxLength(10);
15708
+ builder.setStyle(import_discord15.TextInputStyle.Short).setMaxLength(10);
15643
15709
  break;
15644
15710
  case 3 /* DATE */:
15645
- builder.setStyle(import_discord16.TextInputStyle.Short).setMaxLength(10).setPlaceholder("YYYY-MM-DD / DD-MM-YYYY or YYYY/MM/DD / DD/MM/YYYY");
15711
+ builder.setStyle(import_discord15.TextInputStyle.Short).setMaxLength(10).setPlaceholder("YYYY-MM-DD / DD-MM-YYYY or YYYY/MM/DD / DD/MM/YYYY");
15646
15712
  break;
15647
15713
  case 4 /* PHONE */:
15648
- builder.setStyle(import_discord16.TextInputStyle.Short).setMaxLength(20);
15714
+ builder.setStyle(import_discord15.TextInputStyle.Short).setMaxLength(20);
15649
15715
  break;
15650
15716
  }
15651
- return new import_discord16.LabelBuilder().setLabel(opt.label).setTextInputComponent(builder);
15717
+ return new import_discord15.LabelBuilder().setLabel(opt.label).setTextInputComponent(builder);
15652
15718
  }
15653
15719
  /**
15654
15720
  * Simple modal with ONE field - DIRECT ModalBuilder return !
@@ -15756,7 +15822,7 @@ var ModalManager = class {
15756
15822
  };
15757
15823
 
15758
15824
  // src/manager/messages/ComponentManager.ts
15759
- var import_discord17 = require("discord.js");
15825
+ var import_discord16 = require("discord.js");
15760
15826
  var ComponentManager = class {
15761
15827
  static get DEFAULT_COLOR() {
15762
15828
  return Bot.config?.defaultSimpleColor || 6064856 /* default */;
@@ -15765,28 +15831,28 @@ var ComponentManager = class {
15765
15831
  * Creates base ComponentV2
15766
15832
  */
15767
15833
  static create(option) {
15768
- const container = new import_discord17.ContainerBuilder();
15834
+ const container = new import_discord16.ContainerBuilder();
15769
15835
  const colorC = option?.color ?? this.DEFAULT_COLOR;
15770
15836
  if (colorC !== "transparent" /* transparent */) {
15771
15837
  container.setAccentColor(colorC);
15772
15838
  }
15773
15839
  if (option?.title || option?.thumbnailUrl) {
15774
15840
  if (option?.thumbnailUrl) {
15775
- const headerSection = new import_discord17.SectionBuilder().addTextDisplayComponents(
15776
- new import_discord17.TextDisplayBuilder().setContent(
15841
+ const headerSection = new import_discord16.SectionBuilder().addTextDisplayComponents(
15842
+ new import_discord16.TextDisplayBuilder().setContent(
15777
15843
  option?.title ? option.title : "\u200B"
15778
15844
  )
15779
15845
  ).setThumbnailAccessory(
15780
- new import_discord17.ThumbnailBuilder().setURL(option.thumbnailUrl)
15846
+ new import_discord16.ThumbnailBuilder().setURL(option.thumbnailUrl)
15781
15847
  );
15782
15848
  container.addSectionComponents(headerSection);
15783
15849
  } else {
15784
15850
  container.addTextDisplayComponents(
15785
- new import_discord17.TextDisplayBuilder().setContent(option.title)
15851
+ new import_discord16.TextDisplayBuilder().setContent(option.title)
15786
15852
  );
15787
15853
  }
15788
15854
  if (option?.description) {
15789
- container.addTextDisplayComponents(new import_discord17.TextDisplayBuilder().setContent(option.description));
15855
+ container.addTextDisplayComponents(new import_discord16.TextDisplayBuilder().setContent(option.description));
15790
15856
  }
15791
15857
  if (option?.separator) {
15792
15858
  container.addSeparatorComponents(this.separator(option.separator));
@@ -15798,20 +15864,20 @@ var ComponentManager = class {
15798
15864
  * Creates simple ComponentV2 with just description
15799
15865
  */
15800
15866
  static simple(description, color = null) {
15801
- return this.create({ color }).addTextDisplayComponents(new import_discord17.TextDisplayBuilder().setContent(description)).addSeparatorComponents(this.separator());
15867
+ return this.create({ color }).addTextDisplayComponents(new import_discord16.TextDisplayBuilder().setContent(description)).addSeparatorComponents(this.separator());
15802
15868
  }
15803
15869
  /**
15804
15870
  * Creates success ComponentV2
15805
15871
  */
15806
15872
  static success(description) {
15807
- return this.create({ title: "Success", color: 65280 /* success */ }).addTextDisplayComponents(new import_discord17.TextDisplayBuilder().setContent(description)).addSeparatorComponents(this.separator());
15873
+ return this.create({ title: "Success", color: 65280 /* success */ }).addTextDisplayComponents(new import_discord16.TextDisplayBuilder().setContent(description)).addSeparatorComponents(this.separator());
15808
15874
  }
15809
15875
  /**
15810
15876
  * Creates debug ComponentV2
15811
15877
  */
15812
15878
  static debug(description) {
15813
15879
  return this.create({ title: "Debug", color: 25600 /* minecraft */ }).addTextDisplayComponents(
15814
- new import_discord17.TextDisplayBuilder().setContent(description)
15880
+ new import_discord16.TextDisplayBuilder().setContent(description)
15815
15881
  ).addSeparatorComponents(this.separator());
15816
15882
  }
15817
15883
  /**
@@ -15819,31 +15885,31 @@ var ComponentManager = class {
15819
15885
  */
15820
15886
  static error(description) {
15821
15887
  return this.create({ title: "Something went wrong", color: 8912917 /* error */ }).addTextDisplayComponents(
15822
- new import_discord17.TextDisplayBuilder().setContent(description)
15888
+ new import_discord16.TextDisplayBuilder().setContent(description)
15823
15889
  ).addSeparatorComponents(this.separator());
15824
15890
  }
15825
- static separator(spacing = import_discord17.SeparatorSpacingSize.Small) {
15826
- return new import_discord17.SeparatorBuilder().setDivider(true).setSpacing(spacing);
15891
+ static separator(spacing = import_discord16.SeparatorSpacingSize.Small) {
15892
+ return new import_discord16.SeparatorBuilder().setDivider(true).setSpacing(spacing);
15827
15893
  }
15828
15894
  /**
15829
15895
  * Quick field adder
15830
15896
  */
15831
15897
  static fieldAddText(container, options) {
15832
- options.name && container.addTextDisplayComponents(new import_discord17.TextDisplayBuilder().setContent(`__**${options.name}**__`));
15833
- container.addTextDisplayComponents(new import_discord17.TextDisplayBuilder().setContent(options.value));
15898
+ options.name && container.addTextDisplayComponents(new import_discord16.TextDisplayBuilder().setContent(`__**${options.name}**__`));
15899
+ container.addTextDisplayComponents(new import_discord16.TextDisplayBuilder().setContent(options.value));
15834
15900
  }
15835
15901
  static field(container, field) {
15836
15902
  if ("button" in field && Array.isArray(field.button) && field.button.length > 0) {
15837
- const actionRow = new import_discord17.ActionRowBuilder().addComponents(field.button);
15903
+ const actionRow = new import_discord16.ActionRowBuilder().addComponents(field.button);
15838
15904
  this.fieldAddText(container, { name: field.name, value: field.value });
15839
15905
  container.addActionRowComponents(actionRow);
15840
15906
  } else if ("button" in field && !Array.isArray(field.button) || "thumbnailUrl" in field) {
15841
- const section = new import_discord17.SectionBuilder();
15907
+ const section = new import_discord16.SectionBuilder();
15842
15908
  this.fieldAddText(section, { name: field.name, value: field.value });
15843
15909
  if ("button" in field && !Array.isArray(field.button)) {
15844
15910
  section.setButtonAccessory(field.button);
15845
15911
  } else if ("thumbnailUrl" in field) {
15846
- section.setThumbnailAccessory(new import_discord17.ThumbnailBuilder().setURL(field.thumbnailUrl));
15912
+ section.setThumbnailAccessory(new import_discord16.ThumbnailBuilder().setURL(field.thumbnailUrl));
15847
15913
  }
15848
15914
  container.addSectionComponents(section);
15849
15915
  } else {
@@ -15871,9 +15937,9 @@ var ComponentManager = class {
15871
15937
  * Add a media gallery (links)
15872
15938
  */
15873
15939
  static mediaGallery(container, medias) {
15874
- const gallery = new import_discord17.MediaGalleryBuilder();
15940
+ const gallery = new import_discord16.MediaGalleryBuilder();
15875
15941
  medias.forEach((med) => {
15876
- gallery.addItems(new import_discord17.MediaGalleryItemBuilder().setURL(med.url).setSpoiler(med.spoiler ?? false));
15942
+ gallery.addItems(new import_discord16.MediaGalleryItemBuilder().setURL(med.url).setSpoiler(med.spoiler ?? false));
15877
15943
  });
15878
15944
  container.addMediaGalleryComponents(gallery);
15879
15945
  return container;
@@ -15890,12 +15956,12 @@ var ComponentManager = class {
15890
15956
  const files = [];
15891
15957
  const fileArray = Array.isArray(file) ? file : [file];
15892
15958
  fileArray.forEach((f3) => {
15893
- const attachment = new import_discord17.AttachmentBuilder(f3.buffer, {
15959
+ const attachment = new import_discord16.AttachmentBuilder(f3.buffer, {
15894
15960
  name: f3.name
15895
15961
  });
15896
15962
  files.push(attachment);
15897
15963
  container.addFileComponents(
15898
- new import_discord17.FileBuilder().setURL(`attachment://${f3.name}`).setSpoiler(f3.spoiler ?? false)
15964
+ new import_discord16.FileBuilder().setURL(`attachment://${f3.name}`).setSpoiler(f3.spoiler ?? false)
15899
15965
  );
15900
15966
  container.addSeparatorComponents(this.separator());
15901
15967
  });
@@ -15903,7 +15969,7 @@ var ComponentManager = class {
15903
15969
  }
15904
15970
  static footer(container) {
15905
15971
  container.addTextDisplayComponents(
15906
- new import_discord17.TextDisplayBuilder().setContent(`-# **${Bot.config?.botName || "Bot"} \xB7 <t:${Math.floor(Date.now() / 1e3)}:d> <t:${Math.floor(Date.now() / 1e3)}:t>**`)
15972
+ new import_discord16.TextDisplayBuilder().setContent(`-# **${Bot.config?.botName || "Bot"} \xB7 <t:${Math.floor(Date.now() / 1e3)}:d> <t:${Math.floor(Date.now() / 1e3)}:t>**`)
15907
15973
  );
15908
15974
  return container;
15909
15975
  }
@@ -15921,12 +15987,12 @@ var ComponentManager = class {
15921
15987
  return {
15922
15988
  components: [container],
15923
15989
  files: Array.isArray(file) ? file : [file],
15924
- flags: [import_discord17.MessageFlags.IsComponentsV2]
15990
+ flags: [import_discord16.MessageFlags.IsComponentsV2]
15925
15991
  };
15926
15992
  }
15927
15993
  return {
15928
15994
  components: [container],
15929
- flags: [import_discord17.MessageFlags.IsComponentsV2]
15995
+ flags: [import_discord16.MessageFlags.IsComponentsV2]
15930
15996
  };
15931
15997
  }
15932
15998
  static toInteraction(container, file = null, footer = true) {
@@ -15935,7 +16001,7 @@ var ComponentManager = class {
15935
16001
  }
15936
16002
  const base = {
15937
16003
  components: [container],
15938
- flags: [import_discord17.MessageFlags.IsComponentsV2]
16004
+ flags: [import_discord16.MessageFlags.IsComponentsV2]
15939
16005
  };
15940
16006
  if (file) {
15941
16007
  return {
@@ -15963,29 +16029,29 @@ var ComponentManager = class {
15963
16029
  };
15964
16030
 
15965
16031
  // src/manager/interactions/ButtonManager.ts
15966
- var import_discord18 = require("discord.js");
16032
+ var import_discord17 = require("discord.js");
15967
16033
  var ButtonManager = class _ButtonManager {
15968
16034
  static create(options) {
15969
- const btn = new import_discord18.ButtonBuilder().setCustomId(options.customId).setLabel(options.label ?? "Button").setStyle(options.style).setDisabled(options.disabled ?? false);
16035
+ const btn = new import_discord17.ButtonBuilder().setCustomId(options.customId).setLabel(options.label ?? "Button").setStyle(options.style).setDisabled(options.disabled ?? false);
15970
16036
  if (options.emoji) {
15971
16037
  btn.setEmoji(options.emoji);
15972
16038
  }
15973
16039
  return btn;
15974
16040
  }
15975
16041
  static primary(options) {
15976
- return this.create({ ...options, style: import_discord18.ButtonStyle.Primary });
16042
+ return this.create({ ...options, style: import_discord17.ButtonStyle.Primary });
15977
16043
  }
15978
16044
  static success(options) {
15979
- return this.create({ ...options, style: import_discord18.ButtonStyle.Success });
16045
+ return this.create({ ...options, style: import_discord17.ButtonStyle.Success });
15980
16046
  }
15981
16047
  static secondary(options) {
15982
- return this.create({ ...options, style: import_discord18.ButtonStyle.Secondary });
16048
+ return this.create({ ...options, style: import_discord17.ButtonStyle.Secondary });
15983
16049
  }
15984
16050
  static danger(options) {
15985
- return this.create({ ...options, style: import_discord18.ButtonStyle.Danger });
16051
+ return this.create({ ...options, style: import_discord17.ButtonStyle.Danger });
15986
16052
  }
15987
16053
  static link(options) {
15988
- const btn = new import_discord18.ButtonBuilder().setLabel(options.label).setStyle(import_discord18.ButtonStyle.Link).setURL(options.url);
16054
+ const btn = new import_discord17.ButtonBuilder().setLabel(options.label).setStyle(import_discord17.ButtonStyle.Link).setURL(options.url);
15989
16055
  if (options.emoji) btn.setEmoji(options.emoji);
15990
16056
  return btn;
15991
16057
  }
@@ -15997,7 +16063,7 @@ var ButtonManager = class _ButtonManager {
15997
16063
  }
15998
16064
  static row(but) {
15999
16065
  const buttons = Array.isArray(but) ? but.slice(0, 5) : [but];
16000
- return new import_discord18.ActionRowBuilder().addComponents(buttons);
16066
+ return new import_discord17.ActionRowBuilder().addComponents(buttons);
16001
16067
  }
16002
16068
  static toMessage(button) {
16003
16069
  return {
@@ -16007,7 +16073,7 @@ var ButtonManager = class _ButtonManager {
16007
16073
  static toInteraction(button, ephemeral = false) {
16008
16074
  return {
16009
16075
  components: this.createRowsToReturn(button),
16010
- flags: ephemeral ? [import_discord18.MessageFlags.Ephemeral] : []
16076
+ flags: ephemeral ? [import_discord17.MessageFlags.Ephemeral] : []
16011
16077
  };
16012
16078
  }
16013
16079
  static toInteractionEdit(button) {
@@ -16018,10 +16084,10 @@ var ButtonManager = class _ButtonManager {
16018
16084
  static createRowsToReturn(button) {
16019
16085
  if (Array.isArray(button)) {
16020
16086
  return button.map(
16021
- (btn) => btn instanceof import_discord18.ActionRowBuilder ? btn : _ButtonManager.row(btn)
16087
+ (btn) => btn instanceof import_discord17.ActionRowBuilder ? btn : _ButtonManager.row(btn)
16022
16088
  );
16023
16089
  }
16024
- return button instanceof import_discord18.ActionRowBuilder ? [button] : [_ButtonManager.row(button)];
16090
+ return button instanceof import_discord17.ActionRowBuilder ? [button] : [_ButtonManager.row(button)];
16025
16091
  }
16026
16092
  };
16027
16093
 
@@ -16038,8 +16104,8 @@ var SimpleMutex = class {
16038
16104
  */
16039
16105
  async lock() {
16040
16106
  if (this._locked) {
16041
- return new Promise((resolve) => {
16042
- this.queue.push(resolve);
16107
+ return new Promise((resolve2) => {
16108
+ this.queue.push(resolve2);
16043
16109
  });
16044
16110
  }
16045
16111
  this._locked = true;
@@ -16066,7 +16132,7 @@ var SimpleMutex = class {
16066
16132
  // package.json
16067
16133
  var package_default = {
16068
16134
  name: "@spatulox/simplediscordbot",
16069
- version: "1.7.0",
16135
+ version: "1.7.1",
16070
16136
  author: "Spatulox",
16071
16137
  description: "Simple discord bot framework to set up a bot under 30 secondes",
16072
16138
  exports: {