🔮 Discord.js Akinator 🔮
A Discord.js v14 module that allows you to create an Akinator command for your discord bot in a matter of seconds.
![NPM](https://nodei.co/npm/discord.js-akinator.png)
![Discord Server](https://img.shields.io/discord/667479986214666272?logo=discord&logoColor=white&style=flat-square)
![Buy Me A Coffee](https://cdn.buymeacoffee.com/buttons/default-orange.png)
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!
Installation & Compatibility List
To install this package, simply run the following command in your terminal:
npm i discord.js-akinator --save
Please Note: The latest release of this package is only compatible with Discord.js v14. If you are using Discord.js v13 or v12, please refer to the table below to find the version that suits your needs.
Discord.js Version | Recommended Package Version |
---|
v14.x.x | v4.x.x (@latest ) |
v13.x.x | v3.x.x (@3.4.5 ) |
v12.x.x | v2.1.0 or earlier |
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";
const translationCachingOptions = {
enabled: true,
path: "./translationCache"
};
With Discord.js Akinator, you can choose whether you want to use a slash command, or a message as the input. Here's some quick examples on how to do both!
Using Discord's Slash Commands as Input:
client.on("interactionCreate", async interaction => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === "akinator") {
akinator(interaction, {
language: language,
childMode: childMode,
gameType: gameType,
useButtons: useButtons,
embedColor: embedColor,
translationCaching: translationCachingOptions
});
};
});
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,
translationCaching: translationCachingOptions
});
};
});
Contributors
Special thanks to many people helping to make language translation more accurate, refactor code, provide compatibility for new Discord.js versions, and so much more!
Contact Us
Created and maintained by