Fix incorrectly-implemented ping-pong

This commit is contained in:
bingus_violet 2024-03-18 21:22:32 -05:00
parent 1efd9dc2a7
commit 6b1e1ea7ad

View file

@ -215,10 +215,13 @@ function socketeer() {
lanyard.addEventListener("message", async (res) => { lanyard.addEventListener("message", async (res) => {
var data = JSON.parse(res.data) var data = JSON.parse(res.data)
// console.log(data.op)
if (data.op == 1) { if (data.op == 1) {
console.log("Connected to Discord Websocket!") console.log("Connected to Discord Websocket!")
ping(30000) ping(30000)
lastPong = Date.now() lastPong = Date.now()
} else if (data.op == 3) {
lastPong = Date.now()
} else if (data.op == 0) { } else if (data.op == 0) {
lanyardData = data.d lanyardData = data.d
lastLanyardUpdate = Date.now() lastLanyardUpdate = Date.now()