Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

discord.js-akinator

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord.js-akinator - npm Package Compare versions

Comparing version 3.3.3 to 3.4.0

2

package.json
{
"name": "discord.js-akinator",
"version": "3.3.3",
"version": "3.4.0",
"description": "A Discord.js v13 Module that allows you to Create an Akinator Command for Your Discord Bot within Seconds of Installation.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

const Discord = require("discord.js");
const { MessageButton, MessageActionRow } = require("discord.js");

@@ -8,3 +7,3 @@ /**

* @param {Discord.Message} botMessage The Message for the Bot to Send, also the message which will contain the buttons (Max. 8). MUST BE AN EMBED!
* @param {MessageButton[]} buttons An Array of Buttons.
* @param {Discord.MessageButton[]} buttons An Array of Buttons.
* @param {Number} time Time in Milliseconds the Menu should last for.

@@ -21,5 +20,5 @@ */

let buttonRow = new MessageActionRow()
let buttonRow2 = new MessageActionRow()
let buttonRow3 = new MessageActionRow()
let buttonRow = { type: 1, components: [] }
let buttonRow2 = { type: 1, components: [] }
let buttonRow3 = { type: 1, components: [] }
let buttonRows = []

@@ -29,9 +28,9 @@

if (i < 3) {
buttonRow.addComponents(buttons[i]);
buttonRow.components.push(buttons[i]);
}
else if (i < 5) {
buttonRow2.addComponents(buttons[i])
buttonRow2.components.push(buttons[i])
}
else {
buttonRow3.addComponents(buttons[i])
buttonRow3.components.push(buttons[i])
}

@@ -47,10 +46,16 @@

// create our collector
const filter = (i) => i.user == input.author.id;
const filter = (i) => {
if (i.user == input.author.id) {
return true;
} else {
i.deferUpdate();
return false
}
}
let selection;
await botMessage.channel.awaitMessageComponent({
await botMessage.awaitMessageComponent({
filter: filter,
time: 60000,
componentType: "BUTTON"
})

@@ -64,2 +69,2 @@ .then(async (i) => {

return selection;
}
}

@@ -6,2 +6,3 @@ const { Aki } = require("aki-api");

const attemptingGuess = new Set();
const Discord = require("discord.js")

@@ -97,3 +98,5 @@ // this simply gets the user's reply from a button interaction (that is, if the user has chosen to enable buttons)

options.useButtons = options.useButtons || false;
options.embedColor = options.embedColor || "RANDOM";
options.embedColor = Discord.Util.resolveColor(options.embedColor || "RANDOM")

@@ -130,3 +133,3 @@ options.language = options.language.toLowerCase();

color: options.embedColor,
author: { name: usertag, iconURL: avatar }
author: { name: usertag, icon_url: avatar }
}

@@ -158,3 +161,3 @@

color: options.embedColor,
author: { name: usertag, iconURL: avatar }
author: { name: usertag, icon_url: avatar }
}

@@ -167,3 +170,3 @@

fields: [],
author: { name: usertag, iconURL: avatar },
author: { name: usertag, icon_url: avatar },
footer: { text: translations.stopTip }

@@ -199,3 +202,3 @@ }

image: { url: aki.answers[0].absolute_picture_path },
author: { name: usertag, iconURL: avatar },
author: { name: usertag, icon_url: avatar },
fields: [

@@ -217,2 +220,3 @@ { name: translations.ranking, value: `**#${aki.answers[0].ranking}**`, inline: true },

}
if (options.useButtons !== false) await response.deferUpdate()
let reply = getButtonReply(response) || response

@@ -229,3 +233,3 @@ const guessAnswer = reply.toLowerCase();

