BananaBot (BB for short) is a good little bot created to help make sure everyone has their daily banana on time. It provides a user-friendly admin page where an administrator can configure the bot's messages and banana time. It also features a home page with a timer that counts down to banana time.
BananaBot is designed to send a POST
request to a given endpoint, allowing it to work with many popular chat platforms (e.g. Slack) via incoming webhooks. The send_message()
function can be found in app/utilities/utilities.py and can be modified to suit your needs if required.
To get a local copy of BananaBot up and running follow the steps below.
Download and install Python v3.10.10
-
Clone the repository
git clone https://github.com/NickoOwen/bananabot.git
-
Install the requirements using
pip
pip install -r requirements.txt
-
From the
app
directory, run the following command to run the apppython3 -m uvicorn main:app
-
Set the
url
class variable in app/models/app_state.py to your webhook. (Note this is hard coded intentionally to avoid the potential for misuse) -
Go to the admin page at
hostname:port/admin
-
Login with the username
admin
and the password shown in the server logs -
Configure banana time and the announcements however you want
-
Click the switch to turn on BananaBot. BB is now active and will send the messages you configured at the set times
-
You can add, remove, and reconfigure BananaBot without needing to turn it off
BananaBot is intended to be deployed in a container, but can also be ran locally if desired (see Installation)
-
Install Docker on your target platform (https://www.docker.com/)
-
Build the BananaBot Docker image by running the following command
docker build -t bananabot .
- To run the BananaBot container built above, run the following command
docker run --name bananabot -p 8000:8000 -d bananabot
BananaBot has been a team effort since the very beginning and we absolutely love it when more people want to contribute. Any contributions you make are greatly appreciated.
If you have a suggestion that you think would improve BananaBot, please fork the repo and create a pull request. You can also simply open an issue with the tag enhancement
. Don't forget to give the project a star! Thanks again for your contribution!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/NewFeature
) - Commit your Changes (
git commit -m 'Add NewFeature'
) - Push to the Branch (
git push origin feature/NewFeature
) - Open a Pull Request
-
To utilise FastAPI's automatic change detection when developing, add the
--reload
flag to the command as shown belowpython3 -m uvicorn main:app --reload
-
To run the unit tests, run the following command from within the
app
directorypython3 -m pytest ./tests
Distributed under the MIT License. See LICENSE for more information.