Jambot

Development and selfhosting

Selfhosting as a server owner

If you're a server owner and are considering selfhosting keep in mind that we recommend using the bot that we host. The reason for this is that selfhosting only has minor upsides and that we don't offer support to selfhosters. We only recommend using this guide if you're a developer and know what you're doing.

Prerequisites

  • Install OpenJDK 21
  • Install Maven
  • Some kind of IDE (Intellij has some great support for Spring Boot)

Database

Our bot is using MariaDB by default. Make sure to get it installed on your local development machine. Download the server here to get started. Make sure you create a database called jambot when you first start the application. In order to start the application, insert the following into your application-local.properties file if this not exists already. Provide the right USERNAME and PASSWORD for your database server in both the JDBC driver as the Liquibase config.


Using another Database Server

You can use other database server while developing on Jambot. We have created different Maven profiles for MySQL and PostgreSQL to include the right dependencies. Note that the maintainers are using MariaDB for production and local development. Ensure that you are providing the right JDBC driver url to manage the connection with the database.

Getting API keys

In order to make the bot work you need to have some API keys to your add to your project. You can specify those in your own application-local.properties file. If this file does not exist, create it first by copying the content of the original file to your new local file. Make sure to run your Spring Boot project with the active profile local. Otherwise, the original application.properties will be used at the startup. With using the application-local.properties file, you make sure that keys are not getting pushed to GitHub.

Discord
  1. Go to the Discord Developers Portal
  2. Create a bot and enter your token into the config file under red.jambot.jda.token
Youtube
  1. Go to the Google Cloud Portal
  2. Create an application and enter your API key into the config file under red.jambot.youtube.token
Spotify
  1. Go to the Spotify Developer dashboard
  2. Create an app and enter both the ID and the secret into the config file under red.jambot.spotify.clientId and red.jambot.spotify.clientSecret
Discord User
  1. Go to your Discord App and right-click on your user account. Use the button Copy ID in the menu. If this option is not available, you need to enable developer settings in Discord. This setting can be found in Discord under Settings > Advanced > Developer Mode
  2. Fill your ID under the red.jambot.app.admin-user-id and your preferred secret text which can be used to update the Application Commands under red.jambot.app.update-commands-secret

Create a Discord Server

In order to test your bot you need to create a Discord Server. After you have created a server, you can add the bot with the OAuth2 > URL Generator. This will give you a URL which will invite your bot to your newly created server. The bot needs the following scopes to get it working:

  • bot
  • applications.commands

The bot also requires the following permissions to be set in the server:

  • Send Messages
  • Embed Links
  • Connect
  • Speak
  • Use Voice Activity

To set these permissions, follow these steps:

  1. Go to your Discord server and click on the server name at the top left.
  2. Select Server Settings from the dropdown menu.
  3. In the sidebar, click on Roles and then select the role assigned to your bot.
  4. Under the Permissions tab, enable the required permissions listed above.
  5. Save the changes by clicking the Save Changes button at the bottom.

Start your application

After the bot has entered the server, and you have started the application, you need to use your red.jambot.app.update-commands-secret in a private DM with your bot to update the / commands. Note: This will take a while. Application Commands are not immediately available. After a few minutes you should see all the available commands of the Jambot. If you do not see any commands pop up, please be sure that you provided the right red.jambot.app.admin-user-id and red.jambot.app.update-commands-secret. If you have added newly commands, make sure that they do comply with the JDA specifications. This mean not capital letters as input fields for example.

Done!

Happy coding :)