Make a pause in loop in discord.js when collecting answers?

Right, so I’m trying to make a discord bot that gives a quiz. It’s working really great - you say ‘quiz numofquestions’ and it gives you those questions - but it doesn’t wait for the questions to be answered or timed out before answering the next one - it does it all in one go.
here is a screenshot of what it did:

(the scribbled out bit is my username)
It also asked the same question twice, but that’s another problem entirely. At the moment, I’m really confused as to how I can make it wait.
Here is the code:

const Discord = require(‘discord.js’);
const client = new Discord.Client();

client.on(‘message’, message => {
var prefix = "quiz ";
if (message.content.startsWith(prefix)) {
const args = message.content.slice(prefix.length);
const num = Math.floor(Number(args));
if (isNaN(num)) {
message.reply(“You need to specify the amount of questions.”);
}
else {
message.channel.send(“A quiz is about to begin. It wil have " + num + " qestions. It will begin in 10 seconds.”);
setTimeout(quiz, 10000);
function quiz() {
var i;
for (i = 0; i < num; i++) {
const quiz = require(’./quiz.json’);
const item = quiz[Math.floor(Math.random() * quiz.length)];
const filter = response => {
return item.answers.some(answer => answer.toLowerCase() === response.content.toLowerCase());
};

message.channel.send(item.question).then(() => {
message.channel.awaitMessages(filter, { max: 1, time: item.time, errors: [‘time’] })
.then(collected => {
message.channel.send(${collected.first().author} got the correct answer!);
})
.catch(collected => {
message.channel.send(‘Oh noes! Looks like nobody got the answer this time!’);
});
});
}
}
}
}
});

client.login(process.env.token);

I would try the setTimeout thing again, but I don’t really know how to do that in this loop, and I don’t know whether it would still function correctly.
If you want, you can find the project at https://glitch.com/edit/#!/iamarobot.
Any help would be appreciated.

Thanks in advance! :slight_smile:

Edit: forgot to make it not private! It is now not private.