anonradio: fix edit spam from timestamp
This commit is contained in:
parent
78b617f020
commit
99c89bd7e7
1 changed files with 4 additions and 3 deletions
|
@ -104,12 +104,13 @@ async function updateNowPlaying() {
|
|||
const now = Date.now();
|
||||
const timestamp = `<t:${Math.floor(now/1000)}:T>`;
|
||||
|
||||
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(/<t:\d+:T>\n/,"");
|
||||
if (oldContent !== content) {
|
||||
await thread.editMessage(MESSAGE_ID, {content: timestamp + "\n" + content});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue