wwwg / kahoot.js

A library for interacting with Kahoot API.
MIT License
28 stars 8 forks source link

Issue while looping #8

Open rectof opened 6 years ago

rectof commented 6 years ago

read below, solved this.

rectof commented 6 years ago

nvm im autistic.

I have another issue though, when I try looping the join function, I get this error, I've tried just about everything and cant figure it out. Sorry if this is a hassle lol

events.js:187       throw err;       ^  

Error: Unhandled "error" event. (USER_INPUT)     at WSHandler.emit (events.js:185:19)     at WSHandler.message (C:\Users\Recto\Desktop\discordBots\kahoot\node_modules\kahoot.js\src\WSHandler.js:241:8)     at WebSocket.WSHandler.ws.on.msg (C:\Users\Recto\Desktop\discordBots\kahoot\node_modules\kahoot.js\src\WSHandler.js:26:7)     at emitOne (events.js:115:13)     at WebSocket.emit (events.js:210:7)     at Receiver._receiver.onmessage (C:\Users\Recto\Desktop\discordBots\kahoot\node_modules\ws\lib\WebSocket.js:143:47)     at Receiver.dataMessage (C:\Users\Recto\Desktop\discordBots\kahoot\node_modules\ws\lib\Receiver.js:389:14)     at Receiver.getData (C:\Users\Recto\Desktop\discordBots\kahoot\node_modules\ws\lib\Receiver.js:330:12)     at Receiver.startLoop (C:\Users\Recto\Desktop\discordBots\kahoot\node_modules\ws\lib\Receiver.js:165:16)     at Receiver.add (C:\Users\Recto\Desktop\discordBots\kahoot\node_modules\ws\lib\Receiver.js:139:10)

dustinrouillard commented 6 years ago

I can help you with this issue right now, this is because the name is the same as another connected user. Use an auto incrementing number.

count = 0;

setInterval(() => {
  count++;
  let name = `Bot-${count}`;
})
dustinrouillard commented 6 years ago

How are you looping through this, also for anyone wondering what the first error was about.

That would be the kahoot room was no longer accessible. I'm gonna make a pull request or maybe even my own module to fix the issues I've found with this.

Ekstropiya commented 5 years ago

I am having the same problem with looping, I have tried multiple ways of making the names different every loop. It just dosen't work. I can't even join twice with totally different names like this:

client.join(00000, "Lorem") client.join(00000, "Ipsum")

And it still dosen't work. I would really appreciate it if you helped me with this.