forked from mixedfruitjuice/Kahoot-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
20 lines (19 loc) · 657 Bytes
/
index.js
File metadata and controls
20 lines (19 loc) · 657 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var Kahoot = require('kahoot.js');
var client = new Kahoot;
var NameGenerator = require('nodejs-randomnames');
var randomName = NameGenerator.getRandomName();
var game_pin = 6039738;
var randomnumber = Math.round(Math.random() * 3);
console.log("Joining kahoot... ");
client.join(game_pin, randomName);
client.on("joined", () => {
console.log("I joined the Kahoot!");
});
client.on("questionStart", question => {
console.log("A new question has started, answering the first answer.");
question.answer(randomnumber);
randomnumber = Math.floor(Math.random() * 3);
});
client.on("quizEnd", () => {
console.log("The quiz has ended.");
});