Skip to content

A Discord bot built with Node.js to pull a random anime from an AniList Account

License

Notifications You must be signed in to change notification settings

Malavisto/anilist-insights-discord

Repository files navigation

Anilist Insights for Discord

A Discord bot that connects with AniList to do multiple tasks based on a user's AniList profile.

Disclaimers

This project was made as an testing ground for me to exeriment with AI, I do try to maintain the repo on my own though

This bot is not affiliated with Anilist nor Discord

Some parts of this repo are AI-Generated

Features

  • Fetches a random anime from an Anilist account.
  • Generates stats from an Anilist Account.
  • Generates a recomendation based on an Anilist account and fetches it.
  • Interactive slash commands with error handling for invalid usernames or empty lists.
  • Has a built-in prometheus endpoint and decent logging.

Setup

Prerequisites

  1. Node.js version 23 or later installed or Docker with docker compose.
  2. A Discord bot token. Create one on the Discord Developer Portal.
  3. Install dependencies NodeJS Only:
    pnpm install
    

Configuration

  1. Create a .env file with the example

    cp .env.example .env
    
  2. Modify environment variables in the .env

  3. Make sure your bot has the required Discord permissions:

    • Slash commands
    • Read and send messages in the target channels.

Running the Bot

Start the bot by running:

node start

or

docker compose up -d

The bot will log in and register the commands in all the servers it's added to.

Usage

Random Anime

  1. Use the /random_anime command in Discord and provide your AniList username.
  2. The bot will fetch a random anime from your AniList and display its details in an embed.

Anime Recomendations

  1. Use the /anime_recommend command in Discord and provide your AniList username.
  2. The bot generate recomendations based on your anilist and pick one out of five anime and display its details in an embed.

Anime Stats

  1. Use the /anime_stats command in Discord and provide your AniList username.
  2. The bot will generate stats from your AniList and display them an embed.

Development

Prerequisites

  1. Node.js version 23 or later installed.
  2. A Discord bot token. Create one on the Discord Developer Portal.
  3. Install dependencies:
    pnpm install
    

Configuration

  1. Create a .env file with the example

    cp .env.example .env
    
  2. Modify environment variables in the .env

  3. Make sure your bot has the required Discord permissions:

    • Slash commands
    • Read and send messages in the target channels.

Running the Bot

Start the bot by running:

pnpm start

Development Notes

  • The project uses:
    • discord.js for Discord integration.
    • Axios for AniList API requests.
    • Slash commands for an interactive experience.
  • Errors and logging are handled with a custom logger for better debugging.

Key Files

  • modules/ Custom modules used by main app
  • app.js: Main application logic.
  • logger.js: Logging module.
  • metrics.js: Prometheus metrics module.
  • .env: Stores sensitive configuration variables.

Contributions

Contributions are welcome! Feel free to open issues or submit pull requests.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A Discord bot built with Node.js to pull a random anime from an AniList Account

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •