Review TS3-NodeJS-Library

BIOS

Knowledge Seeker
VIP
Oct 10, 2015
447
848
208
First its not Mine i found this on Github!

TS3-NodeJS-Library
The TS3 NodeJS Library has been strongly influenced by PlanetTeamSpeaks TS3 PHP Framework

download: https://github.com/Multivit4min/TS3-NodeJS-Library

Install
npm install ts3-nodejs-library


TODO
  • File upload
  • Channel Browser Access
Documentation
You can find all necessary documentation on the GitHub Wiki Page!


Example
Send a message to all non Query Clients connected:
Code:
const TeamSpeak3 = require("ts3-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))
 
E

ewenjo

Thank you for sharing, currently making a nodejs bot working with TeamSpeak. :)
 

cRaZy92

New Member
Feb 1, 2019
4
1
8
Hey,
I was playing little bit with this library and I can't get it to fire textmessage event for some reason, can someone provide example code with more than just ready event?
 

kalle

high minded
Contributor
Oct 28, 2015
411
253
178
Hey,
I was playing little bit with this library and I can't get it to fire textmessage event for some reason, can someone provide example code with more than just ready event?
Posting your code and errors would be nice, maybe we could help.
If you look into this example you will see how it works with subscribe.
 

cRaZy92

New Member
Feb 1, 2019
4
1
8
Hello,
I am again here :D I want the bot to be able to respond to text messages in all available channels on a server but not server channel.
I tried provided example from the library but the event fires only when there is new text message in server chat.
Can someone show me some example, please? :/
 

kalle

high minded
Contributor
Oct 28, 2015
411
253
178
Hello,
I am again here :D I want the bot to be able to respond to text messages in all available channels on a server but not server channel.
I tried provided example from the library but the event fires only when there is new text message in server chat.
Can someone show me some example, please? :/
That is not possible in TS. In TS3 you have two possible ways to catch a message. In channel chat or server global chat. To catch message in every channel you have to be in that channel, so that is not possible to do with one query connection.
 

cRaZy92

New Member
Feb 1, 2019
4
1
8
That is not possible in TS. In TS3 you have two possible ways to catch a message. In channel chat or server global chat. To catch message in every channel you have to be in that channel, so that is not possible to do with one query connection.
Ohhh, maybe that's reason why no one made something like this... Is there any way to bypass that? Or how to set the channel the bot will listen?

I hope TS5 have api like discord have... :/ it's so easy with discord :(
 
Top