Skip to content

A project template that allows you to easily deploy a Discord4J bot

License

Notifications You must be signed in to change notification settings

Lelebees/railway-d4j-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Railway Discord4J (Maven / Spring) Template

This is a template for deploying Discord4J bots on Railway. It is based on the example Maven / Spring project from the example repository

Deploy on Railway

There are, also a few differences:

  • Java version 17
  • Discord4J version 3.2.3
  • Built-in guild command support
  • Environment variables supported through .env

Guild commands

In order to add a guild command, you can add a folder to src/main/resources/commands/guild/, which must be named with the ID of the guild you wish to register commands for. Inside that folder, you can put normal command.json files.

Setting up .env

It's quite normal to have a .env file in your project with all the environment variables that matter only for this project, so you can test locally. I've done most of the work for you. you can simply create a file (called .env) and place it in the root folder of your project (next to Dockerfile and pom.xml). You can then reference this variable in application.properties like a real environment variable, and reference the application.properties variable inside your code using the @Value-annotiation. You can find an example of this inside the Bot class.

Never commit the .env file to git!

More Help

You can find more help with using Discord4J and building Discord bots at the following resources:

Additionally, you can find help with using Railway at the following resources:

About

A project template that allows you to easily deploy a Discord4J bot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published