anonradio: try/catch

This commit is contained in:
Cynthia Foxwell 2023-03-26 15:32:56 -06:00
parent 543192bb28
commit 955ca1c739

View file

@ -116,12 +116,16 @@ async function updateNowPlaying() {
const content = `${title}\n${subtitle}\n${openmicTime}`.trim(); const content = `${title}\n${subtitle}\n${openmicTime}`.trim();
const thread = hf.bot.guilds.get(GUILD_ID)?.threads.get(THREAD_ID); const thread = hf.bot.guilds.get(GUILD_ID)?.threads.get(THREAD_ID);
if (thread) { if (thread) {
const msg = await thread.getMessage(MESSAGE_ID); try {
const oldContent = msg.content.replace(/<t:\d+:T>\n/, "").trim(); const msg = await thread.getMessage(MESSAGE_ID);
if (oldContent !== content) { const oldContent = msg.content.replace(/<t:\d+:T>\n/, "").trim();
await thread.editMessage(MESSAGE_ID, { if (oldContent !== content) {
content: timestamp + "\n" + content, await thread.editMessage(MESSAGE_ID, {
}); content: timestamp + "\n" + content,
});
}
} catch (err) {
//
} }
} }