@spatulox/simplediscordbot 4.0.2 → 5.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 +16 -0
- package/README.md +2 -2
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +32 -10
- package/dist/index.mjs +39 -17
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
Date format : dd/mm/yyyy
|
|
3
3
|
|
|
4
|
+
### 19/11/2026 - 5.1.0
|
|
5
|
+
- Add :
|
|
6
|
+
- `BotConfig.catchUnhandledRejections` (default `false`) : the unhandled promise rejections of the process are logged with `Bot.log.error` instead of crashing it
|
|
7
|
+
- The client errors (`Events.Error`) are logged with `Bot.log.error` (with the stack trace), an unhandled `error` event no longer crashes the process
|
|
8
|
+
- Fix :
|
|
9
|
+
- `WebhookManager` can send in the text chat of voice and stage channels, and in announcement channels : they threw `is not a TextChannel nor a ThreadChannel`
|
|
10
|
+
|
|
11
|
+
### 14/10/2026 - 5.0.0
|
|
12
|
+
- Breaking :
|
|
13
|
+
- `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
|
|
14
|
+
- Add :
|
|
15
|
+
- `Bot.botName` (read-only, `""` before the client is ready)
|
|
16
|
+
- The embed footer (bot name + icon) is always set once the client is ready, not only when `botName` was configured
|
|
17
|
+
- Fix :
|
|
18
|
+
- `Bot.log` no longer fetches the log channels whose `discord` field is `false`
|
|
19
|
+
|
|
4
20
|
### 29/09/2026 - 4.0.1
|
|
5
21
|
- Fix :
|
|
6
22
|
- `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,13 +57,13 @@ 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},
|
|
64
63
|
warn: {channelId: "YOUR_LOG_CHANNEL_ID", console: true, discord: true},
|
|
65
64
|
debug: {channelId: "YOUR_LOG_CHANNEL_ID", console: true, discord: false},
|
|
66
|
-
}
|
|
65
|
+
},
|
|
66
|
+
catchUnhandledRejections: true, // Log the unhandled promise rejections instead of crashing (default false)
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const bot = new Bot(client, config);
|
package/dist/index.d.mts
CHANGED
|
@@ -153,8 +153,11 @@ declare enum SimpleColor {
|
|
|
153
153
|
|
|
154
154
|
type BotConfig = {
|
|
155
155
|
defaultSimpleColor?: number | SimpleColor;
|
|
156
|
-
botName?: string;
|
|
157
156
|
log?: ConfigLog;
|
|
157
|
+
/**
|
|
158
|
+
* Log the unhandled promise rejections of the whole process with Bot.log.error instead of crashing (default false)
|
|
159
|
+
*/
|
|
160
|
+
catchUnhandledRejections?: boolean;
|
|
158
161
|
};
|
|
159
162
|
type RandomBotActivity = {
|
|
160
163
|
type: ActivityType;
|
|
@@ -167,17 +170,22 @@ declare class Bot {
|
|
|
167
170
|
private static _client;
|
|
168
171
|
private static token;
|
|
169
172
|
private static _config;
|
|
173
|
+
private static _botName;
|
|
170
174
|
private static randomActivityInterval;
|
|
175
|
+
private static unhandledRejectionListening;
|
|
171
176
|
get config(): BotConfig;
|
|
172
177
|
get client(): Client;
|
|
178
|
+
get botName(): string;
|
|
173
179
|
static get client(): Client;
|
|
174
180
|
static get config(): BotConfig;
|
|
181
|
+
static get botName(): string;
|
|
175
182
|
/**
|
|
176
183
|
* Resolves once the login is done (true) or has definitively failed (false)
|
|
177
184
|
*/
|
|
178
185
|
readonly started: Promise<boolean>;
|
|
179
186
|
constructor(client: Client, config?: BotConfig);
|
|
180
187
|
login(maxTries?: number): Promise<boolean>;
|
|
188
|
+
private static formatError;
|
|
181
189
|
static setActivity(message: string, type: ActivityType): void;
|
|
182
190
|
static setRandomActivity(randomActivity: RandomBotActivity, intervalMs?: number | null): void;
|
|
183
191
|
/**
|
|
@@ -262,7 +270,7 @@ declare class WebhookManager {
|
|
|
262
270
|
constructor(client: Client, name: string, avatarPathOrUrl?: string | undefined);
|
|
263
271
|
private getAvatar;
|
|
264
272
|
/**
|
|
265
|
-
*
|
|
273
|
+
* Fetch the targeted channel, which must be able to receive a webhook message
|
|
266
274
|
*/
|
|
267
275
|
private getChannel;
|
|
268
276
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -153,8 +153,11 @@ declare enum SimpleColor {
|
|
|
153
153
|
|
|
154
154
|
type BotConfig = {
|
|
155
155
|
defaultSimpleColor?: number | SimpleColor;
|
|
156
|
-
botName?: string;
|
|
157
156
|
log?: ConfigLog;
|
|
157
|
+
/**
|
|
158
|
+
* Log the unhandled promise rejections of the whole process with Bot.log.error instead of crashing (default false)
|
|
159
|
+
*/
|
|
160
|
+
catchUnhandledRejections?: boolean;
|
|
158
161
|
};
|
|
159
162
|
type RandomBotActivity = {
|
|
160
163
|
type: ActivityType;
|
|
@@ -167,17 +170,22 @@ declare class Bot {
|
|
|
167
170
|
private static _client;
|
|
168
171
|
private static token;
|
|
169
172
|
private static _config;
|
|
173
|
+
private static _botName;
|
|
170
174
|
private static randomActivityInterval;
|
|
175
|
+
private static unhandledRejectionListening;
|
|
171
176
|
get config(): BotConfig;
|
|
172
177
|
get client(): Client;
|
|
178
|
+
get botName(): string;
|
|
173
179
|
static get client(): Client;
|
|
174
180
|
static get config(): BotConfig;
|
|
181
|
+
static get botName(): string;
|
|
175
182
|
/**
|
|
176
183
|
* Resolves once the login is done (true) or has definitively failed (false)
|
|
177
184
|
*/
|
|
178
185
|
readonly started: Promise<boolean>;
|
|
179
186
|
constructor(client: Client, config?: BotConfig);
|
|
180
187
|
login(maxTries?: number): Promise<boolean>;
|
|
188
|
+
private static formatError;
|
|
181
189
|
static setActivity(message: string, type: ActivityType): void;
|
|
182
190
|
static setRandomActivity(randomActivity: RandomBotActivity, intervalMs?: number | null): void;
|
|
183
191
|
/**
|
|
@@ -262,7 +270,7 @@ declare class WebhookManager {
|
|
|
262
270
|
constructor(client: Client, name: string, avatarPathOrUrl?: string | undefined);
|
|
263
271
|
private getAvatar;
|
|
264
272
|
/**
|
|
265
|
-
*
|
|
273
|
+
* Fetch the targeted channel, which must be able to receive a webhook message
|
|
266
274
|
*/
|
|
267
275
|
private getChannel;
|
|
268
276
|
/**
|
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
|
|
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.
|
|
452
|
+
if (Bot.botName) {
|
|
452
453
|
const footer = {
|
|
453
|
-
text: Bot.
|
|
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 = "
|
|
708
|
+
var version = "5.0.0";
|
|
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,19 +729,27 @@ var Bot = class _Bot {
|
|
|
728
729
|
static _client;
|
|
729
730
|
static token;
|
|
730
731
|
static _config;
|
|
732
|
+
static _botName = "";
|
|
731
733
|
static randomActivityInterval = null;
|
|
734
|
+
static unhandledRejectionListening = false;
|
|
732
735
|
get config() {
|
|
733
736
|
return _Bot._config;
|
|
734
737
|
}
|
|
735
738
|
get client() {
|
|
736
739
|
return _Bot._client;
|
|
737
740
|
}
|
|
741
|
+
get botName() {
|
|
742
|
+
return _Bot._botName;
|
|
743
|
+
}
|
|
738
744
|
static get client() {
|
|
739
745
|
return _Bot._client;
|
|
740
746
|
}
|
|
741
747
|
static get config() {
|
|
742
748
|
return _Bot._config;
|
|
743
749
|
}
|
|
750
|
+
static get botName() {
|
|
751
|
+
return _Bot._botName;
|
|
752
|
+
}
|
|
744
753
|
/**
|
|
745
754
|
* Resolves once the login is done (true) or has definitively failed (false)
|
|
746
755
|
*/
|
|
@@ -753,11 +762,21 @@ var Bot = class _Bot {
|
|
|
753
762
|
_Bot._client = client;
|
|
754
763
|
_Bot._client.once(import_discord7.Events.ClientReady, async () => {
|
|
755
764
|
if (_Bot._client.user) {
|
|
765
|
+
_Bot._botName = _Bot._client.user.displayName;
|
|
756
766
|
await _Bot.log.initDiscordLogging();
|
|
757
767
|
import_utils4.Log.info(`Connected on ${_Bot._client.guilds.cache.size} servers as ${_Bot._client.user.tag}`);
|
|
758
768
|
_Bot.log.info(EmbedManager.description("Bot Started"));
|
|
759
769
|
}
|
|
760
770
|
});
|
|
771
|
+
_Bot._client.on(import_discord7.Events.Error, (error) => {
|
|
772
|
+
_Bot.log.error(`Discord client error : ${_Bot.formatError(error)}`);
|
|
773
|
+
});
|
|
774
|
+
if (config.catchUnhandledRejections && !_Bot.unhandledRejectionListening) {
|
|
775
|
+
_Bot.unhandledRejectionListening = true;
|
|
776
|
+
process.on("unhandledRejection", (reason) => {
|
|
777
|
+
_Bot.log.error(`Unhandled rejection : ${_Bot.formatError(reason)}`);
|
|
778
|
+
});
|
|
779
|
+
}
|
|
761
780
|
this.started = (async () => {
|
|
762
781
|
import_utils4.Log.info(`Using discord.js version: ${import_discord7.version}`);
|
|
763
782
|
import_utils4.Log.info(`Using simplediscordbot version: ${SimpleDiscordBotInfo.version}`);
|
|
@@ -787,6 +806,9 @@ var Bot = class _Bot {
|
|
|
787
806
|
import_utils4.Log.error(`Impossible to connect the bot after ${maxTries} attempts`);
|
|
788
807
|
return false;
|
|
789
808
|
}
|
|
809
|
+
static formatError(error) {
|
|
810
|
+
return error instanceof Error ? error.stack ?? error.message : String(error);
|
|
811
|
+
}
|
|
790
812
|
static setActivity(message, type) {
|
|
791
813
|
if (_Bot._client.user) {
|
|
792
814
|
_Bot._client.user.setActivity({ name: message, type });
|
|
@@ -858,15 +880,15 @@ var WebhookManager = class {
|
|
|
858
880
|
}
|
|
859
881
|
}
|
|
860
882
|
/**
|
|
861
|
-
*
|
|
883
|
+
* Fetch the targeted channel, which must be able to receive a webhook message
|
|
862
884
|
*/
|
|
863
885
|
async getChannel(channelId) {
|
|
864
886
|
const channel = await this.client.channels.fetch(channelId);
|
|
865
887
|
if (!channel) {
|
|
866
888
|
throw new Error(`Channel ${channelId} not found`);
|
|
867
889
|
}
|
|
868
|
-
if (!(channel instanceof import_discord8.
|
|
869
|
-
throw new Error(`Channel ${channelId} is not a
|
|
890
|
+
if (!(channel instanceof import_discord8.BaseGuildTextChannel) && !(channel instanceof import_discord8.BaseGuildVoiceChannel) && !(channel instanceof import_discord8.ThreadChannel)) {
|
|
891
|
+
throw new Error(`Channel ${channelId} is not a text, voice or thread channel`);
|
|
870
892
|
}
|
|
871
893
|
return channel;
|
|
872
894
|
}
|
|
@@ -2098,7 +2120,7 @@ var ModalManager = class {
|
|
|
2098
2120
|
* Simple modal with ONE field - DIRECT ModalBuilder return !
|
|
2099
2121
|
*/
|
|
2100
2122
|
static simple(customId, modalTitle, field) {
|
|
2101
|
-
const modal = this.create(modalTitle ?? Bot.
|
|
2123
|
+
const modal = this.create(modalTitle ?? (Bot.botName || "Bot"), customId);
|
|
2102
2124
|
const opt = {
|
|
2103
2125
|
...field,
|
|
2104
2126
|
customId: field.customId ?? `${customId}_input`,
|
|
@@ -2379,7 +2401,7 @@ var ComponentManager = class {
|
|
|
2379
2401
|
*/
|
|
2380
2402
|
static footer(container) {
|
|
2381
2403
|
return new import_discord20.ContainerBuilder(container.toJSON()).addTextDisplayComponents(
|
|
2382
|
-
new import_discord20.TextDisplayBuilder().setContent(`-# **${Bot.
|
|
2404
|
+
new import_discord20.TextDisplayBuilder().setContent(`-# **${Bot.botName || "Bot"} \xB7 <t:${Math.floor(Date.now() / 1e3)}:d> <t:${Math.floor(Date.now() / 1e3)}:t>**`)
|
|
2383
2405
|
);
|
|
2384
2406
|
}
|
|
2385
2407
|
/**
|
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
|
|
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.
|
|
426
|
+
if (Bot.botName) {
|
|
426
427
|
const footer = {
|
|
427
|
-
text: Bot.
|
|
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 = "
|
|
687
|
+
var version = "5.0.0";
|
|
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,19 +708,27 @@ var Bot = class _Bot {
|
|
|
707
708
|
static _client;
|
|
708
709
|
static token;
|
|
709
710
|
static _config;
|
|
711
|
+
static _botName = "";
|
|
710
712
|
static randomActivityInterval = null;
|
|
713
|
+
static unhandledRejectionListening = false;
|
|
711
714
|
get config() {
|
|
712
715
|
return _Bot._config;
|
|
713
716
|
}
|
|
714
717
|
get client() {
|
|
715
718
|
return _Bot._client;
|
|
716
719
|
}
|
|
720
|
+
get botName() {
|
|
721
|
+
return _Bot._botName;
|
|
722
|
+
}
|
|
717
723
|
static get client() {
|
|
718
724
|
return _Bot._client;
|
|
719
725
|
}
|
|
720
726
|
static get config() {
|
|
721
727
|
return _Bot._config;
|
|
722
728
|
}
|
|
729
|
+
static get botName() {
|
|
730
|
+
return _Bot._botName;
|
|
731
|
+
}
|
|
723
732
|
/**
|
|
724
733
|
* Resolves once the login is done (true) or has definitively failed (false)
|
|
725
734
|
*/
|
|
@@ -732,11 +741,21 @@ var Bot = class _Bot {
|
|
|
732
741
|
_Bot._client = client;
|
|
733
742
|
_Bot._client.once(Events.ClientReady, async () => {
|
|
734
743
|
if (_Bot._client.user) {
|
|
744
|
+
_Bot._botName = _Bot._client.user.displayName;
|
|
735
745
|
await _Bot.log.initDiscordLogging();
|
|
736
746
|
Log3.info(`Connected on ${_Bot._client.guilds.cache.size} servers as ${_Bot._client.user.tag}`);
|
|
737
747
|
_Bot.log.info(EmbedManager.description("Bot Started"));
|
|
738
748
|
}
|
|
739
749
|
});
|
|
750
|
+
_Bot._client.on(Events.Error, (error) => {
|
|
751
|
+
_Bot.log.error(`Discord client error : ${_Bot.formatError(error)}`);
|
|
752
|
+
});
|
|
753
|
+
if (config.catchUnhandledRejections && !_Bot.unhandledRejectionListening) {
|
|
754
|
+
_Bot.unhandledRejectionListening = true;
|
|
755
|
+
process.on("unhandledRejection", (reason) => {
|
|
756
|
+
_Bot.log.error(`Unhandled rejection : ${_Bot.formatError(reason)}`);
|
|
757
|
+
});
|
|
758
|
+
}
|
|
740
759
|
this.started = (async () => {
|
|
741
760
|
Log3.info(`Using discord.js version: ${version2}`);
|
|
742
761
|
Log3.info(`Using simplediscordbot version: ${SimpleDiscordBotInfo.version}`);
|
|
@@ -766,6 +785,9 @@ var Bot = class _Bot {
|
|
|
766
785
|
Log3.error(`Impossible to connect the bot after ${maxTries} attempts`);
|
|
767
786
|
return false;
|
|
768
787
|
}
|
|
788
|
+
static formatError(error) {
|
|
789
|
+
return error instanceof Error ? error.stack ?? error.message : String(error);
|
|
790
|
+
}
|
|
769
791
|
static setActivity(message, type) {
|
|
770
792
|
if (_Bot._client.user) {
|
|
771
793
|
_Bot._client.user.setActivity({ name: message, type });
|
|
@@ -811,7 +833,7 @@ import { CacheManager } from "@spatulox/utils";
|
|
|
811
833
|
// src/manager/messages/WebhookManager.ts
|
|
812
834
|
import {
|
|
813
835
|
BaseGuildTextChannel,
|
|
814
|
-
|
|
836
|
+
BaseGuildVoiceChannel,
|
|
815
837
|
ThreadChannel as ThreadChannel2,
|
|
816
838
|
ThreadOnlyChannel
|
|
817
839
|
} from "discord.js";
|
|
@@ -842,15 +864,15 @@ var WebhookManager = class {
|
|
|
842
864
|
}
|
|
843
865
|
}
|
|
844
866
|
/**
|
|
845
|
-
*
|
|
867
|
+
* Fetch the targeted channel, which must be able to receive a webhook message
|
|
846
868
|
*/
|
|
847
869
|
async getChannel(channelId) {
|
|
848
870
|
const channel = await this.client.channels.fetch(channelId);
|
|
849
871
|
if (!channel) {
|
|
850
872
|
throw new Error(`Channel ${channelId} not found`);
|
|
851
873
|
}
|
|
852
|
-
if (!(channel instanceof
|
|
853
|
-
throw new Error(`Channel ${channelId} is not a
|
|
874
|
+
if (!(channel instanceof BaseGuildTextChannel) && !(channel instanceof BaseGuildVoiceChannel) && !(channel instanceof ThreadChannel2)) {
|
|
875
|
+
throw new Error(`Channel ${channelId} is not a text, voice or thread channel`);
|
|
854
876
|
}
|
|
855
877
|
return channel;
|
|
856
878
|
}
|
|
@@ -1679,16 +1701,16 @@ var StageChannelManager = class extends GuildChannelManager {
|
|
|
1679
1701
|
};
|
|
1680
1702
|
|
|
1681
1703
|
// src/manager/guild/ChannelManager/GuildTextChannelManager.ts
|
|
1682
|
-
import { TextChannel as
|
|
1704
|
+
import { TextChannel as TextChannel3, ChannelType as ChannelType5 } from "discord.js";
|
|
1683
1705
|
import { Log as Log13 } from "@spatulox/utils";
|
|
1684
1706
|
var GuildTextChannelManager = class extends GuildChannelManager {
|
|
1685
1707
|
static async findInGuild(guildId, channelId) {
|
|
1686
1708
|
const channel = await super.findInGuild(guildId, channelId);
|
|
1687
|
-
return channel instanceof
|
|
1709
|
+
return channel instanceof TextChannel3 ? channel : null;
|
|
1688
1710
|
}
|
|
1689
1711
|
static async find(channelId) {
|
|
1690
1712
|
const channel = await super.find(channelId);
|
|
1691
|
-
return channel instanceof
|
|
1713
|
+
return channel instanceof TextChannel3 ? channel : null;
|
|
1692
1714
|
}
|
|
1693
1715
|
static findAll(guildId) {
|
|
1694
1716
|
const guild = Bot.client.guilds.cache.get(guildId);
|
|
@@ -1696,7 +1718,7 @@ var GuildTextChannelManager = class extends GuildChannelManager {
|
|
|
1696
1718
|
Log13.warn(`Guild ${guildId} not found`);
|
|
1697
1719
|
return [];
|
|
1698
1720
|
}
|
|
1699
|
-
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof
|
|
1721
|
+
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof TextChannel3);
|
|
1700
1722
|
}
|
|
1701
1723
|
static async create(guildId, name2, options) {
|
|
1702
1724
|
return await super._create(guildId, {
|
|
@@ -1710,7 +1732,7 @@ var GuildTextChannelManager = class extends GuildChannelManager {
|
|
|
1710
1732
|
// src/manager/guild/ChannelManager/ThreadChannelManager.ts
|
|
1711
1733
|
import {
|
|
1712
1734
|
NewsChannel as NewsChannel2,
|
|
1713
|
-
TextChannel as
|
|
1735
|
+
TextChannel as TextChannel4
|
|
1714
1736
|
} from "discord.js";
|
|
1715
1737
|
var ThreadChannelManager = class {
|
|
1716
1738
|
static async findInGuild(guildId, channelId) {
|
|
@@ -1727,7 +1749,7 @@ var ThreadChannelManager = class {
|
|
|
1727
1749
|
}
|
|
1728
1750
|
static async createFromChannel(parentId, options) {
|
|
1729
1751
|
const channel = await GuildChannelManager.find(parentId);
|
|
1730
|
-
if (!(channel instanceof
|
|
1752
|
+
if (!(channel instanceof TextChannel4) && !(channel instanceof NewsChannel2)) {
|
|
1731
1753
|
throw new Error("Parent must be a text or announcement channel");
|
|
1732
1754
|
}
|
|
1733
1755
|
const thread = await channel.threads.create(options);
|
|
@@ -2092,7 +2114,7 @@ var ModalManager = class {
|
|
|
2092
2114
|
* Simple modal with ONE field - DIRECT ModalBuilder return !
|
|
2093
2115
|
*/
|
|
2094
2116
|
static simple(customId, modalTitle, field) {
|
|
2095
|
-
const modal = this.create(modalTitle ?? Bot.
|
|
2117
|
+
const modal = this.create(modalTitle ?? (Bot.botName || "Bot"), customId);
|
|
2096
2118
|
const opt = {
|
|
2097
2119
|
...field,
|
|
2098
2120
|
customId: field.customId ?? `${customId}_input`,
|
|
@@ -2386,7 +2408,7 @@ var ComponentManager = class {
|
|
|
2386
2408
|
*/
|
|
2387
2409
|
static footer(container) {
|
|
2388
2410
|
return new ContainerBuilder2(container.toJSON()).addTextDisplayComponents(
|
|
2389
|
-
new TextDisplayBuilder2().setContent(`-# **${Bot.
|
|
2411
|
+
new TextDisplayBuilder2().setContent(`-# **${Bot.botName || "Bot"} \xB7 <t:${Math.floor(Date.now() / 1e3)}:d> <t:${Math.floor(Date.now() / 1e3)}:t>**`)
|
|
2390
2412
|
);
|
|
2391
2413
|
}
|
|
2392
2414
|
/**
|