*Disclaimer. This was a personal project to learn DiscordJS and TypeScript. Go easy on me.
This discord bot serves a very niche function: to interactively scrape audiobooks from AudioBook Bay from within discord.
To utilize this bot you need:
- To serve audiobooks via Plex (entirely optional)
- Use Qbitorrent to handle your downloads
- Use Discord
-
Create a Discord Bot
- Go to https://discord.com/developers/applications
- Create a new application (you can name it whatever, but AudiobookRequester is nice.) Feel free to use this icon:
- Go to OAuth2 > URL Generator page, select bot under Scopes. Then, at minimum, select Embed Links, Use Slash Commands, and Send Messages under Bot Permissions.
- Click Copy to get the URL and go to that URL.
- Under Add to Server select your server.
- Authorize the permissions.
- Go back to the Discord Developer Portal and go to the Bot page and click Add Bot
- Turn on Message Content Intent under the heading
Privileged Gateway Intents
. - Save the changes.
- Then copy the Token. You will need to provide this token in your .env file.
-
Create a directory of your choice (e.g. ./abb-discord-bot) to hold the docker-compose.yml and .env files:
mkdir ./abb-discord-bot
cd ./abb-discord-bot
- Download docker-compose.yml and example.env with the following commands:
wget https://github.com/jamcalli/ABB-Discord-Bot/releases/download/Release/docker-compose.yml
wget -O .env https://github.com/jamcalli/ABB-Discord-Bot/releases/download/Release/example.env
- Populate the .env file with your parameters:
Set the following environment variables:
DISCORD_TOKEN
: The token from above, when creating your discord bot.DISCORD_CLIENT_ID
: Go to Discord Developer Applications to find your bot application's ID.DISCORD_GUILD_ID
: The ID of the guild where your bot will live.QBITTORRENT_HOST
: qBittorrent host address (e.g., http://localhost:6500). All downloads are categorized asaudiobooks
(within a folder called Audiobooks within your qBittorent download folders. Point Plex at this directory or ensure those files are auto moved to wherever your Plex looks for Audiobooks).QBITTORRENT_USERNAME
: qBittorrent usernameQBITTORRENT_PASSWORD
: qBittorrent passwordUSE_PLEX
: TRUE or FALSE (If not true, then you can leave the other plex variables blank)PLEX_HOST
: Plex server address (e.g., http://localhost:32400)PLEX_TOKEN
: This is your X-Plex-Token. Find out how to get yours here.PLEX_LIBRARY_NUM
: This is the library section number. It can be found by going to the following URL:http://[PMS_IP_Address]:32400/library/sections?X-Plex-Token=YourTokenGoesHere
. ReplaceYourTokenGoesHere
with your token from above. Note thekey="number"
of your audiobook library. That number goes here.
Your .env
file should look something like this:
DISCORD_TOKEN=YOUR_DISCORD_TOKEN
DISCORD_CLIENT_ID=YOUR_DISCORD_CLIENT_ID
DISCORD_GUILD_ID=YOUR_DISCORD_GUILD_ID
QBITTORRENT_HOST=YOUR_QBITTORRENT_HOST
QBITTORRENT_USERNAME=YOUR_QBITTORRENT_USERNAME
QBITTORRENT_PASSWORD=YOUR_QBITTORRENT_PASSWORD
USE_PLEX=TRUE
PLEX_HOST=YOUR_PLEX_HOST
PLEX_TOKEN=YOUR_PLEX_TOKEN
PLEX_LIBRARY_NUM=YOUR_PLEX_LIBRARY_NUM
docker compose pull && docker compose up -d
If all was successful, your logs should look something like this:
- Lastly, use the command /scrape. The AudioBook Bay search query is very janky, so provide at least something to the title filter to narrow down your search results.
This project was made possible thanks to the following repositories:
- AudioBookBay Scraper: This repository provided the basic functions that this bot relies upon.
Please visit these repositories and give them a star if you found them helpful.