Compare commits

..

5 commits

Author SHA1 Message Date
Christopher Cookman 66cf8e8de9 Disable that for now...
Some checks failed
ptero-push / build (push) Has been cancelled
2026-06-12 12:43:42 -06:00
Christopher Cookman 122a049e88 GUH
Some checks are pending
ptero-push / build (push) Waiting to run
2026-06-12 12:40:04 -06:00
Christopher Cookman 36d5931a07 Add harsher retry timers
Some checks are pending
ptero-push / build (push) Waiting to run
2026-06-12 12:37:27 -06:00
Christopher Cookman 40c48cb61a Add logs for good sends
Some checks are pending
ptero-push / build (push) Waiting to run
2026-06-12 12:17:36 -06:00
Christopher Cookman f865daaf3b fix/retry-sending-failed-msgs (#1)
Some checks are pending
ptero-push / build (push) Waiting to run
Reviewed-on: #1
Co-authored-by: ChrisChrome <chris@chrischro.me>
Co-committed-by: ChrisChrome <chris@chrischro.me>
2026-06-12 10:01:24 -06:00

View file

@ -458,15 +458,15 @@ Example data object:
}, 10 * 60 * 1000);
let errCount = 0;
function sendMessage() {
channel.send(thisMsg).catch((err) => {
channel.send(thisMsg).then((msg) => {
// Message sent successfully. Note in the logs
console.log(`${colors.cyan("[INFO]")} Sent message to ${channel.guild.name}/${channel.name} (${channel.guild.id}/${channel.id}). ${errCount}/3`);
}).catch((err) => {
console.error(err);
}).then((msg) => {
if (msg.channel.type === Discord.ChannelType.GuildAnnouncement) msg.crosspost();
}).catch(() => {
console.log(`${colors.yellow("[WARN]")} Failed to send message to ${channel.guild.name}/${channel.name} (${channel.guild.id}/${channel.id})`);
if (errCount < 3) {
errCount++;
setTimeout(sendMessage, 5000); // Retry after 5 seconds
setTimeout(sendMessage, 5000 * errCount); // Retry after 5 seconds
} else {
const logChannel = discord.guilds.cache.get(config.discord.mainGuild).channels.cache.get(config.discord.logChannel);
logChannel.send({
@ -481,7 +481,9 @@ Example data object:
]
});
}
});
}).then((msg) => {
// if (msg.channel.type === Discord.ChannelType.GuildAnnouncement) msg.crosspost();
})
}
sendMessage()
});
@ -534,11 +536,15 @@ Example data object:
let errCount = 0;
function sendMessage() {
user.send(thisMsg).catch((err) => {
user.send(thisMsg).then((msg) => {
// Message sent successfully. Note in the logs
console.log(`${colors.cyan("[INFO]")} Sent message to ${user.tag} (${user.id}). ${errCount}/3`);
}).catch((err) => {
console.log(err)
console.log(`${colors.yellow("[WARN]")} Failed to send message to ${user.tag} (${user.id})`);
if (errCount < 3) {
errCount++;
setTimeout(sendMessage, 5000); // Retry after 5 seconds
setTimeout(sendMessage, 5000 * errCount); // Retry after 5 seconds
} else {
const logChannel = discord.guilds.cache.get(config.discord.mainGuild).channels.cache.get(config.discord.logChannel);
logChannel.send({