/bot-be-named

discord bot for puzzle hunts

Primary LanguagePythonMIT LicenseMIT

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 Bot-Be-Named to your server, please contact @kevslinger#9711 or @Soni#3662 on discord.

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

  • Message @kevslinger#9711 or @Soni#3662 on discord to get Bot invite link.

  • Use the Link and add the Bot to your discord server. Note that you need "Manage Server" permission to do that.

  • Use ~about to get a quick guide to the bot, and ~startup for all the commands that will come in very handy for you.

  • In case of any problems, message us on discord or open a new issue on Github

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

  • Admin for administrator commands
  • Archive for downloading channel/category/server contents into a Zip file
  • Channel Management for cloning, creating, and moving channels
  • Custom Command for making custom commands in different servers
  • Discord for discord utility commands (e.g. roles, stats)
  • Error Logging for printing error logs
  • Help is an updated help command which automatically pulls docstrings for ~help
  • Lion is the "Google Sheets-Discord" commands currently used in every Puzzle Hunt. Advanced version of Sheets and Solved modules.
  • Lookup for Searching the internet via google and wikipedia
  • Misc for misc. random (fun) commands
  • Role Management for managing roles and similar
  • Sheets for working with Google Sheets during puzzlehunts
  • Solved for marking Discord Channels as solved, backsolved, solvedish etc.
  • Time for finding the time anywhere in the world

Acknowledgements

Big thanks to Jonah Lawrence and his Professor Vector repo for much inspiration and code, specifically on the Channel Management, Error Logging, Help, and Solved 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 find me on discord, @kevslinger#9711 with any questions you may have!