-
-
Notifications
You must be signed in to change notification settings - Fork 89
Code in the cloud (codespaces)
This tutorial shows how to code and run the project in GitHubs cloud.
The service is completely free and allows you to get started in just a few seconds.
This approach is an alternative to setting the project up on your local machine, as explained in:
- Visit the landing page
- Click on
Code > Create codespace on develop
GitHub now automatically sets up your codespace. The codespace is essentially a virtual machine with everything installed and configured that you need to work with this project.
Mostly, it will install Java and Gradle for you, and a few other useful plugins and extensions.
This process takes about 2 minutes for the first time. Once the setup is done, it opens an instance of Visual Studio Code in your browser, with the project opened. You can now get started!
Before you can run the bot, you have to adjust the configuration file. Therefore, open the file application/config.json
.
By default, it will be filled with some example values and most of them are totally okay for now.
The most important setting you have to change is the bot token. This enables the code to connect to your private bot with which you can then interact from your private server.
You can find the token at the Discord Developer Portal.
See the following guide if you still have to create a server and a bot first:
Replace <your_token_here>
with your bot token; you can also adjust the other settings if you want.
Once done, you are good to go and can run the bot. Just enter gradle application:run
in your terminal.
On the first run, this might take around 3 minutes, because it will first have to download all dependencies, generate the database and compile the code.
Once the terminal reads [main] INFO org.togetherjava.tjbot.Application - Bot is ready
, you are done!
The bot is now running and connected to your server, hurray 🎉
You can now execute commands and see the bot do its magic:
If you prefer IntelliJ, and have a license, they offer a client called JetBrains Gateway.
While not being all-within your browser, it is essentially an IDE that you can install, which will just remote-connect to your codespace.
Once installed, you have to get the GitHub Codespaces plugin:
You can then login to your GitHub account and select your codespace:
The initial setup takes a few minutes, since it has to install IntelliJ on the codespace first.