anonradio: attempt to reduce gradual edit spam
This commit is contained in:
parent
f77466831b
commit
0f3e029430
1 changed files with 15 additions and 4 deletions
|
@ -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);
|
||||
if (thread) {
|
||||
const msg = await thread.getMessage(MESSAGE_ID);
|
||||
if (msg.content !== content) {
|
||||
thread.editMessage(MESSAGE_ID, {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
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue