A simple but beautiful API for your Discord and Slack server made to retrieve daily lunch alternatives at local restaurants.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
- Using Git, clone the repository to your local machine
- Import the project into your favourite IDE using the pom.xml file
- Build the project by running
mvn clean install
in the project's base directory - In your IDE, set up a profile for running the bot in your development environment by specifying the following properties
Main class: com.github.hannesknutsson.hungryboii.api.ApiApplication
Working directory: <wherever you placed the project>/HungryBoii/Api
Module classpath: Api
Main class: com.github.hannesknutsson.hungryboii.discord.Application
Program arguments: -t <your Discord bot API token>
Working directory: <wherever you placed the project>/HungryBoii/Discord/target/HungryBoii-distributable
Module classpath: Discord
After this, you should be ready to run and develop the bot in your IDE using the profile you created.
The software that is required to develop and deploy the project will be specified below. This will be split into two sections, one for development and one for deployment.
To develop this project you will require the following software:
- Your favourite Java IDE
- Java 17 JDK
- Maven (most recent versions should work, 3.6.1 is verified to work)
To deploy this project you will require the following software:
- Java 17 JRE
OR
- A Docker environment
There are some different ways of getting this project spinning on your machine.
- Clone and build the project, then run the result using Java
- Pull the Docker image from DockerHub and start it from there
- Build your own custom Docker image by customizing the project's Dockerfile
Using Git, clone the repository.
git clone https://github.com/hannesknutsson/HungryBoii.git
Enter the newly cloned project repository.
cd HungryBoii/Discord
Build the project from its sources.
mvn clean install
Extract the directory HungryBoii/Discord/target/HungryBoii-distributable
onto whatever machine you wish to install the project (or just do all these steps on the machine you wish to install to from the beginning).
On the machine you wish to install to, enter the HungryBoii-distributable directory and run the project.
cd Discord-distributable
java -jar HungryBoii-<whatever version we're at>.jar -t <your Discord bot API token>
Your discord bot should now be ready to receive commands.
In a Discord text chat where the bot has permissions to read messages, send messages and add reactions, send a message/command to test the bot:
!help
The bot should by now have replied to your command with a list of commands it responds to. Your bot is now installed and ready for use!
In an environment with Docker installed, run the following commands.
mkdir Discord
docker run --name HungryBoii -e TZ=Europe/Stockholm -d -v Discord/logs/:/Discord/logs/ -v Discord/conf/:/Discord/conf/ hannesknutsson/hungryboii:latest -t <your Discord bot API token>
These simple commands will pull the latest Docker image from DockerHub and run it as a daemon for you.
If you want to run a more stable version of the bot, swap out hannesknutsson/hungryboii:latest
to hannesknutsson/hungryboii:release-1.0
.
Change the time zone parameter to fit the time zone where it will be used. This enables the subscription feature to be in sync with its users.
Hannes Knutsson
Team Nature@Fortnox
- Tip of the feodora to anyone whose code was used through dependencies or just straight up copy+paste solutions from stackoverflow.