teaspeak-nodejs-library
v1.9.2
Published
TeaSpeak3 Server Query API
Downloads
7
Maintainers
Readme
TeaSpeak-NodeJS-Library
The TeaSpeak NodeJS Library has been strongly influenced by PlanetTeamSpeaks TS3 PHP Framework
Install
npm install teaspeak-nodejs-library
Documentation
You can find all necessary documentation on the GitHub Wiki Page
Example
Send a message to all non Query Clients connected:
const TeamSpeak3 = require("teaspeak-nodejs-library")
//Create a new Connection
var ts3 = new TeamSpeak3({
host: "localhost",
queryport: 10011,
serverport: 9987,
username: "serveradmin",
password: "",
nickname: "NodeJS Query Framework"
})
/*
Ready gets fired when the Bot has connected to the TeamSpeak Query and
issued login commands (if username and password has been given)
selected the appropriate Server (also if given in the config)
and set the nickname
*/
ts3.on("ready", () => {
//Retrieves a List of non Query Clients
ts3.clientList({client_type:0}).then(clients => {
clients.forEach(client => {
console.log("Sending Message to", client.getCache().client_nickname)
//Sends to every Client a "Hello"
client.message("Hello!")
})
}).catch(e => console.log("CATCHED", e.message))
})
ts3.on("error", e => console.log("Error", e.message))
ts3.on("close", e => console.log("Connection has been closed!", e))