From 955ca1c739ff6ec8e52df7d4948171a0b883ed87 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Sun, 26 Mar 2023 15:32:56 -0600 Subject: [PATCH] anonradio: try/catch --- src/modules/anonradio.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/modules/anonradio.js b/src/modules/anonradio.js index 90fd5d0..b280342 100644 --- a/src/modules/anonradio.js +++ b/src/modules/anonradio.js @@ -116,12 +116,16 @@ async function updateNowPlaying() { const content = `${title}\n${subtitle}\n${openmicTime}`.trim(); const thread = hf.bot.guilds.get(GUILD_ID)?.threads.get(THREAD_ID); if (thread) { - const msg = await thread.getMessage(MESSAGE_ID); - const oldContent = msg.content.replace(/\n/, "").trim(); - if (oldContent !== content) { - await thread.editMessage(MESSAGE_ID, { - content: timestamp + "\n" + content, - }); + try { + const msg = await thread.getMessage(MESSAGE_ID); + const oldContent = msg.content.replace(/\n/, "").trim(); + if (oldContent !== content) { + await thread.editMessage(MESSAGE_ID, { + content: timestamp + "\n" + content, + }); + } + } catch (err) { + // } }