-
-
Notifications
You must be signed in to change notification settings - Fork 101
Setup project locally
This tutorial shows how to download, setup and start the TJ-Bot project locally on your machine.
- latest version of Java installed
- your favorite Java IDE or text editor, e.g. IntelliJ or Eclipse
-
gitinstalled (or any GUI or IDE plugin) -
gradleavailable (or any GUI or IDE plugin), you can either install it or use our provided wrapper - your own Discord-Bot, tied to a server (see Create Discord server and bot)
- a token of that bot
- use git to download the project
- use gradle to download dependencies
- use gradle to build the project
- connect your bot to the program
- use gradle to start the bot
- interact with the bot from your server
First of all, you have to download the project to your machine. Visit the projects GitHub website and copy the .git link, which is this
https://github.com/Together-Java/TJ-Bot.git
IntelliJ comes by default with a git plugin. You can easily clone repositories to your disk by clicking a few buttons.
- open your IntelliJ and select
Get from VSC. - select
Git, enter the.gitlink and select a directory for the project; smack thatClonebutton - IntelliJ will now open the project

To download the project, use the following command:
git clone https://github.com/Together-Java/TJ-Bot.git TJ-BotYou now have the project and all its data locally.

Next up, you have to download all the dependencies, generate the database and build the project.
IntelliJ comes by default with a gradle plugin. If not started already automatically, you can command it to do all of above by clicking a bunch of buttons.
- open the Gradle view
- expand the view and click on
TJ-Bot > Tasks > build > build, or just click on the elephant icon and entergradle build


You can also just execute Gradle from the command line.
- open a command line in the root directory of the project
- execute
gradle build

Last but not least, you want to start the bot with your bot token and let it connect to your private bot with which you can interact from one of your servers.
For this step, you need to hold your bot token ready, you can find it at the Discord Developer Portal.
See the following guide if you still have to create a server and a bot first:
To run the bot, you will need a config.json file with content like this:
{
"token": "<your_token_here>",
"databasePath": "db/database.db",
"projectWebsite": "https://github.com/Together-Java/TJ-Bot",
"discordGuildInvite": "https://discord.com/invite/XXFUXzK"
}Replace <your_token_here> with your bot token; you can also adjust the other settings if you want.
- put the configuration file to
TJ-Bot\application\config.jsonor run the program with a single argument, the path to your config file - in the Gradle view, click the
runtask and start it
- build a runnable jar of the project by executing
gradle shadowJar
1.1. the jar can now be found atTJ-Bot\application\build\libs - unless you move the jar around, you have to adjust the database path in the config to
../../../build/database.db - put the configuration file right next to the jar or run the program with a single argument, the path to your config file
- run
java -jar TJ-Bot.jar

The bot is now running and connected to your server, hurray 🎉
You can now execute commands and see the bot do its magic:









