starwolfy/steam-ts

Teamspeak v3.7.0 - { id: 513, msg: 'nickname is already in use' }

Opened this issue · 6 comments

Nickname error

I've just updated my Teamspeak 3 to version 3.7.0
I can no longer get Steam-TS to start. Each time I get the following error:

{ id: 513, msg: 'nickname is already in use' }

I'm currently having to rename the bot in the launchteamspeak.js file each time, i.e: Steam-Bot1, Steam-Bot2.

This works, but only as long as the bot does not crash. As as soon as it does, and PM2 restarts it, it gets the above error that the bot's nickname is already in use.

Unfortunately, the Steam-TS bot crashes quite a lot, hence why I launch it via PM2. The cause of the crashing appears to be:

Random Crashes

Seeing the same error as above, even after the fix #9b3a358

Error: Callback was already called.
    at /home/ts3bot/steam-ts/node_modules/async/dist/async.js:837:34
    at Object.cb (/home/ts3bot/steam-ts/lib/queryusers.js:49:29)
    at LineInputStream.<anonymous> (/home/ts3bot/steam-ts/node_modules/node-teamspeak/index.js:170:35)
    at LineInputStream.emit (events.js:182:13)
    at LineInputStream.line (/home/ts3bot/steam-ts/node_modules/line-input-stream/lib/line-input-stream.js:8:8)
    at Array.forEach (<anonymous>)
    at Socket.<anonymous> (/home/ts3bot/steam-ts/node_modules/line-input-stream/lib/line-input-stream.js:36:9)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)

PM2 lists this error 7 times, and also shows it's restarted the steam-ts bot 7 times, so concluding that this error is causing it to crash.

I noticed you've made some updates recently so I reinstalled the bot with the latest version.

Unfortunately I'm noticing the same error as above.

Launch the bot once: npm start and then stop the bot, then try restart it and I get:

{ id: 513, msg: 'nickname is already in use' }

Even though no user has that nickname.

For now I've solved this by the following "hack" change to launchteamspeak.js :

function (teamspeakClient, callback) {
            console.log("Using virtual server " + config.q_vserverid + " now.");
            var rnum = Math.floor(Math.random() * Math.floor(1000));
            teamspeakClient.send("clientupdate", {client_nickname: "FGN-Steambot"+rnum}, function (err) {
                if (typeof err !== "undefined") {
                    callback(err);
                } else {
                    console.log("Changed query client name.");
                    callback(null, teamspeakClient);
                }
            })
        }

This avoids the error by effectively giving the bot a unique nickname every-time it connects. But it's a rather inelegant solution, and I'm not exactly sure why its required in the first place.

Interestingly I'm not noticing this issue on another bot, one I've personally created. However, in that case it's using a different Teamspeak 3 NodeJS library (TS3-NodeJS-Library), from the one used in this project (node-teamspeak)

yes broken with latest ts server version

@Bealze I've fixed this in a more elegant way than my above "hack random name" code.

You can find the code changes I've made here: 3e900e7

@Bealze I suggest downloading Forge-Media's whole fork. I just tested it out and it's working fine without any errors! https://github.com/Forge-Media/steam-ts