Compare commits
No commits in common. "28ba2699a379800222af1a501946f710d0f4e3af" and "287343b5d3d3587f34e0bd572fc21e642c134f2a" have entirely different histories.
28ba2699a3
...
287343b5d3
5 changed files with 38 additions and 5 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -40,7 +40,7 @@ build/
|
||||||
|
|
||||||
### Other Stuff ###
|
### Other Stuff ###
|
||||||
config*.json
|
config*.json
|
||||||
!config.example.json
|
config.example.json
|
||||||
!**/resources/config.schema.json
|
!**/resources/config.schema.json
|
||||||
|
|
||||||
### why would this not be here already ###
|
### why would this not be here already ###
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"token": "CHANGEME"
|
|
||||||
}
|
|
|
@ -11,6 +11,8 @@ import java.nio.charset.StandardCharsets;
|
||||||
//You will need a valid config.json in the resources folder for this to work
|
//You will need a valid config.json in the resources folder for this to work
|
||||||
public class Config {
|
public class Config {
|
||||||
@SuppressWarnings("unused") private String token;
|
@SuppressWarnings("unused") private String token;
|
||||||
|
@SuppressWarnings("unused") private String prefix;
|
||||||
|
@SuppressWarnings("unused") private DBConfig mariadb;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the configuration object for this bot
|
* Returns the configuration object for this bot
|
||||||
|
@ -33,4 +35,29 @@ public class Config {
|
||||||
public String getToken() {
|
public String getToken() {
|
||||||
return token;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -5,6 +5,7 @@ import com.freya02.botcommands.api.Logging;
|
||||||
import net.dv8tion.jda.api.JDA;
|
import net.dv8tion.jda.api.JDA;
|
||||||
import net.dv8tion.jda.api.JDABuilder;
|
import net.dv8tion.jda.api.JDABuilder;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
|
import net.dv8tion.jda.api.requests.GatewayIntent;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -22,12 +23,14 @@ public class Doki {
|
||||||
public static JDA getJDA() {
|
public static JDA getJDA() {
|
||||||
return jda;
|
return jda;
|
||||||
}
|
}
|
||||||
|
public static String getPrefix() { return config.getPrefix(); }
|
||||||
|
|
||||||
public static void start() throws IOException, InterruptedException {
|
public static void start() throws IOException, InterruptedException {
|
||||||
config = Config.readConfig();
|
config = Config.readConfig();
|
||||||
|
|
||||||
final JDA jda = JDABuilder.createLight(config.getToken())
|
final JDA jda = JDABuilder.createLight(config.getToken())
|
||||||
.setActivity(Activity.customStatus("Banned from everywhere"))
|
.setActivity(Activity.customStatus("Banned from everywhere"))
|
||||||
|
.enableIntents(GatewayIntent.MESSAGE_CONTENT)
|
||||||
.build()
|
.build()
|
||||||
.awaitReady();
|
.awaitReady();
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"token": {
|
"token": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"prefix": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"token"
|
"token",
|
||||||
|
"prefix"
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Reference in a new issue