Skip to content

Commit

Permalink
fixed bug with missing serverGroupsById in dataUpdate function
Browse files Browse the repository at this point in the history
  • Loading branch information
harryxu2626 committed Feb 11, 2025
1 parent 1068025 commit b24d256
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ const positionUpdate = async () => {

const position = data.onlinePosition;

dataUpdate(data);

const serverGroupsById = await teamspeak.serverGroupsByClientId(clientDbid.cldbid);

dataUpdate(data, serverGroupsById);


if (position) {
if (serverGroupsById.some((item)=> item.name===position)){
return;
Expand Down Expand Up @@ -120,7 +121,7 @@ const removePosition = async (client) => {
}
}

const dataUpdate = async (data) => {
const dataUpdate = async (data, serverGroupsById) => {
const controllerStatus = data.controllerStatus === "HOME" ? 1 : 0;
const rating = data.rating;

Expand Down Expand Up @@ -240,7 +241,7 @@ teamspeak.on("clientconnect", async (connected) => {
return;
}

dataUpdate(data);
dataUpdate(data, serverGroupsById);
})

teamspeak.on("clientdisconnect", async (connected) => {
Expand Down

0 comments on commit b24d256

Please sign in to comment.