Commit dfb06091 authored by NanoDano's avatar NanoDano

Adding reStructuredText documentation with Sphinx

parent ebd0357d
Cathy AI Discord Chat Bot
Written in Python 3 using AIML chat library.
import discord
import os
import random
......@@ -12,7 +17,17 @@ BOT_PREFIX = ('?', '!')
class ChattyCathy:
Class that contains all of the bot logic
def __init__(self, channel_name, bot_token):
Initialize the bot using the Discord token and channel name to chat in.
:param channel_name: Only chats in this channel. No hashtag included.
:param bot_token: Full secret bot token
self.channel_name = channel_name
self.token = bot_token
# Minimal makefile for Sphinx documentation
# You can set these variables from the command line.
SPHINXBUILD = sphinx-build
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
\ No newline at end of file
# -*- coding: utf-8 -*-
# Configuration file for the Sphinx documentation builder.
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = u'Cathy Discord AI chat bot'
copyright = u'2019, NanoDano'
author = u'NanoDano'
# The short X.Y version
version = u''
# The full version, including alpha/beta/rc tags
release = u'1.1.1'
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = [u'_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
# html_sidebars = {}
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'CathyDiscordAIchatbotdoc'
# -- Options for LaTeX output ------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
# 'preamble': '',
# Latex figure (float) alignment
# 'figure_align': 'htbp',
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'CathyDiscordAIchatbot.tex', u'Cathy Discord AI chat bot Documentation',
u'NanoDano', 'manual'),
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'cathydiscordaichatbot', u'Cathy Discord AI chat bot Documentation',
[author], 1)
# -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'CathyDiscordAIchatbot', u'Cathy Discord AI chat bot Documentation',
author, 'CathyDiscordAIchatbot', 'One line description of project.',
# -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
# epub_identifier = ''
# A unique identification for the text.
# epub_uid = ''
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# -- Extension configuration -------------------------------------------------
.. Cathy Discord AI chat bot documentation master file, created by
sphinx-quickstart on Tue Mar 19 00:08:39 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Cathy Discord AI chat bot's documentation!
Artificial intelligence (AI) chat bot for Discord written in Python
.. toctree::
:maxdepth: 2
:caption: Contents:
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
* Source code:
* Home page:
* AIML Tutorial:
* Live Demo:
* Contact:
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
set BUILDDIR=_build
if "%1" == "" goto help
if errorlevel 9009 (
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.If you don't have Sphinx installed, grab it from
exit /b 1
goto end
Getting Started
What is Chatty Cathy?
Chatty Cathy is an artificial intelligence (AI) chat bot for Discord server. It is easily extended with new commands. It is written in Python 3. You can invite the DevDungeon Chatty Cathy to your server or run your own version.
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. You can follow this tutorial to learn more about using AIML with Python: AI Chat Bot in Python with AIML.
Also check out the Help Desk Bot which is another DevDungeon project. It's a simple bot that checks Bitcoin price, has a magic 8 ball command, and a LMGTFY feature.
Invite Chatty Cathy to your Discord server
Chatty Cathy is a public bot that you can invite Chatty Cathy to your own Discord server. If you invite the public bot, you will need to create a channel named "chat-with-cathy" to chat with the bot. This is done to prevent the chat spam in every channel. If you want to customize the channel name you can run your own instance of the bot. Instructions are below. To invite the public bot, just visit this authorization URL directly:
How can I create my own bot?
If you want to create your own bot, you can follow these tutorial for writing a Discord bot in Python:
Make a Discord Bot with Python
Make a Discord Bot with Python - Part 2
Bot shows up in the user list:
Sample bot chat:
Live Test
Chat with Cathy in the DevDungeon Discord server channel #chat-with-cathy.
Run your own Chatty Cathy
If you plan to modify or extend the bot, you should download the source from GitHub. You may choose to fork the repository so you have your own project to work in. Download the source from and install using
python install
Or, you can use pip to install
pip install cathy
cathy --help # Test
Discord chat bot using AIML artificial intelligence
cathy <channel> <token>
<channel> Name of channel to chat in
<token> Bot's Discord API token
-h --help Show this screen.
Creating a Bot User on Discord
Note that you need to be a server owner to do these actions. You can create your own Discord server for free to test. If you want to run the bot on your own server you need to first create a bot user and obtain its token. First, go to your applications page in the Discord dashboard: Create a new app, and then in the app settings page, add a bot to the application. Once the bot is created for the application, obtain the bot token by clicking "Click to reveal" right under the bot's username where it says "Token". That is the token you need to pass to the program when running it.
Adding Bot to a Server
Once an application is created, you need the Client ID available on the application details page in the first section labeled "App Details". Once you have the client ID, use this URL to authorize that client ID. It will ask you what server you want to add it to. Replace the XXXXXXXX with the Client ID.
After you have authorized the app for your server, you can run the bot and provide it the bot token (not the client ID), and the name of the channel you want it to chat in. It needs the channel name so it doesn't respond to every message in every channel. If you authorize the bot for multiple servers, the servers will all need the same channel name for the bot to chat. For example, on the DevDungeon Discord server, the channel is #chat-with-cathy.
\ No newline at end of file
Invite existing bot to your server
Follow this link to invite the bot:
Set up and host your own bot
Run your own bot by following the instructions below.
## Installation
pip install cathy
Or download this package and install with
python install
## Running
cathy --help
## Usage
Discord chat bot using AIML artificial intelligence
cathy <channel> <token>
<channel> Name of channel to chat in (no hashtag)
<token> Bot's Discord API token
-h --help Show this screen.
## Example Usage
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment