try..catch the channels
This commit is contained in:
@@ -41,36 +41,39 @@ export async function sendDiscordMessage(
|
||||
)}`
|
||||
);
|
||||
}
|
||||
|
||||
const promises = client.channels.cache.map(async (channel) => {
|
||||
try {
|
||||
if (channel.type !== "text") return null;
|
||||
const embeddedMessage = new MessageEmbed().setTitle(title).setImage(img);
|
||||
const msg = await (channel as TextChannel).send(embeddedMessage);
|
||||
const reactions = [
|
||||
"1️⃣",
|
||||
"2️⃣",
|
||||
"3️⃣",
|
||||
"4️⃣",
|
||||
"5️⃣",
|
||||
"6️⃣",
|
||||
"7️⃣",
|
||||
"8️⃣",
|
||||
"9️⃣",
|
||||
"🔟",
|
||||
];
|
||||
for (const reaction of reactions) {
|
||||
try {
|
||||
await msg.react(reaction);
|
||||
} catch {
|
||||
console.error(`Reaction ${reaction} to channel ${channel.id} failed.`);
|
||||
try {
|
||||
const promises = client.channels.cache.map(async (channel) => {
|
||||
try {
|
||||
if (channel.type !== "text") return null;
|
||||
const embeddedMessage = new MessageEmbed().setTitle(title).setImage(img);
|
||||
const msg = await (channel as TextChannel).send(embeddedMessage);
|
||||
const reactions = [
|
||||
"1️⃣",
|
||||
"2️⃣",
|
||||
"3️⃣",
|
||||
"4️⃣",
|
||||
"5️⃣",
|
||||
"6️⃣",
|
||||
"7️⃣",
|
||||
"8️⃣",
|
||||
"9️⃣",
|
||||
"🔟",
|
||||
];
|
||||
for (const reaction of reactions) {
|
||||
try {
|
||||
await msg.react(reaction);
|
||||
} catch {
|
||||
console.error(`Reaction ${reaction} to channel ${channel.id} failed.`);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(`Message to channel ${channel.id} failed.`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(`Message to channel ${channel.id} failed.`);
|
||||
}
|
||||
});
|
||||
await Promise.all(promises);
|
||||
});
|
||||
await Promise.all(promises);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user