mirror of
https://github.com/Noratrieb/killua-bot.git
synced 2026-01-14 15:15:01 +01:00
config cleanup
This commit is contained in:
parent
0538b775b8
commit
def84de1dd
3 changed files with 8 additions and 46 deletions
|
|
@ -1,22 +1,15 @@
|
|||
package com.github.nilstrieb.cofig;
|
||||
|
||||
import com.github.nilstrieb.util.trivia.TriviaQuestionData;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
public class Config {
|
||||
public static String TOKEN;
|
||||
public static String PREFIX;
|
||||
public static String JSON_PATH;
|
||||
|
||||
public static final String NORMAL_PREFIX = "kil ";
|
||||
public static final String L_PREFIX = "k ";
|
||||
public static final String TOKEN = System.getenv("BOT_TOKEN");
|
||||
public static final String PREFIX = "kil ";
|
||||
public static final String JSON_PATH = System.getenv("KILLUA_JSON_PATH");
|
||||
|
||||
public static final String VERSION = "1.0.1";
|
||||
|
||||
|
|
@ -28,8 +21,6 @@ public class Config {
|
|||
public static final long KUKUROO_MOUNTAIN_ID = 799696420386504795L;
|
||||
public static final long TRIVIA_APPROVAL_CHANNEL_ID = 802244298774413312L;
|
||||
|
||||
private static final String JSON_PATH_INTELLIJ = "trivia_questions.json";
|
||||
|
||||
private static JDA jda;
|
||||
|
||||
public static void setJda(JDA jda) {
|
||||
|
|
@ -48,28 +39,4 @@ public class Config {
|
|||
.setFooter("KilluaBot");
|
||||
return builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 0 = normal
|
||||
* 1 = test
|
||||
*/
|
||||
public static void init(int level) {
|
||||
switch (level) {
|
||||
case 0 -> {
|
||||
PREFIX = NORMAL_PREFIX;
|
||||
TOKEN = Secrets.NORMAL_TOKEN;
|
||||
try {
|
||||
JSON_PATH = new File(TriviaQuestionData.class.getProtectionDomain().getCodeSource()
|
||||
.getLocation().toURI()).getPath().replaceAll("(.*\\\\).*?\\.jar", "$1") + "trivia_questions.json";
|
||||
} catch (URISyntaxException e) {
|
||||
throw new RuntimeException("Trivia questions not found", e);
|
||||
}
|
||||
}
|
||||
case 1 -> {
|
||||
PREFIX = L_PREFIX;
|
||||
TOKEN = Secrets.L_TOKEN;
|
||||
JSON_PATH = JSON_PATH_INTELLIJ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
package com.github.nilstrieb.cofig;
|
||||
|
||||
public class Secrets {
|
||||
public static String NORMAL_TOKEN = System.getenv("BOT_TOKEN");
|
||||
public static String L_TOKEN = System.getenv("LITTLE_BOT_TOKEN");
|
||||
}
|
||||
|
|
@ -1,14 +1,16 @@
|
|||
package com.github.nilstrieb.core;
|
||||
|
||||
import com.github.nilstrieb.cofig.Config;
|
||||
import com.github.nilstrieb.cofig.Secrets;
|
||||
import com.github.nilstrieb.commands.fun.*;
|
||||
import com.github.nilstrieb.commands.fun.trivia.TriviaCommand;
|
||||
import com.github.nilstrieb.commands.info.*;
|
||||
import com.github.nilstrieb.commands.info.EvalCommand;
|
||||
import com.github.nilstrieb.commands.info.HelpCommand;
|
||||
import com.github.nilstrieb.commands.info.InviteCommand;
|
||||
import com.github.nilstrieb.commands.info.ToukaCommand;
|
||||
import com.github.nilstrieb.commands.util.EmoteAddCommand;
|
||||
import com.github.nilstrieb.core.sections.ChannelMessageListener;
|
||||
import com.github.nilstrieb.core.command.CommandListener;
|
||||
import com.github.nilstrieb.core.reactions.ReactionEventListener;
|
||||
import com.github.nilstrieb.core.sections.ChannelMessageListener;
|
||||
import com.github.nilstrieb.listener.DMDebugListener;
|
||||
import com.github.nilstrieb.listener.StartUpListener;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
|
|
@ -24,7 +26,6 @@ import java.util.Scanner;
|
|||
public class Main {
|
||||
|
||||
public static void main(String[] args) throws LoginException {
|
||||
Config.init(0);
|
||||
JDABuilder builder = JDABuilder.createDefault(Config.TOKEN);
|
||||
builder.setCompression(Compression.ZLIB);
|
||||
builder.setActivity(Activity.watching("over Gon"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue