@@ 313,3 313,55 @@ async function start_match() {
}
}
}
+
+async function move_clients() {
+ const query = gql`
+ query {
+ getTeams {
+ team1 {
+ teamspeakID
+ }
+ team2 {
+ teamspeakID
+ }
+ }
+ }
+ `;
+
+ try {
+ const data = await request(query);
+
+ const team1 = data.getTeams.team1;
+ const channel1 = await teamspeak.channelFind("Team 1");
+ for (let i of team1) {
+ const client = await teamspeak
+ .getClientByUid(i.teamspeakID)
+ .then((client) => {
+ teamspeak.clientMove(client!.clid, channel1[0].cid);
+ })
+ .catch(function (e) {
+ console.error(e);
+ });
+ }
+
+ const team2 = data.getTeams.team2;
+ const channel2 = await teamspeak.channelFind("Team 2");
+ for (let i of team2) {
+ const client = await teamspeak
+ .getClientByUid(i.teamspeakID)
+ .then((client) => {
+ teamspeak.clientMove(client!.clid, channel2[0].cid);
+ })
+ .catch(function (e) {
+ console.error(e);
+ });
+ }
+ } catch (e) {
+ const error = get_error(e);
+ switch (error) {
+ default:
+ console.error(error);
+ break;
+ }
+ }
+}