color: options.embedColor,
author: { name: usertag, iconURL: avatar },
author: { name: usertag, icon_url: avatar },
fields: [

@@ -238,3 +242,3 @@ { name: translations.character, value: `**${await translate(aki.answers[0].name, options.language)}**`, inline: true },

if (options.useButtons) await response.update({ embeds: [finishedGameCorrect], components: [] })
if (options.useButtons) await response.editReply({ embeds: [finishedGameCorrect], components: [] })
else await akiMessage.edit({ embeds: [finishedGameCorrect], components: [] })

@@ -251,10 +255,10 @@ notFinished = false;

color: options.embedColor,
author: { name: usertag, iconURL: avatar }
author: { name: usertag, icon_url: avatar }
}
if (options.useButtons) await response.update({ embeds: [finishedGameDefeated], components: [] })
if (options.useButtons) await response.editReply({ embeds: [finishedGameDefeated], components: [] })
else await akiMessage.edit({ embeds: [finishedGameDefeated], components: [] })
notFinished = false;
} else {
if (options.useButtons) await response.update({ embeds: [guessEmbed], components: [] })
if (options.useButtons) await response.editReply({ embeds: [guessEmbed], components: [] })
else await akiMessage.edit({ embeds: [guessEmbed], components: [] })

@@ -275,3 +279,3 @@ aki.progress = 50

fields: [],
author: { name: usertag, iconURL: avatar },
author: { name: usertag, icon_url: avatar },
footer: { text: translations.stopTip }

@@ -293,2 +297,3 @@ }

}
if (options.useButtons !== false) await response.deferUpdate()
let reply = getButtonReply(response) || response

@@ -319,3 +324,3 @@ const answer = reply.toLowerCase();

fields: [],
author: { name: usertag, iconURL: avatar },
author: { name: usertag, icon_url: avatar },
footer: { text: translations.thinking }

@@ -326,3 +331,3 @@ }

if (options.useButtons) await response.update({ embeds: [thinkingEmbed], components: [] })
if (options.useButtons) await response.editReply({ embeds: [thinkingEmbed], components: [] })
else await akiMessage.edit({ embeds: [thinkingEmbed], components: [] })

@@ -342,3 +347,3 @@ akiMessage.embeds[0] = thinkingEmbed

color: options.embedColor,
author: { name: usertag, iconURL: avatar }
author: { name: usertag, icon_url: avatar }
}

@@ -345,0 +350,0 @@

@@ -16,44 +16,10 @@ const buttonMenu = require("./buttonMenu");

let yes = new Discord.MessageButton()
.setLabel(translations.yes)
.setStyle("SECONDARY")
.setEmoji("✅")
.setCustomId("✅")
let yes = { type: 2, label: translations.yes, style: 2, custom_id: "✅", emoji: { name: "✅" } }
let no = { type: 2, label: translations.no, style: 2, custom_id: "❌", emoji: { name: "❌" } }
let idk = { type: 2, label: translations.dontKnow, style: 2, custom_id: "❓", emoji: { name: "❓" } }
let probably = { type: 2, label: translations.probably, style: 2, custom_id: "👍", emoji: { name: "👍" } }
let probablyNot = { type: 2, label: translations.probablyNot, style: 2, custom_id: "👎", emoji: { name: "👎" } }
let back = { type: 2, label: translations.back, style: 2, custom_id: "⏪", emoji: { name: "⏪" } }
let stop = { type: 2, label: translations.stop, style: 4, custom_id: "🛑", emoji: { name: "🛑" } }
let no = new Discord.MessageButton()
.setLabel(translations.no)
.setStyle("SECONDARY")
.setEmoji("❌")
.setCustomId("❌")
let idk = new Discord.MessageButton()
.setLabel(translations.dontKnow)
.setStyle("SECONDARY")
.setEmoji("❓")
.setCustomId("❓")
let probably = new Discord.MessageButton()
.setLabel(translations.probably)
.setStyle("SECONDARY")
.setEmoji("👍")
.setCustomId("👍")
let probablyNot = new Discord.MessageButton()
.setLabel(translations.probablyNot)
.setStyle("SECONDARY")
.setEmoji("👎")
.setCustomId("👎")
let back = new Discord.MessageButton()
.setLabel(translations.back)
.setStyle("SECONDARY")
.setEmoji("⏪")
.setCustomId("⏪")
let stop = new Discord.MessageButton()
.setLabel(translations.stop)
.setStyle("DANGER")
.setEmoji("🛑")
.setCustomId("🛑")
let answerTypes = [];

@@ -120,2 +86,2 @@

}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc