🔮 Discord.js Akinator 🔮
A Discord.js v14 Module that allows you to Create an Akinator Command for Your Discord Bot within Seconds of Installation.
Features
-
🌎 100+ Languages Supported! | Lightning fast translation has been made possible by Google Translate and hard-coded mappings!
-
▶️ Buttons! | Don't want to type out responses to questions? This package gives you the option to use discord's buttons to easily click your answer of choice!
-
🎮 Multiple Game Types! | This package will allow you to choose whether Akinator will guess an Animal, Character or Object!
-
🙋 Child Mode! | Want to filter out NSFW questions? You can choose to enable Akinator's Child Mode to keep your games squeaky clean!
-
⚡️ Quick & Easy Setup! | This package was built with the intentions of working out-of-the-box. Only one parameter is required at least!
-
🤖 Slash Command & Message Support! | No matter how your bot receives its commands, you can simply pass in a CommandInteraction
or Message
and it will work!
Install Package
Let's take a look at how you can install this package into your Discord Bot Project.
npm i discord.js-akinator --save
For versions 4.0.0 and above, you'll also need Discord.js v14. This can easily be installed with:
npm i discord.js@14 --save
For versions earlier than 4.0.0, you'll need Discord.js v13 instead. However it is recommended you update to patch bugs and security vulnerabilities, as well as get the newest features from this package!
npm i discord.js@13 --save
Code Examples
Initial Setup:
const { Client, IntentsBitField } = require("discord.js");
const akinator = require("discord.js-akinator");
const client = new Client({
intents: [
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.MessageContent
]
});
client.login("Discord Bot Token");
client.on("ready", () => {
console.log("Bot is Online");
});
const language = "en";
const childMode = false;
const gameType = "character";
const useButtons = true;
const embedColor = "#1F1E33";
With Discord.js Akinator, you can choose whether you want to use a message, or a slash command as the input. Here's a quick example on how to do both!
Using Discord's Slash Commands as Input:
const { InteractionType } = require("discord.js");
client.on("interactionCreate", async interaction => {
if (interaction.type !== InteractionType.ApplicationCommand) return;
if (interaction.commandName === "akinator") {
akinator(interaction, {
language: language,
childMode: childMode,
gameType: gameType,
useButtons: useButtons,
embedColor: embedColor
});
};
});
Using a Message as Input:
const PREFIX = "!";
client.on("messageCreate", async message => {
if (message.content.startsWith(`${PREFIX}akinator`)) {
akinator(message, {
language: language,
childMode: childMode,
gameType: gameType,
useButtons: useButtons,
embedColor: embedColor
});
};
});
Contributors
Contact Us