teamspeak-query
Version:
Teamspeak-ServerQuery library
40 lines (29 loc) • 787 B
JavaScript
const Base = require('./base');
const SshClient = require('ssh2').Client;
class SshTeamspeakQuery extends Base {
constructor(options) {
super();
let client = new SshClient(),
connectOptions = Object.assign({
host: '127.0.0.1',
port: 10022
}, options);
this.client = client;
this.host = connectOptions.host;
this.port = connectOptions.port;
client.on('ready', () => {
client.shell(false, (err, stream) => {
if(err)
super.emit('error', err);
else
super.streamSetup(stream, stream);
});
});
client.connect(connectOptions);
}
disconnect() {
return super.disconnect().then(() => this.client.end());
}
}
module.exports = SshTeamspeakQuery;
;