Teamspeak Server Query
A simple and lightweight server query for a teamspeak 3 server
const serverquery = const ts3 = ts3
Installing
Installation is done using the npm install command:
$ npm install teamspeak-server-query
How it works
All available query commands can be called as a method. The paramters are represented as an object.
ts3 // => "servergroupadd name=Super\sBros"
The methods always return the first response from the server query as an array.
let response = await ts3 console // [ { sgid: '20' } ]
let response = await ts3 console // [ { error: null, id: '0', msg: 'ok' } ]
If the query returns an error, the response contains the error. Simple as that.
await ts3let response = await ts3 console // [ { error: null, id: '1282', msg: 'database duplicate entry' } ]
Event Listeners
Name | Description |
---|---|
'close' | Emitted when the connection to server gets closed. |
'notify' | Emitted when a server notification is send by the server. |
Examples
Using Async Await
const serverquery = const ts3 = let params = host: '127.0.0.1' port: 10011 let queryStuff = async { try await ts3 await ts3 await ts3 let clients = await ts3 console await ts3 catcherr console }
Listen on server notifications
ts3 await ts3
Quit the Connection
... as you would do it in the telnet session.
ts3
Built With
- my hands
- net.Socket
Authors
- Jonathan Francke