If we already sent this song to discord skip updating
This commit is contained in:
parent
39a8822ed0
commit
7f83c0f97b
9
main.js
9
main.js
|
@ -14,6 +14,7 @@ const extendedReconnectDelay = 90000;
|
|||
let rp;
|
||||
let startTime = Date.now();
|
||||
let reconnecting = false;
|
||||
let lastTrack = null;
|
||||
|
||||
function formatNumber(number) {
|
||||
var x = number.split(".");
|
||||
|
@ -92,6 +93,14 @@ async function updateStatus() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (lastTrack && lastTrack.trackName === data.trackName && lastTrack.artist === data.artist) {
|
||||
console.log("Same track, skipping update.");
|
||||
setTimeout(updateStatus, updateInterval);
|
||||
return;
|
||||
}
|
||||
|
||||
lastTrack = data;
|
||||
|
||||
await rp.setActivity({
|
||||
largeImageKey: data.cover !== "default_cover" ? data.cover : "default_cover",
|
||||
largeImageText: `${data.playcount} plays.`,
|
||||
|
|
Loading…
Reference in New Issue