Node TeamSpeak Api
node-teamspeak-api is a library which allows you to connect to any TeamSpeak 3 server using ServerQuery-API.
The ServerQuery-specification is available here.
Install
npm install node-teamspeak-api
Usage
var TeamSpeak = ; // Default IP: 'localhost'// Default port: 10011 var tsClient = 'localhot' 10011;
//Adding optionsvar options = 'away' 'times'; // or for only one options = 'away' tsClient; //Adding paramsvar params = client_login_name: "server_admin" client_login_password: "server_password"; tsClient; //Using bothvar options = 'count' params = limit: 3 ; tsClient;
//Callback datatsClient;
//Error status: 'error' message: 'Error Message' error_id: 12
// Response status: 'ok' data: {} // some data raw: "raw resp"
// Request cmd: 'clientlist' options: 'away' params: {} raw: 'clientlist -away'
API usage
Using ServerQuery commands
// List client on server tsClientapi;
Using ServerQuery commands via send function
tsClient;
Using event listener rather than a callback
tsClient; tsClientapi;
Subscribe/Unsubscribe to events
//Subscribe to alltsClient; //Subscribe to a specific eventtsClient; tsClientapi;
//Unsubscribe to alltsClient;
Extra functions
//Connect/Reconnect to servertsClient;
//Disconnect from servertsClient;
//Get pending commandvar prending = tsClient;
//CLear queuetsClient;
Infos
Every TeamSpeak client is an event emitter. You can subscribe to some of the socket event (connect
, close
, error
)