Skip to content

PuzzleTechHub/bot-be-named

Repository files navigation

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

  • Join the bot's discord server at discord (dot) gg / x8f2ywHUky

  • There is an instance of the bot currently on that server, named ~Bot Be Named. Click on that name - Add App - Add it 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
  • Custom Command for making custom commands in different servers
  • Discord for discord utility commands (e.g. roles, stats)
  • Discord Channel Management for cloning, creating, and moving channels
  • Discord Role Management for managing roles and similar
  • Error Logging for printing error logs
  • Help is an updated help command which automatically pulls docstrings for ~help
  • Hydra is the NEW AND IMPROVED "Google Sheets-Discord" commands. Currently Work in progress.
  • Lion is the "Google Sheets-Discord" commands currently used in every Puzzle Hunt.
  • Lookup for Searching the internet via google and wikipedia
  • Misc for misc. random (fun) commands
  • Sheets for working with Google Sheets during puzzlehunts
  • Time for finding the time anywhere in the world

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