discord.js-akinator
Advanced tools
Comparing version 1.0.3 to 1.0.4
35
index.js
const Discord = require("discord.js"); | ||
const { Aki } = require("aki-api"); | ||
const games = new Set(); | ||
const hasGuessed = new Set(); | ||
@@ -69,13 +68,8 @@ /** | ||
if (!notFinished) return; | ||
if (hasGuessed.has(message.author.id)) { | ||
stepsSinceLastGuess = stepsSinceLastGuess + 1 | ||
} | ||
if ((aki.progress >= 95 && stepsSinceLastGuess === 10) || aki.currentStep >= 78) { | ||
stepsSinceLastGuess = stepsSinceLastGuess + 1 | ||
if ((aki.progress >= 95 && stepsSinceLastGuess >= 10) || aki.currentStep >= 78) { | ||
await aki.win(); | ||
if (!hasGuessed.has(message.author.id)) { | ||
hasGuessed.add(message.author.id); | ||
} | ||
stepsSinceLastGuess = 0; | ||
@@ -135,5 +129,13 @@ | ||
notFinished = false; | ||
hasGuessed.delete(message.author.id) | ||
games.delete(message.author.id) | ||
} else { | ||
let loadingEmbed = new Discord.MessageEmbed() | ||
.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL()) | ||
.setTitle(`I'm ${Math.round(aki.progress)}% Sure your Character is...`) | ||
.setDescription(`**${aki.answers[0].name}**\n${aki.answers[0].description}\n\nIs this your Character? **(Type Y/Yes or N/No)**`) | ||
.addField("Ranking", `**#${aki.answers[0].ranking}**`, true) | ||
.addField("No. of Questions", `**${aki.currentStep}**`, true) | ||
.setImage(aki.answers[0].absolute_picture_path) | ||
.setColor("RANDOM") | ||
await akiMessage.edit({ embed: loadingEmbed }); | ||
aki.progress = 50 | ||
@@ -145,2 +147,4 @@ } | ||
if (!notFinished) return; | ||
const filter = x => { | ||
@@ -187,2 +191,12 @@ return (x.author.id === message.author.id && ([ | ||
} | ||
let thinkingEmbed = new Discord.MessageEmbed() | ||
.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL()) | ||
.setTitle(`Question ${aki.currentStep + 1}`) | ||
.setDescription(`**Progress: ${Math.round(aki.progress)}%\n${aki.question}**`) | ||
.addField("Please Type...", "**Y** or **Yes**\n**N** or **No**\n**IDK** or **Don't Know**\n**P** or **Probably**\n**PN** or **Probably Not**\n**B** or **Back**") | ||
.setFooter(`Thinking...`) | ||
.setColor("RANDOM") | ||
await akiMessage.edit({ embed: thinkingEmbed }) | ||
await responses.first().delete(); | ||
@@ -195,3 +209,2 @@ | ||
} else if (answer == "s" || answer == "stop") { | ||
hasGuessed.delete(message.author.id) | ||
games.delete(message.author.id) | ||
@@ -198,0 +211,0 @@ let stopEmbed = new Discord.MessageEmbed() |
{ | ||
"name": "discord.js-akinator", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Create an Akinator Command for Your Discord Bot within Seconds of Installation.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12590
200