A Discord bot impersonating users via webhooks, based on their messages, using Markov chains.
Originally created for r/okbuddyhololive's Discord server, but it can be used for other servers as well.
It uses webhooks to send message to a channel with a custom username and avatar (although, the [BOT] tag is still visible next to the name) & it uses Markov chains to generate messages.
Before running the bot, make sure you are running Python 3.8 or later. You can download the latest version of Python from Python.org.
The bot also requires the Message Content Intent, as well as the Server Members Intent.
- Set up a MongoDB database (use the installation guides for help).
- You can either install it on your host machine, or use a remote MongoDB server, as long as it's accessible from your host via a connection URI.
- Create an application with a bot on Discord Developer Portal, remembering to enable the required intents mentioned above.
- For instructions on creating the account, see this guide. It will help you to create an invite link for the bot as well.
- For enabling intents, see this guide.
- Clone the repository to your host machine, or download the source code using the
Code > Download ZIP
button. - Fill out all the values in the
config.toml
file, according to the comments in the file. - Set a permanent system-wide environment variable
DISCORD_TOKEN
with the bot's token, that you can get on the Discord Developer Portal.- For Windows, you can use this for help.
- For Linux, you can put
export DISCORD_TOKEN="<BOT_TOKEN_HERE>"
in the file~/.bashrc
or~/.zshrc
(depending on your shell).
- Set a permanent system-wide environment variable
MONGODB_CONNECTION_URI
with the connection URI to a MongoDB database. - Open a terminal with the bot files in the current directory.
- Install the dependencies for the bot using
pip
.- On Windows, it's:
py -3 -m pip install -r requirements.txt
. - On Linux, it's:
python3 -m pip install -r requirements.txt
. - You only need to do this once. You can skip this step if you already have the dependencies installed.
- On Windows, it's:
- Run the bot using
python3 main.py
orpy -3 main.py
, depending on your operating system.
If you want to contribute to the project, you can fork the repository on GitHub and make a pull request, if you want to.
We kindly welcome any contributions, even if it's just a simple grammar fix!