PuzzleTechHub / bot-be-named

MIT License
6 stars 4 forks source link
discord-bot google-sheets puzzle-hunt python3

BBN (Bot-Be-Named)

Code style: black License: MIT

What is Bot-Be-Named

A Discord bot that interoperates with Google Sheets to smoothen solving puzzle hunts.

If you would like to add our instance of Bot-Be-Named to your server, please see below.

Bot-Be-Named is currently set up with our own configurations and environment variables, so might have assumptions that don't work for you. Please contact us if you need a Bot invite link, or to set up your own fork/instance of the bot.

Inviting the Bot to your server

How to install your own instance

Prerequisites -

Note that you may use another Python installer (instead of Pip), Host (instead of Heroku) or Database (instead of Postgresql) but that will require you figuring out the required setup and configuation changes yourself.

While only the above are necessary to run the code on Heroku, some OSes might require additional installations to also run locally. For example, on Ubuntu, you need -

sudo apt-get install postgresql-client-common postgresql-client

Installation

We recommend using virtual environments to manage python packages for our repo. To clone the repo and install dependencies, run the following on the Command Line

#Clone the bot locally
git clone https://github.com/kevslinger/bot-be-named.git
cd bot-be-named
#Technically optional, but using virtualenv is usually a good idea
virtualenv venv -p=3.10 
#This installs all the python dependancies the bot needs
pip install -r requirements.txt && pre-commit install

The bot uses Heroku Postgres for storing data.

To run the bot locally, you will need a .env file which is used by python-dotenv to load ENV variables. Copy .env.template into .env with

cp .env.template .env

and fill in the blanks in order to get the bot running. You also need to set up the Postgresql database for the bot using Heroku's PostgresSQL add-on (To be finished). First install the add-on then set it up to attach your app to the Postgres. Now you can look at Heroku - Dashboard - Resources - Add Ons to look at the app on Heroku, and copy the URI given from Postgres add-on to the respective line in the .env file

Once you do all that, run

source venv/bin/activate
python bot.py

and the bot will run on the supplied discord token's account.

Hosting

Once you have the bot running and basic commands (like ~help) run properly, you can host it externally. Our instance of the bot is hosted on Heroku

Other useful things

If you have github + heroku, using Heroku's Github integration allows you to automatically push Github pushes to also deploy on Heroku. (Using git push to push to both Github and Heroku)

When deploying on heroku, any variables stored in .env locally cannot be pushed to any public repos. It's advisable to use Heroku Config Vars to store them.

Current Modules

Acknowledgements

The majority of this bot was written by TheOriginalSoni and Kevslinger, with significant contributions from Pete Cao for the Lion module.

There are multiple repositories and code that BBN borrowed code from, most notably Jonah Lawrence and his Professor Vector. Further info is included in respective modules.

Contributing/Issues

If you find any issues, bugs, or improvements, please feel free to open an issue and/or pull request! Thank you!

Feel free to join our discord at discord (dot) gg / x8f2ywHUky with any questions you may have! If you are unable to join the discord, contact TheOriginalSoni (@talesfromtim on discord).