diff --git a/.gitignore b/.gitignore index 9b563a8..eaf8d5f 100644 --- a/.gitignore +++ b/.gitignore @@ -40,7 +40,7 @@ build/ ### Other Stuff ### config*.json -!config.example.json +config.example.json !**/resources/config.schema.json ### why would this not be here already ### diff --git a/config.example.json b/config.example.json deleted file mode 100644 index 7bc7b61..0000000 --- a/config.example.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "token": "CHANGEME" -} \ No newline at end of file diff --git a/src/main/java/net/hypr/doki/Config.java b/src/main/java/net/hypr/doki/Config.java index 7615f3b..28bcbf8 100644 --- a/src/main/java/net/hypr/doki/Config.java +++ b/src/main/java/net/hypr/doki/Config.java @@ -11,6 +11,8 @@ import java.nio.charset.StandardCharsets; //You will need a valid config.json in the resources folder for this to work public class Config { @SuppressWarnings("unused") private String token; + @SuppressWarnings("unused") private String prefix; + @SuppressWarnings("unused") private DBConfig mariadb; /** * Returns the configuration object for this bot @@ -33,4 +35,29 @@ public class Config { public String getToken() { return token; } + public String getPrefix() { return prefix; } + + public DBConfig getDbConfig() { + return mariadb; + } + + public static class DBConfig { + @SuppressWarnings("unused") private String host, user, password, database; + @SuppressWarnings("unused") private int portNumber; + + public String getHost() { return host; } + + public String getUser() { + return user; + } + + public String getPassword() { + return password; + } + + public String getDatabase() { return database; } + public int getPortNumber() { + return portNumber; + } + } } \ No newline at end of file diff --git a/src/main/java/net/hypr/doki/Doki.java b/src/main/java/net/hypr/doki/Doki.java index 299d19d..51971f1 100644 --- a/src/main/java/net/hypr/doki/Doki.java +++ b/src/main/java/net/hypr/doki/Doki.java @@ -5,6 +5,7 @@ import com.freya02.botcommands.api.Logging; import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.JDABuilder; import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.requests.GatewayIntent; import org.slf4j.Logger; import java.io.IOException; @@ -22,12 +23,14 @@ public class Doki { public static JDA getJDA() { return jda; } + public static String getPrefix() { return config.getPrefix(); } public static void start() throws IOException, InterruptedException { config = Config.readConfig(); final JDA jda = JDABuilder.createLight(config.getToken()) .setActivity(Activity.customStatus("Banned from everywhere")) + .enableIntents(GatewayIntent.MESSAGE_CONTENT) .build() .awaitReady(); diff --git a/src/main/resources/config.schema.json b/src/main/resources/config.schema.json index a5464fb..ffb185f 100644 --- a/src/main/resources/config.schema.json +++ b/src/main/resources/config.schema.json @@ -1,12 +1,18 @@ + + { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "token": { "type": "string" + }, + "prefix": { + "type": "string" } }, "required": [ - "token" + "token", + "prefix" ] } \ No newline at end of file