Getting started - GlaubeKeinemDev/JDA-Utilities GitHub Wiki
Maven Dependency:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.GlaubeKeinemDev</groupId>
<artifactId>JDA-Utilities</artifactId>
<version>1.0-FINAL-RELEASE</version>
<scope>compile</scope>
</dependency>
Gradle Dependency:
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.GlaubeKeinemDev:JDA-Utilities:1.0-FINAL-RELEASE'
}
To create a discord bot, just create a new instance of the DiscordBot class.
You can start to create a bot like this following example:
try {
final DiscordBot discordBot = new DiscordBot("MyTokenHere", OnlineStatus.ONLINE);
discordBot.start();
System.out.println("Bot successfully started");
} catch(Exception e) {
e.printStackTrace();
System.out.println("Error while starting the Bot");
}
discordBot.start()
returns an JDA instance. Every important Cacheflag and GatewayIntent is set automatically. You are able to add other GatewayIntents with DiscordBot#addCustomGateWayIntent()
. You can also add a custom CacheFlag use: DiscordBot#addCustomCacheFlag()
. It should be easy to understand but be sure to adjust the GatewayIntents/Cacheflags BEFORE calling the start()
function.
Additional Features:
- Setup the command core (You have to set a command invoke the core will only listen to commands with this invoke e.g. "!test"):
discordBot.setupCommandCore("!");
- Setup the logger (You have to set a prompt will be shown in the console like the picture below)
discordBot.setupLogger(System.getProperty("user.name") + "@DuncansBot $ ");
- Overwrite the embedbuilder (You have to create a class which extends the AbstractEmbedBuilder)
discordBot.setEmbedBuilder(new BotEmbedBuilder());
- Setup the file based database system, it is very easy just call the method below. Have a look at Databases and check out how to use it
discordBot.setupDataBases());
- Setup the menu system (only if you create and use the menus. Look at the menu tab. This function can only be called after the
start();
function got successfully called and there is a JDA instance
discordBot.useMenus());