JavaBot — General Utility Bot for the JavaDiscord Community
To start up, run the bot once, and it will generate a config directory. Stop the bot, and set the up all of the following values:
- in
systems.jsonjdaBotTokento your bot's token- (some
adminUserswhich, e.g., can manipulate the database)
- in
{guildId}.jsonmoderation.logChannelIdto a channelIdmoderation.staffRoleIdto a roleIdmoderation.adminRoleIdto a roleIdjam.adminRoleIdto a roleId
Note that this is just what is required for the bot to start. Certain features may require other values to be set.
The bot's configuration consists of a collection of simple JSON files:
systems.jsoncontains global settings for the bot's core systems.- For every guild, a
{guildId}.jsonfile exists, which contains any guild-specific configuration settings.
At startup, the bot will initially start by loading just the global settings, and then when the Discord ready event is received, the bot will add configuration for each guild it's in, loading it from the matching JSON file, or creating a new file if needed.
We're using DIH4JDA as our Command/Interaction framework, which makes it quite easy to add new commands.
/**
* <h3>This class represents the /ping command.</h3>
*/
public class PingCommand extends SlashCommand {
/**
* The constructor of this class, which sets the corresponding {@link net.dv8tion.jda.api.interactions.commands.build.SlashCommandData}.
*/
public PingCommand() {
setSlashCommandData(Commands.slash("ping", "Shows the bot's gateway ping.")
.setGuildOnly(true)
);
}
@Override
public void execute(@NotNull SlashCommandInteractionEvent event) {
event.replyEmbeds(new EmbedBuilder()
.setAuthor(event.getJDA().getGatewayPing() + "ms", null, event.getJDA().getSelfUser().getAvatarUrl())
.setColor(Responses.Type.DEFAULT.getColor())
.build()
).queue();
}
}For more information on how this works, visit the DIH4JDA Wiki!
Inspiration we took from other communities:
- We designed our Help Channel System similar to the one on the Python Discord.
/move-conversationis heavily inspired by the Rust Programming Language Community Server
