Discord Bot for Keeping track of quotes
- Automatic 'Quote like' Support
- Add and Remove Your Own Quotes
- Search for Quotes
- Get Random Quotes
To run via docker, see Docker Usage
- Follow this guide to learn how create a new Discord Bot and add it to your server.
- SAVE THE TOKEN. It will be needed when creating the
.env
file in step 6
- SAVE THE TOKEN. It will be needed when creating the
⚠️ With the new Discord v2 changes, make sure allPrivileged Gateway Intents
are enabled⚠️
- Clone the repo
git clone git@github.com:dlg1206/Discord-Quote-Bot.git
- Change into the
src
directory
cd src
- (OPTIONAL) Create a virtual python environment
python3 -m venv venv
. venv/bin/activate
- Install dependencies
pip install -r requirements.txt
- Copy the new token of the Discord Bot from step 1 into a
.env
file inside thesrc
directory
touch .env
Example .env
file, see Environment Variables for additional details
TOKEN=<your token here>
- Launch the bot inside
src
directory
python3 quotebot
Quotebot has 7 total commands with the command prefix !
- qadd: Add a new quote
- Usage:
!qadd "<quote>" -<Quotee>
- Usage:
- q: Get a quote from a person
- Usage:
!q <Name>
- Usage:
- qall: Get all quotes from a person
- Usage:
!qall <Name>
- Usage:
- qrand: Get a random quote
- Usage:
!qrand
- Usage:
- qsearch: Search the quote list for a certain person
- Usage:
!qsearch
- Usage:
!qsearch <keywords>
- Usage:
- qstat: Get stats for quotes
- Usage:
!qstat
- Usage:
!qstat <name>
- Usage:
- qhelp: Display the help menu
- Usage:
!qhelp
- Usage:
Quotes can be directly added using the !qadd
command. However, QuoteBot can parse messages to automatically add quotes
if they match the following format:
(pre-context) "quote" (post-context) -Quotee
Examples:
- "I'm the Trash Man! I come out, I throw trash all over the- all over the ring!" - Frank Reynolds
- (holding a calculator) "What are you?" -Charlie Kelly
- "I reign supreme over everyone in this school! I’m the golden god of this place!" (proceeds to run away) -Dennis Reynolds
By default, QuoteBot will look for a dot .env
file to load variables from, but the path can be explicitly using the
-e
flag.
python3 quotebot -e <path to env file>
DATABASE_PATH
(default: `data/db/quotes.db): Path to SQLite database file. Will be created if does not exist, otherwise use what's stored.
DATABASE_PATH=path/to/sqlite/file
BLACKLIST
(default: None): Comma seperated list of channel ids to exclude from 'quote-like' additions
BLACKLIST=866855045626135040,8668552233426135041
A docker image is available to host the bot
docker build -t quotebot:2.5.2 .
( If running in the root directory )
docker run --rm -it -d -e TOKEN=<your token here> quotebot:2.5.2
To reattach, run docker attach quotebot
# Just using token
docker run --rm -it -d -e TOKEN=<your token here> -v <absolute path to db directory>:/app/data/db --name quotebot quotebot:2.5.2
# or using env file
docker run --rm -it -d --env-file <path to env file> -v <absolute path to db directory>:/app/data/db --name quotebot quotebot:2.5.2
--rm
: Remove container when finished-it
: Open interactive shell to allow fordocker attach
-d
: Run container in detached mode, i.e. in the background. Remove if you want to run attached-e
: Set environment variable, TOKEN must be set--env-file
: Path to environment file to use, same aspython3 quotebot -e <path to env file>
-v
: Mount db directory to container's db directory. This allows for the container to stopped and started without loosing quote info. Also allows for SQLite db to be accessed outside the container--name
: Name of the container<image>
: Name of image to use, in this casequotebot:2.5.2
QuoteBot has an additional command, qkill
, which will kill the bot process from inside Discord. This can only be used
by the owner of the Bot.