Made sure the bot starts properly and generates the configs
This commit is contained in:
@@ -18,16 +18,11 @@ public class Logger { //TODO make this log to a file
|
||||
private static final java.util.logging.Logger sql;
|
||||
|
||||
static {
|
||||
File logDir = new File(AltitudeBot.getInstance().getDataFolder() + File.pathSeparator + "logs");
|
||||
File logDir = new File(new File(AltitudeBot.getInstance().getDataFolder()).getParent() + File.separator + "logs");
|
||||
if (!logDir.exists())
|
||||
{
|
||||
try {
|
||||
if (!logDir.createNewFile() || !logDir.mkdir()) {
|
||||
System.out.println("UNABLE TO CREATE LOGGING DIRECTORY");
|
||||
System.exit(1);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
if (!logDir.mkdir()) {
|
||||
System.out.println("UNABLE TO CREATE LOGGING DIRECTORY");
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
@@ -44,11 +39,11 @@ public class Logger { //TODO make this log to a file
|
||||
String formattedTime = dateFormat.format(date.getTime());
|
||||
|
||||
try {
|
||||
info.addHandler(new FileHandler(logDir.getAbsolutePath() + File.pathSeparator +
|
||||
info.addHandler(new FileHandler(logDir.getAbsolutePath() + File.separator +
|
||||
formattedTime + "info.log"));
|
||||
error.addHandler(new FileHandler(logDir.getAbsolutePath() + File.pathSeparator +
|
||||
error.addHandler(new FileHandler(logDir.getAbsolutePath() + File.separator +
|
||||
formattedTime + "error.log"));
|
||||
sql.addHandler(new FileHandler(logDir.getAbsolutePath() + File.pathSeparator +
|
||||
sql.addHandler(new FileHandler(logDir.getAbsolutePath() + File.separator +
|
||||
formattedTime + "sql.log"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.dv8tion.jda.api.requests.RestAction;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -64,6 +65,15 @@ public class Util {
|
||||
return embedBuilder.build();
|
||||
}
|
||||
|
||||
public static MessageEmbed invalidSubcommand(String subcommandName) {
|
||||
return new EmbedBuilder()
|
||||
.setTitle(MessagesConfig.INVALID_SUBCOMMAND)
|
||||
.setDescription(Parser.parse(MessagesConfig.INVALID_SUBCOMMAND_DESC,
|
||||
Template.of("subcommand", subcommandName)))
|
||||
.setColor(Color.RED)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static void registerCommand(CommandManager commandManager, JDA jda, SlashCommandData slashCommandData, String commandName) {
|
||||
for (ScopeInfo info : commandManager.getActiveLocations(commandName)) {
|
||||
switch (info.getScope()) {
|
||||
|
||||
Reference in New Issue
Block a user