From 99c89bd7e793c15f2dc7c876c0b7adb9c2e78a55 Mon Sep 17 00:00:00 2001 From: Cynthia Date: Wed, 21 Dec 2022 09:07:19 -0700 Subject: [PATCH] anonradio: fix edit spam from timestamp --- src/modules/anonradio.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/anonradio.js b/src/modules/anonradio.js index 2669798..987fa0e 100644 --- a/src/modules/anonradio.js +++ b/src/modules/anonradio.js @@ -104,12 +104,13 @@ async function updateNowPlaying() { const now = Date.now(); const timestamp = ``; - const content = `${timestamp}\n${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); if (thread) { const msg = await thread.getMessage(MESSAGE_ID); - if (msg.content !== content) { - await thread.editMessage(MESSAGE_ID, {content}); + const oldContent = msg.content.replace(/\n/,""); + if (oldContent !== content) { + await thread.editMessage(MESSAGE_ID, {content: timestamp + "\n" + content}); } }