diff --git a/src/modules/anonradio.js b/src/modules/anonradio.js index bcbad60..fc0673a 100644 --- a/src/modules/anonradio.js +++ b/src/modules/anonradio.js @@ -99,10 +99,21 @@ async function updateNowPlaying() { const content = `${title}\n${subtitle}\n${openmicTime}`.trim(); const thread = hf.bot.guilds.get(GUILD_ID).threads.get(THREAD_ID); - const msg = await thread.getMessage(MESSAGE_ID); - if (msg.content !== content) { - thread.editMessage(MESSAGE_ID, {content}); + if (thread) { + const msg = await thread.getMessage(MESSAGE_ID); + if (msg.content !== content) { + await thread.editMessage(MESSAGE_ID, {content}); + } } } -hf.timer.add("anonradio", updateNowPlaying, 2000); +hf.timer.add( + "anonradio", + async () => { + await new Promise((resolve, reject) => { + setTimeout(() => reject("timeout"), 1900); + updateNowPlaying().then(() => resolve(true)); + }).catch(() => {}); + }, + 2000 +);