A multifunction Discord bot, with multiple languages support, moderation, text generation (using a Markov chain) and YouTube news!
- Python 3.8+
- A Discord bot token
- A MongoDB database
- A Google API key for the YouTube news
- PM2 for running the bot in the background (optional, but recommended) [requires Node.js]
-
Clone the repository:
git clone https://github.com/StrapBot/StrapBot.git
- You can also clone through SSH:
git clone [email protected]:StrapBot/StrapBot.git
, but you'll need to set up an SSH key and set thePUBKEY_PATH
,PRIVKEY_PATH
andPRIVKEY_PASS
environment variables in the.env
file. - If you don't want to pass the SSH key passphrase to the
.env
file, you can either create another key without it and only use it for the bot, or simply use HTTP.
- You can also clone through SSH:
-
Checkout into the latest release:
cd StrapBot; git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
-
Install the dependencies:
pip install -Ur requirements.txt
- If you're setting up the server, you'll also need to install the server dependencies:
pip install -Ur requirements.server.txt
- If you're setting up the server, you'll also need to install the server dependencies:
-
Copy
example.env
to.env
and fill in the required fields. -
Run the bot:
python3 strapbot.py
Note: If you download the bot through the ZIP file from the releases page, the updater will not work.
You can use PM2 to run the bot in the background.
To do so, copy the ecosystem.config.example.js
file to ecosystem.config.js
and adjust your Python path.
Then, run pm2 start --only strapbot
in the bot's directory to start the bot in the background.
If you're setting up the server in the same machine, instead, you can just run pm2 start
to start both the bot and the server.
Instead, if you're setting up the server in a different machine, you can run pm2 start --only sb-server
in the bot's directory to only start the server in the background.
Note: This must only be done the first time you add the bot to PM2. Once the bot has been started into PM2, you can use
pm2 ls
to view the list of processes.
If you do not know how PM2 works, you can find more information here.
This bot is licensed under the GPL-3 License, except for the custom
folder, where you can add your very own code to add features to the bot that do NOT modify the core functionality of it.
Translations are always welcome! You can send a pull request to the languages repository translating the bot to your language.
The server is used for the YouTube news to work. It works using Google's PubSubHubbub Hub to send requests to the server, which sends notifications to channels using webhooks.
It should be always running to work correctly, and it's recommended to run it in a VPS or dedicated server. If you want to run it on a home server (such as a Raspberry Pi), make sure you have a static public IP and you set port forwarding correctly in your home network.
You can start the server by either running python3 server.py
or by running sanic --factory server:create
.