From 5673204105e7c18e8dc6f85a7345435ebc828c13 Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 11 Jan 2019 10:51:23 +0100 Subject: [PATCH] viewer v1.0 --- js/viewer.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 js/viewer.js diff --git a/js/viewer.js b/js/viewer.js new file mode 100644 index 0000000..a49582a --- /dev/null +++ b/js/viewer.js @@ -0,0 +1,29 @@ +const TeamSpeak3 = require("ts3-nodejs-library") + +var ts3conn = new TeamSpeak3({ + host: "localhost", + queryport: 10011, + serverport: 9987, + username: "serveradmin", + password: "R0cHL6tb", + nickname: "NodeJS Query Framework", +}) + + ts3conn.on("ready", () => { + ts3conn.clientList({client_type:0}).then(clients => { + clients.forEach(client => { + console.log("Online: ", client.getCache().client_nickname) + }) + }).catch(e => console.log("CATCHED", e.message)) + + ts3conn.channelList({}).then(channel => { + channel.forEach(channel => { + console.log("Channel: ", channel.getCache().channel_name) + }) + }).catch(e => console.log("CATCHED", e.message)) + }) + + + + ts3conn.on("error", e => console.log("Error", e.message)) + ts3conn.on("close", e => console.log("Connection has been closed!", e))