/overflow-discord-bot

A small bot designed to help you with coding and finding and solving issues faster by integrating stack overflow workflow into discord.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Overflow discord bot

Maintenance License: GPL v3 made-with-python made-with-discord.py CodeFactor DeepSource

A multipurpose bot to assist you with code, moderation and more, while integrating more features in it.

Usage

Go to any channel in discord of any server where this bot is invited, and invoke it using =help.

Development / Contributing

If you're interested in growing this project further, Add a .env file based on .env.example file. And add the following things:

Creating the bot on Discord

  1. Create bot on Discord's bot portal
  2. Make a New Application
  3. Go to Bot settings and click on Add Bot
  4. Give Administrator permission to bot
  5. You will find your bot TOKEN there, it is important that you save it
  6. Go to OAuth2 and click bot, than add Administrator permissions
  7. You can follow the link that will appear to add the bot to your discord server

Installation

This guide is to assist you with self-hosting and running an instance of this bot for yourself.

Docker

Docker is an easy way of containerizing and delivering your applications quickly and easily, in an convenient way. It's really simple to get started with this, with docker handling all the installation and other tasks.Configure the environmental variables by renaming the .env.example file to .env with the respective values. Then, run docker-compose --env-file .env up after getting the project and config ready.

Docker mini guide:

  • Running the bot: docker-compose --env-file .env up
  • Stopping the bot: docker-compose down
  • Rebuilding the bot: docker-compose build

Self hosting without docker

This is a clean and neat way of hosting without using docker. You can follow this if docker doesn't work well on your system, or it doesn't support it. Containers are resource intensive, and your PC might not be able to do it, this is the perfect method to get started with the self-hosting.

Postgres

You need a postgres database configured locally to run this bot. If you haven't done that yet, take a look at the official documentation from EDB (The company behind postgres) here

Once your done, create the databases and users accordingly, and configure it in .env as said in the future steps.

  • Clone or fork the repository, whichever suits you better.
  • Install pipenv, a virtual env for python. Command: pip install pipenv
  • Create the virtual environment and prepare it for usage using pipenv update
  • Configure the environmental variables by renaming the .env.example file to .env with the respective values for it. If you're using heroku or other platforms that have option for external environmental variables, use that instead of .env
  • Configure the options and settings available in config.py inside the Bot module, according to your preferences.
  • Run the server using pipenv run start

Database migrations

We support database changes and migrations for the latest structures instead of dropping and recreating them. We use alembic, a sqlalchemy tool to perform the migrations for us.

Migration guide:

  • To do a migration, use this: alembic revision --autogenerate
  • To bring the migration into actual change: alembic upgrade head

NOTE: If you're using pipenv, go into the shell first using pipenv shell to use those commands.

Contributing

Contributions, issues and feature requests are welcome. After cloning & setting up project locally, you can just submit a PR to this repo and it will be deployed once it's accepted. The contributing file can be found here.

⚠️ It’s good to have descriptive commit messages, or PR titles so that other contributors can understand about your commit or the PR Created. Read conventional commits before making the commit message.

Show your support

We love people's support in growing and improving. Be sure to leave a ⭐️ if you like the project and also be sure to contribute, if you're interested!

Made by Sunrit Jana with <3