This commit is contained in:
Daniel Odendahl Jr
2017-09-19 21:27:36 +00:00
parent a7d06fe398
commit ae5bdc7b69
+4 -1
View File
@@ -19,7 +19,10 @@ module.exports = class AkinatorCommand extends Command {
if (this.sessions.has(msg.channel.id)) return msg.say('Only one game may be occuring per channel.');
try {
let ans = null;
this.sessions.set(msg.channel.id, {});
this.sessions.set(msg.channel.id, {
progress: null,
step: null
});
while (this.sessions.get(msg.channel.id).progress < 99 && ++this.sessions.get(msg.channel.id).step <= 80) {
const data = ans === null ? await this.createSession(msg.channel) : await this.progress(msg.channel, ans);
const answers = data.answers.map(answer => answer.answer.toLowerCase());