Multivit4min / TS3-NodeJS-Library

TeamSpeak 3 Server Query Library supports SSH and RAW Query
https://multivit4min.github.io/TS3-NodeJS-Library/
MIT License
150 stars 19 forks source link

TypeError: TeamSpeak3 is not a constructor #87

Closed jonetiz closed 5 years ago

jonetiz commented 5 years ago

Hello, this is the code which I am using.

const TeamSpeak3 = require("ts3-nodejs-library");

const ts3 = new TeamSpeak3({
    host: "127.0.0.1",
    queryport: 10011,
    serverport: 9987,
    username: "serveradmin",
    password: "",
    nickname: "",
    keepalive: true
})
ts3.on("ready", async () => {
    Promise.all([
        ts3.registerEvent("server"),
        ts3.registerEvent("channel", 0),
        ts3.registerEvent("textserver"),
        ts3.registerEvent("textchannel"),
        ts3.registerEvent("textprivate")
    ]).then(() => {
        tpass = Math.random().toString(36).substring(3, 10);
        ts3.ServerTempPasswordAdd({ duration: 1200, pw: tpass, tcid: 50, tcpw: "onlyplebsinhere" }).then(res => {
            console.log(`New temporary password generated: ` + tpass);
        }).catch(e => {
            console.log(`ERROR GENERATING PASSWORD`);
        });
    }).catch(e => {
        console.log(`CONNECTION ERROR`);
    })
})

Yet whenever it is executed, I get an error saying TypeError: TeamSpeak3 is not a constructor

Multivit4min commented 5 years ago

Please check the example on how to create a connection, since version 2.x the TeamSpeak object does not get exported directly anymore