feat: more config

This commit is contained in:
TheClashFruit 2023-06-27 14:55:07 +02:00
parent 61b3eecc84
commit b33910a8ef
Signed by: TheClashFruit
GPG key ID: CF4A319B9A73290C
8 changed files with 45 additions and 3 deletions

View file

@ -2,6 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/YADMB.iml" filepath="$PROJECT_DIR$/.idea/modules/YADMB.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/YADMB.main.iml" filepath="$PROJECT_DIR$/.idea/modules/YADMB.main.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/YADMB.test.iml" filepath="$PROJECT_DIR$/.idea/modules/YADMB.test.iml" />
</modules>

View file

@ -1,9 +1,50 @@
package me.theclashfruit.yadmb.config;
import io.wispforest.owo.config.annotation.Config;
import io.wispforest.owo.config.annotation.Nest;
@Config(name = "yadmb", wrapperName = "MainConfig")
public class MainConfigModel {
public int schemaVersion = 1;
public String discordToken = "";
@Nest
public Discord discord = new Discord();
public static class Discord {
public String token = "";
public long channel = 0;
public long guild = 0;
}
@Nest
public Messages messages = new Messages();
public static class Messages {
@Nest
public MessagesDiscord discord = new MessagesDiscord();
public static class MessagesDiscord {
@Nest
public ChatMessage chatMessage = new ChatMessage();
public static class ChatMessage {
public String content = "${message}";
@Nest
public Webhook webhook = new Webhook();
public static class Webhook {
public Boolean enabled = true;
public String username = "${username}";
public String avatarUrl = "https://crafatar.com/avatars/${uuid}";
}
}
}
@Nest
public MessagesMinecraft minecraft = new MessagesMinecraft();
public static class MessagesMinecraft {
}
}
}

View file

@ -14,7 +14,7 @@ public class BotClient {
static JDA jda;
public static void createBotClient() throws InterruptedException {
if (YADMB.CONFIG.discordToken().equals("")) {
if (YADMB.CONFIG.discord.token().equals("")) {
YADMB.LOGGER.error("Unable to start due to missing discord token!");
return;
@ -27,7 +27,7 @@ public class BotClient {
}
jda = JDABuilder
.createDefault(YADMB.CONFIG.discordToken(), GatewayIntent.GUILD_MESSAGES, GatewayIntent.MESSAGE_CONTENT)
.createDefault(YADMB.CONFIG.discord.token(), GatewayIntent.GUILD_MESSAGES, GatewayIntent.MESSAGE_CONTENT)
.addEventListeners(new ReadyListener())
.addEventListeners(new MessageListener())
.setActivity(Activity.watching("server to start..."))