@spatulox/simplediscordbot 1.0.35 → 1.0.36

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
@@ -1377,33 +1377,48 @@ var _GuildChannelManager = class _GuildChannelManager {
1377
1377
  }
1378
1378
  }
1379
1379
  static async find(channelId) {
1380
- const cached = Bot.client.channels.cache.get(channelId);
1381
- if (cached && cached instanceof import_discord7.GuildChannel) return cached;
1382
- const channel = await Bot.client.channels.fetch(channelId);
1383
- if (channel && channel instanceof import_discord7.GuildChannel) return channel;
1384
- Log.warn(`Channel ${channelId} not found in any guild`);
1385
- return null;
1380
+ try {
1381
+ const cached = Bot.client.channels.cache.get(channelId);
1382
+ if (cached && cached instanceof import_discord7.GuildChannel) return cached;
1383
+ const channel = await Bot.client.channels.fetch(channelId);
1384
+ if (channel && channel instanceof import_discord7.GuildChannel) return channel;
1385
+ Log.warn(`Channel ${channelId} not found in any guild`);
1386
+ return null;
1387
+ } catch (error) {
1388
+ Log.error(`Failed to find channel ${channelId}: ${error}`);
1389
+ return null;
1390
+ }
1386
1391
  }
1387
1392
  static findAll(guildId) {
1388
- const guild = Bot.client.guilds.cache.get(guildId);
1389
- if (!guild) {
1390
- Log.warn(`Guild ${guildId} not found`);
1393
+ try {
1394
+ const guild = Bot.client.guilds.cache.get(guildId);
1395
+ if (!guild) {
1396
+ Log.warn(`Guild ${guildId} not found`);
1397
+ return [];
1398
+ }
1399
+ return Array.from(guild.channels.cache.values());
1400
+ } catch (error) {
1401
+ Log.error(`Failed to find channel ${guildId}: ${error}`);
1391
1402
  return [];
1392
1403
  }
1393
- return Array.from(guild.channels.cache.values());
1394
1404
  }
1395
1405
  /**
1396
1406
  * Recherche channels par nom (insensible à la casse)
1397
1407
  */
1398
1408
  static findByName(guildId, name) {
1399
- const guild = Bot.client.guilds.cache.get(guildId);
1400
- if (!guild) {
1401
- Log.warn(`Guild ${guildId} not found`);
1409
+ try {
1410
+ const guild = Bot.client.guilds.cache.get(guildId);
1411
+ if (!guild) {
1412
+ Log.warn(`Guild ${guildId} not found`);
1413
+ return [];
1414
+ }
1415
+ return Array.from(guild.channels.cache.values()).filter(
1416
+ (channel) => channel.name.toLowerCase().includes(name.toLowerCase())
1417
+ );
1418
+ } catch (error) {
1419
+ Log.error(`Failed to find channel ${guildId}: ${error}`);
1402
1420
  return [];
1403
1421
  }
1404
- return Array.from(guild.channels.cache.values()).filter(
1405
- (channel) => channel.name.toLowerCase().includes(name.toLowerCase())
1406
- );
1407
1422
  }
1408
1423
  static async _create(guildId, options) {
1409
1424
  try {
@@ -2520,7 +2535,7 @@ var SimpleMutex = class {
2520
2535
  // package.json
2521
2536
  var package_default = {
2522
2537
  name: "@spatulox/simplediscordbot",
2523
- version: "1.0.34",
2538
+ version: "1.0.35",
2524
2539
  author: "Spatulox",
2525
2540
  description: "Simple discord bot framework to set up a bot under 30 secondes",
2526
2541
  exports: {
package/dist/index.mjs CHANGED
@@ -1340,33 +1340,48 @@ var _GuildChannelManager = class _GuildChannelManager {
1340
1340
  }
1341
1341
  }
1342
1342
  static async find(channelId) {
1343
- const cached = Bot.client.channels.cache.get(channelId);
1344
- if (cached && cached instanceof GuildChannel) return cached;
1345
- const channel = await Bot.client.channels.fetch(channelId);
1346
- if (channel && channel instanceof GuildChannel) return channel;
1347
- Log.warn(`Channel ${channelId} not found in any guild`);
1348
- return null;
1343
+ try {
1344
+ const cached = Bot.client.channels.cache.get(channelId);
1345
+ if (cached && cached instanceof GuildChannel) return cached;
1346
+ const channel = await Bot.client.channels.fetch(channelId);
1347
+ if (channel && channel instanceof GuildChannel) return channel;
1348
+ Log.warn(`Channel ${channelId} not found in any guild`);
1349
+ return null;
1350
+ } catch (error) {
1351
+ Log.error(`Failed to find channel ${channelId}: ${error}`);
1352
+ return null;
1353
+ }
1349
1354
  }
1350
1355
  static findAll(guildId) {
1351
- const guild = Bot.client.guilds.cache.get(guildId);
1352
- if (!guild) {
1353
- Log.warn(`Guild ${guildId} not found`);
1356
+ try {
1357
+ const guild = Bot.client.guilds.cache.get(guildId);
1358
+ if (!guild) {
1359
+ Log.warn(`Guild ${guildId} not found`);
1360
+ return [];
1361
+ }
1362
+ return Array.from(guild.channels.cache.values());
1363
+ } catch (error) {
1364
+ Log.error(`Failed to find channel ${guildId}: ${error}`);
1354
1365
  return [];
1355
1366
  }
1356
- return Array.from(guild.channels.cache.values());
1357
1367
  }
1358
1368
  /**
1359
1369
  * Recherche channels par nom (insensible à la casse)
1360
1370
  */
1361
1371
  static findByName(guildId, name) {
1362
- const guild = Bot.client.guilds.cache.get(guildId);
1363
- if (!guild) {
1364
- Log.warn(`Guild ${guildId} not found`);
1372
+ try {
1373
+ const guild = Bot.client.guilds.cache.get(guildId);
1374
+ if (!guild) {
1375
+ Log.warn(`Guild ${guildId} not found`);
1376
+ return [];
1377
+ }
1378
+ return Array.from(guild.channels.cache.values()).filter(
1379
+ (channel) => channel.name.toLowerCase().includes(name.toLowerCase())
1380
+ );
1381
+ } catch (error) {
1382
+ Log.error(`Failed to find channel ${guildId}: ${error}`);
1365
1383
  return [];
1366
1384
  }
1367
- return Array.from(guild.channels.cache.values()).filter(
1368
- (channel) => channel.name.toLowerCase().includes(name.toLowerCase())
1369
- );
1370
1385
  }
1371
1386
  static async _create(guildId, options) {
1372
1387
  try {
@@ -2500,7 +2515,7 @@ var SimpleMutex = class {
2500
2515
  // package.json
2501
2516
  var package_default = {
2502
2517
  name: "@spatulox/simplediscordbot",
2503
- version: "1.0.34",
2518
+ version: "1.0.35",
2504
2519
  author: "Spatulox",
2505
2520
  description: "Simple discord bot framework to set up a bot under 30 secondes",
2506
2521
  exports: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spatulox/simplediscordbot",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "author": "Spatulox",
5
5
  "description": "Simple discord bot framework to set up a bot under 30 secondes",
6
6
  "exports": {
package/.env.HDFR_dev DELETED
@@ -1,3 +0,0 @@
1
- DISCORD_BOT_TOKEN=MTM1ODEyOTEwNjc2NzU3NzI1MA.G9gaLP.aYV1MzDwl-1clXsHBcI990ALfofhGR9b3oqaF4
2
- DISCORD_BOT_CLIENTID=1358129106767577250
3
- DEV=true
package/.env.SpatuloxTest DELETED
@@ -1,3 +0,0 @@
1
- DISCORD_BOT_TOKEN=MTM5NTM4MTE2MTA3Mjc5MTcwMg.GODGlC.a6Q_ZN3ik7rruxV_9V6-LJG-6MyFSVWmwMo2XI
2
- DISCORD_BOT_CLIENTID=1395381161072791702
3
- DEV=true
package/.npmignore_old DELETED
@@ -1,23 +0,0 @@
1
- # .npmignore
2
-
3
- # conf files
4
- tsconfig.json
5
- .env
6
- .idea
7
- .gitattributes
8
- node_modules/
9
-
10
-
11
- # project files
12
- src/
13
- src_example
14
- handlers/
15
- *.ts
16
-
17
- # npm repo conf
18
- #!*.d.ts
19
-
20
- dist/**/*.d.ts
21
- !dist/index.d.ts
22
-
23
- dist/**/*.map