Cathy Discord AI chat bot documentation!

Artificial intelligence (AI) chat bot for Discord written in Python

Get started with Cathy chatbot

Cathy is an artificial intelligence (AI) chat bot for Discord servers. Follow these instructions to start chatting with Cathy.

1) Invite

First, invite Cathy to your server by visiting https://cathy.devdungeon.com/invite/ You must be an owner or admin to invite. Share the link with a server admin if you cannot invite yourself.

2) Create the #chat-with-cathy channel

You must create a channel named #chat-with-cathy if it does not exist.

3) Chat

Chat in the #chat-with-cathy channel. Cathy will respond to anyone in this channel.

Invite existing bot to your server

Cathy is a public bot that you can invite to your own Discord server. Note that the bot only chats in a channel named #chat-with-cathy. Create the channel if it does not exist.

Invite the bot

To invite the exiting bot to your server and chat, first invite the bot to your server and then create a channel named #chat-with-cathy.

Follow this link to invite the bot:

https://cathy.devdungeon.com/invite/

Create the chat-with-cathy channel

Don’t forget to create the #chat-with-cathy channel. You must create this channel. Talk in that channel.

Learn more

Visit https://cathy.devdungeon.com/ to learn more.

Chat with Cathy on DevDungeon server

You can join the DevDungeon.com Discord server and chat with the bot in the #chat-with-cathy channel.

Use this link to join the Discord server: https://www.devdungeon.com/discord

Run your own bot

Run your own bot by following the instructions below.

Note that the cathy package requires Python 3.7+ and discord.py of version 1.2.5+. Python 3.7 introduced backwards incompatible changes with the discord.py package version being used so older versions may not work.

Installation

Install the Python package:

pip install cathy

Or download this package and install with setup.py:

python setup.py install

Running

Run on the command-line to get help:

cathy --help

You can also invoke it as a Python module directly:

python -m cathy --help

It expects three environment variables to be present. You can pass them like normal or create a .env file in your working directory. See the example in misc/example.env.

  • DISCORD_TOKEN - Your bot’s Discord token from https://discord.com/developers/applications/
  • DISCORD_CHANNEL - Channel to chat in. e.g. chat-with-cathy
  • DATABASE - Path to SQLite3 database file. It will be created if it does not exist.

Set up a Linux systemd service

Use the service file in misc/cathy.service as a template. Set up cathy as normal, and then modify the systemd service file as needed and copy or symlink it to /etc/systemd/system/cathy.service and then you can manage the service with:

sudo systemctl enable|disable|start|stop|status|restart cathy

Running with Docker

The included Dockerfile will let you run the bot in a Docker container

Build the image first by running docker build from the root project directory:

docker build . --tag cathy

Then run it, passing in the environment variables file:

docker run --env-file .env cathy

Getting a token

If you don’t already have a bot token, you need to follow a few steps:

  • Create an application at https://discordapp.com/developers/applications/
  • In the application, go to Bot tab.
  • Click add bot user.
  • Go to OAuth2 tab, scroll down to Scopes section
  • Click on “bot” scope and copy the URL it provides
  • Visit the URL in your browser and accept the bot invitation to your server
  • Go back to the Bot tab
  • Copy the token from the Bot tab.

How can I create my own bot?

If you want to create your own bot, you can follow some of these tutorials on DevDungeon.com

AIML files

The chat bot intelligence is powered by AIML.

It comes packaged by default with the Alice bot set of XML files.

You can also add your own AIML files to modify the chat behavior in the cathy/aiml/custom/ folder.