anonradio: use timeout instead of interval

This commit is contained in:
Cynthia Foxwell 2022-12-21 08:58:57 -07:00
parent a430d0d1ed
commit 4fe3512b2b
1 changed files with 10 additions and 3 deletions

View File

@ -4,6 +4,10 @@ const GUILD_ID = "300436792916836352";
const THREAD_ID = "1054106209273253888";
const MESSAGE_ID = "1054109813132509245";
if (hf.__anonradio_timeout) {
clearTimeout(hf.__anonradio_timeout);
}
async function updateNowPlaying() {
let playing;
try {
@ -105,9 +109,12 @@ async function updateNowPlaying() {
await thread.editMessage(MESSAGE_ID, {content});
}
}
}
hf.timer.add(
hf.__anonradio_timeout = setTimeout(updateNowPlaying, 2000);
}
updateNowPlaying();
/*hf.timer.add(
"anonradio",
async () => {
await new Promise((resolve, reject) => {
@ -116,4 +123,4 @@ hf.timer.add(
}).catch(() => {});
},
2000
);
);*/