try..catch the channels

This commit is contained in:
Fran Jurmanović
2025-08-13 19:48:49 +02:00
parent 985ccf3e8a
commit ab17126b76
2 changed files with 32 additions and 29 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "legica-dana",
"version": "2.1.1",
"version": "2.1.2",
"main": "src/app.ts",
"scripts": {
"start": "bun run src/app.ts",

View File

@@ -41,7 +41,7 @@ export async function sendDiscordMessage(
)}`
);
}
try {
const promises = client.channels.cache.map(async (channel) => {
try {
if (channel.type !== "text") return null;
@@ -71,6 +71,9 @@ export async function sendDiscordMessage(
}
});
await Promise.all(promises);
} catch (err) {
console.error(err);
}
}
/**