Coder Social home page Coder Social logo

StrapBot

Chat

A multifunction Discord bot, with multiple languages support, moderation, text generation (using a Markov chain) and YouTube news!

Installation

Requirements

  • 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]
  1. 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 the PUBKEY_PATH, PRIVKEY_PATH and PRIVKEY_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.
  2. Checkout into the latest release: cd StrapBot; git checkout $(git describe --tags `git rev-list --tags --max-count=1`)

  3. 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
  4. Copy example.env to .env and fill in the required fields.

  5. 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.

Running in the background

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.

License

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.

Translating

Translations are always welcome! You can send a pull request to the languages repository translating the bot to your language.

The server

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.

strapbot's Projects

imgen icon imgen

API server for image manipulation, focused on Dank Memer (discord bot)

languages icon languages

Repository where StrapBot's translations are placed.

strapbot icon strapbot

A multi-function Discord bot, with multiple languages support, music, moderation, fun commands and YouTube news!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.