teamspeak3-client
TeamSpeak3 ServerQuery Client
Installation
$ npm install teamspeak3-client --save
Connect to the server
let TS3Client = ; // Wait for the connection eventTS3Client; TS3Client;
Querying the server
Each time the queries provide 3 objects to your callback :
err
An object wich contains the errorid
andmsg
from the serverrows
An array of objects, each offset is a row[{row 1},{row 2},...]
query
An object wich contains all informations about the query
Anti Flood
The client is provided with an anti-flood feature, when the client connect to the serverinstance it get the instanceinfo
.
If these informations are not available the client use the default values. You can enforce theses values, ask your hoster about the flood rate limit if you are banned with the default values.
// force the client to send 10 queries max each 3 secondsts3client;
The whitelist
If your client is whitelisted on the serverinstance you can allow the client to perform each request ASAP by
setting the third argument to true
// Connect to the serverTS3Client
Important: If you enable this feature while you are not whitelisted the client will be banned.
Debug your queries
During the development you can listen the verbose
event. This event provide a prefix and the log entry. The prefix is the component of the client wich emit the log
TS3Client
Build and send your query
You can build and escape your queries easily. If you want send the query in priority you can use queryNow
.
TS3Client
Send query
If you need you can send raw queries, they are not escaped. If you want send the query in priority you can use sendNow
.
let newName = TS3Clientutils; TS3Client
Prepared queries
For more efficience you can set a lots of prepared querie, this is a good way to reuse the same queries in many places with differents values.
If you want execute the query in priority you can use executeNow
.
Note: You must respect the arguments list order used in your query
// Prepare the queriesTS3Client;TS3Client; // Execute the query, the values are escaped using teamspeak3-utilsTS3Client; TS3Client;
Listen server events
This client provide an simple way to listen the server events, the full event list is available in your server documentation.
Note: You have to register the event with the method .notifyRegister(eventName)
and remove notify
from the event name to catch them
// Listen for clients enter in query client viewTS3Client; // Subscribe to the server eventsTS3Client; // Unsubscribe from all eventsTS3Client;
Use teamspeak3-utils
teamspeak3-utils is embedded to the client, this approach allow you to use it easily.
let TS3Client = TS3Clientutils // Hello\sWorld!