npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

akinators

v1.0.0

Published

A Discord.js v14 Module that allows you to Create an Akinator Command for Your Discord Bot within Seconds of Installation.

Downloads

5

Readme

A Discord.js v14 Module that allows you to Create an Akinator Command for Your Discord Bot within Seconds of Installation.

NPM

Discord Server

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 akinators --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("akinators");
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");
});

// Example options for Discord.js Akinator:

const language = "en"; // The Language of the Game
const childMode = false; // Whether to use Akinator's Child Mode
const gameType = "character"; // The Type of Akinator Game to Play. ("animal", "character" or "object")
const useButtons = true; // Whether to use Discord's Buttons
const embedColor = "#1F1E33"; // The Color of the Message Embeds

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:

client.on("interactionCreate", async interaction => {
    if (!interaction.isChatInputCommand()) return; // If the interaction is not a slash command, do nothing
    if (interaction.commandName === "akinator") { // If the user sends "/akinator"...
        akinator(interaction, {
            language: language, // Defaults to "en"
            childMode: childMode, // Defaults to "false"
            gameType: gameType, // Defaults to "character"
            useButtons: useButtons, // Defaults to "false"
            embedColor: embedColor // Defaults to "Random"
        });
    };
});

Using a Message as Input:

// ATTENTION: Make sure to enable the "Message Content" intent for your bot in the Discord Developer Portal!

const PREFIX = "!"; // Your bot's command prefix

client.on("messageCreate", async message => {
    if (message.content.startsWith(`${PREFIX}akinator`)) { // When the user types "!akinator"...
        akinator(message, {
            language: language, // Defaults to "en"
            childMode: childMode, // Defaults to "false"
            gameType: gameType, // Defaults to "character"
            useButtons: useButtons, // Defaults to "false"
            embedColor: embedColor // Defaults to "Random"
        });
    };
});

Contact Us