Made by: Paul Gleason
A Discord bot that uses Markov Chain to generate sentences from input data that can be taken from discord channels.
pip install -r requirements.txt
: To install requirments
discordpy
markovify
numpy
termcolor
Linux
- python3 -m venv venv
- source ./venv/bin/activate
/algorithm
- Switch between creators algorithm or markovify (If algorithm is change you must retrain the bot).Creators
: will use the creators algorithm.Markovify
: will use the markovify algorithm.
/change-vars
- (Work in Progress)/listen
- Add or Remove channels from listening.add
: will add the channels in channel1-10 to the listening list.remove
: will remove the channels in channel1-10 to the listening list.
/listening
- Will display what channels are being listened to./mark
- Output sentence from training data./set-channel
- Set channel so bot can only be used in that channel./talk
- Give the ability for the bot to talk freely.True
: bot will talk in the /set-channel every 10 secondes.False
: bot can be used as normal.
/train
- Bot will read messages from listening channels and turn it into a data set for markov.True
: will remove previous training data (training data is deleted once bot is turned off).False
: will appened new data onto the old data file.
- Download Repo by cloning or ZIP.
- Enter the working directory.
- Copy the
config_Example.py
and call the copyconfig.py
then followstep 1
underDiscord Side
. - Run
bot.py
- Create a Discord bot application
- Under the "Bot" section, enable the "Message Content Intent", and copy the token for later.
- Invite link:
https://discord.com/oauth2/authorize?client_id={APPLICATION_ID}&scope=bot+applications.commands&permissions=105472
Just put your bots application ID. - Setup and configure the bot using one of the below methods:
-
Setup config with correct data.
- Copy the
config_Example.py
and called the fileconfig.py
and add the following. - You may need to enable devoloper mode to see Guild ID and User ID
Token
: aquire from developer portalOwner_ID
: Right click user and select
- Config File Example:
TOKEN = 'jalqwerjnzxljfasdnotarealtoken' OWNER_ID = ['notrealownderidmewqior', 'anothernotrealowner_idajli']
- Copy the
-
Configure bot channel:
-
Configure channels for bot to listen to:
3.1. To add channels3.2. To remove channels
-
Choice algorithm:
4.1. Creators Algorithm4.2. Markovify Algorithm
-
Train Bot (depending on channel size this may take some time):
5.1. If running for the first time use or want to start over training setTrue
5.2. If you already have trained the bot once you can use
False
to add (If going over channel from first training it will duplicated the data.) -
Getting the bot to talk:
-
OPTIONAL: if you could like the bot talk every 15 seconds:
7.1. The bot will start sending a message every 15 seconds7.2. The bot may say 1 or 2 more messages before fully stopping
Copy the config_Example.py
and call the file config.py
.
TOKEN = 'jalqwerjnzxljfasdnotarealtoken'
OWNER_ID = ['notrealownderidmewqior', 'anothernotrealowner_idajli']