NaoTomori

by ZhongXiLu

GitHub Readme.md

Nao Tomori

codecov

Basic Discord bot that pings you when a new anime episode or manga chapter is released, based on your MyAnimeList account. I couldn't find any bot that does this, so I wrote one myself.

This is just a personal bot, meaning it only serves one user at a time, so feel free to use it for yourself.

Currently it supports following sources:

Usage

Just set your MyAnimeList profile with the !setProfile command and you're good to go. For more information on the other commands, you can use !help or check the table below.

Name Description setProfile Set your MAL profile removeProfile Remove your MAL profile (you wont get pings then) getProfile Get a brief overview of your MAL profile setChannel Set the bot channel (where it will ping you) setPrefix Set the prefix of the bot ping Ping the bot help Get a list of all the commands with their description setAnimeSource Set the anime source for retrieving new anime (set source to "none" to remove the anime source) setMangaSource Set the manga source for retrieving new manga (set source to "none" to remove the manga source)

Setup

Local Setup

  1. Set up Discord application:

    • Go to https://discordapp.com/developers/applications/me
    • Create a new application and a new bot
    • Enable PRESENCE INTENT at the Privileged Gateway Intents section
    • Make sure you save the bot token somewhere for the following steps
    • You can generate an invite link for your bot at the OAuth2 URL Generator section under the OAuth2 tab to add it to your server
  2. Set up Postgresql database

    sudo -i -u postgres
    $ createuser <USER> -P --interactive
    $ createdb naotomori

    Also export the configuration as:

    export DATABASE_URL="dbname='naotomori' user=<DB_USER> host='localhost' password=<DB_PASSWORD>"
  3. Set up bot (make sure you are using python3.7 or greater):

    pip install -r requirements.txt
    export DISCORD_CLIENT_TOKEN=<TOKEN>
    python main.py

Heroku Setup

Alternatively, you can use Heroku to host the discord bot for free. There are already config files in this repository, so the deployment should be easy:

Deploy

  1. Follow step 1 from the Local Setup
  2. Click the button above to create the app from a template
  3. Start your worker in the 'Resources' tab
  4. That's it! Your discord bot should be running 24/7 (it actually only runs 550 hours a month if you have the 'free' version, but you can increase this to 1000 hours if you link your credit card, making it run the entire month)

Tests

Run all unit tests:

python -m unittest -v