-
-
Couldn't load subscription status.
- Fork 102
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) -
gradleinstalled (or any GUI or IDE plugin) - 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:
- in the Gradle view, right click the
runtask and hitModify run configuration... - in the
Runsection, enter the commandrun --args='<your_token_here> db/database.db'
2.1. replace<your_token_here>with your bot token
2.2. the second argument is the path to where you want to create the database at,db/database.dbis fine - select the run configuration you just created and click on the run button



- build a runnable jar of the project by executing
gradle shadowJar
1.1. the jar can now be found atTJ-Bot\application\build\libs - run
java -jar TJ-Bot.jar "<your_token_here>" "../../../build/database.db"
2.1. replace<your_token_here>with your bot token
2.2. the second argument is the path to where the database was generated at; by default this is atTJ-Bot\build\database.db, so you need../../../build/database.db


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









