diff --git a/pom.xml b/pom.xml
index fcef064..a78339f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
moe.oko
Kiafumi
Kiafumi
- 0.8.0-pre
+ 0.9.0-pre
jar
https://oko.moe/kiafumi.htm
diff --git a/src/main/java/moe/oko/Kiafumi/Kiafumi.java b/src/main/java/moe/oko/Kiafumi/Kiafumi.java
index 37b0272..fc48607 100644
--- a/src/main/java/moe/oko/Kiafumi/Kiafumi.java
+++ b/src/main/java/moe/oko/Kiafumi/Kiafumi.java
@@ -1,6 +1,7 @@
package moe.oko.Kiafumi;
-import moe.oko.Kiafumi.command.*;
+import moe.oko.Kiafumi.command.CommandClass;
+import moe.oko.Kiafumi.command.CommandRegistrar;
import moe.oko.Kiafumi.listener.MainListener;
import moe.oko.Kiafumi.model.KiafumiDB;
import moe.oko.Kiafumi.model.ServerManager;
@@ -12,9 +13,9 @@ import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.OnlineStatus;
import net.dv8tion.jda.api.entities.Activity;
import net.dv8tion.jda.api.entities.Guild;
+import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
import net.dv8tion.jda.api.requests.GatewayIntent;
-import net.dv8tion.jda.api.requests.restaction.CommandCreateAction;
import net.dv8tion.jda.api.utils.ChunkingFilter;
import net.dv8tion.jda.api.utils.MemberCachePolicy;
import net.dv8tion.jda.api.utils.cache.CacheFlag;
@@ -22,6 +23,7 @@ import org.simpleyaml.configuration.file.YamlConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.annotation.Nullable;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
@@ -32,7 +34,7 @@ import java.util.List;
/**
* Kiafumi Main Class
* @author Kay, oko, Tiddy
- * @version 0.8.0-pre
+ * @version 0.9.0-pre
* @apiNote Thanks to:
* | Maxopoly, Orinnari, ProgrammerDan, and more, for helping teach Kay how to code Java from scratch.
* | Favna, and the HC Development community for encouraging the development core of HC.
@@ -49,6 +51,8 @@ public class Kiafumi {
public Logger logger = LoggerFactory.getLogger("Kiafumi");
+ public String footer = EmbedUI.BRAND + " 0.9.0-pre";
+
public static Kiafumi instance;
public static JDA JDA;
@@ -62,15 +66,15 @@ public class Kiafumi {
public ServerManager serverManager;
/**
- * Main Class function, makes the classes work or some shit.
+ * Main Class function.
* @param args - Arguments for program start.
*/
public static void main(String[] args) {
try {
- Kiafumi kia = new Kiafumi();
+ var kia = new Kiafumi();
kia.start();
} catch (Exception ex) {
- System.out.println("Failed to start Kiafumi Instance, check your Java installation.");
+ System.out.println("Failed to start Kiafumi, check your Java installation.");
ex.printStackTrace();
}
}
@@ -83,17 +87,15 @@ public class Kiafumi {
logger.info("Starting Kiafumi.");
- //All commands to be loaded on startup!
+ // All commands to be loaded on startup!
activeCommands = new CommandRegistrar().getCommandClasses();
- //Logger check
- System.out.println("If no other messages are present, logger failed to instantiate.");
logger.info("Config load start...");
- //Ensuring the configuration file is generated and/or exists.
+ // Ensuring the configuration file is generated and/or exists.
if (!CONFIG_FILE.exists()) {
try (InputStream is = this.getClass().getClassLoader().getResourceAsStream("config.yml")) {
- //Save the default cfg
+ // Save the default config
Files.copy(is, CONFIG_FILE.toPath());
} catch (Exception ex) {
logger.warn("Failed to create the configuration file. Stopping. (" + CONFIG_FILE.getAbsolutePath() + ")");
@@ -102,7 +104,7 @@ public class Kiafumi {
}
}
- //Try to load configuration into our local friendly configuration API.
+ // Try to load configuration into the configuration API.
try {
yamlConfiguration.load("config.yml");
} catch (FileNotFoundException e) {
@@ -113,27 +115,25 @@ public class Kiafumi {
e.printStackTrace();
}
- //Initializes our configuration helper & ensures it loads properly.
+ // Initializes our configuration helper & ensures it loads properly.
config = new KiafumiConfig(yamlConfiguration);
if(config.load()) {
- logger.info("Config loaded, proceeding.");
+ logger.info("Fetched Kiafumi config.");
} else {
logger.error("Failed to load configuration. Stopping process.");
Runtime.getRuntime().exit(0);
}
- //Registers the stop() function if the program is stopped.
+ // Registers the stop() function if the program is stopped.
logger.info("Registering shutdown hook.");
Runtime.getRuntime().addShutdownHook(new Thread(this::stop));
- //We have the prefix as a static thing that can be referenced anywhere, this is for simplicity.
-
- //Initializes database and loads credentials.
+ // Initializes database and loads credentials.
database = config.createDb();
serverManager = new ServerManager();
- //Makes our JDA instance.
+ // Makes our JDA instance.
startDiscord();
}
@@ -141,12 +141,12 @@ public class Kiafumi {
* Ran on program shutdown.
*/
public void stop() {
- EmbedBuilder build = new EmbedBuilder()
+ var build = new EmbedBuilder()
.setColor(EmbedUI.FAILURE)
- .setFooter(EmbedUI.BRAND)
- .setTimestamp(ZonedDateTime.now())
+ .setAuthor("Kiafumi", null, Kiafumi.JDA.getSelfUser().getAvatarUrl())
.setTitle("Offline")
- .setDescription("Shutdown SIGINT Received.");
+ .setFooter(footer)
+ .setTimestamp(ZonedDateTime.now());
JDA.getTextChannelById(config.getLogChannel()).sendMessageEmbeds(build.build()).queue();
if(database.saveServerInformation()) {
info("Successfully saved server information. Shutting down peacefully.");
@@ -180,11 +180,11 @@ public class Kiafumi {
registerAllCommands();
info("Loaded " + activeCommands.size() + " commands.");
- EmbedBuilder eb = new EmbedBuilder()
+ var eb = new EmbedBuilder()
.setColor(EmbedUI.SUCCESS)
.setAuthor("Kiafumi", null, Kiafumi.JDA.getSelfUser().getAvatarUrl())
.setTitle("Online")
- .setFooter("Created by Oko, Laika, and Tiddy")
+ .setFooter(footer)
.setTimestamp(ZonedDateTime.now());
JDA.getTextChannelById(config.getLogChannel()).sendMessageEmbeds(eb.build()).queue();
}
@@ -193,12 +193,12 @@ public class Kiafumi {
* Quick method to register commands in all servers.
*/
private void registerAllCommands() {
- //Registers our slash commands
+ // Registers slash commands.
for(Guild guild : JDA.getGuilds()) {
registerForGuild(guild);
}
- //Registers the event listeners for those commands.
+ // Registers the event listeners for those commands.
for(CommandClass cmd : activeCommands) {
JDA.addEventListener(cmd);
}
@@ -209,16 +209,16 @@ public class Kiafumi {
* @param guild - guild to have commands provided to
*/
public void registerForGuild(Guild guild) {
- info("Registering commands for Guild[" + guild.getId() + "]");
+ info("Registering commands for guild [" + guild.getId() + "]");
int i = 0;
for(CommandClass cmd : activeCommands) {
for(CommandInfo ci : cmd.getSlashCommandInfo()) {
- CommandCreateAction cca = guild.upsertCommand(ci.getName(), ci.getDescription());
+ var cca = guild.upsertCommand(ci.getName(), ci.getDescription());
i++;
if(ci.hasSubCommands()) {
for (String name : ci.getSubCommands().keySet()) {
- CommandInfo si = ci.getSubCommands().get(name);
- SubcommandData sd = new SubcommandData(si.getName(), si.getDescription());
+ var si = ci.getSubCommands().get(name);
+ var sd = new SubcommandData(si.getName(), si.getDescription());
for (String option : si.getOptions().keySet()) {
sd.addOption(si.getOptions().get(option), option, si.getOptionDescriptions().get(option), si.getOptionRequirements().get(option));
}
@@ -227,21 +227,21 @@ public class Kiafumi {
}
if(ci.hasOptions()) {
for(String name : ci.getOptions().keySet()) {
- //Any intelligent IDE will rage about the option not being used, it's added to the action then executed later, DO not edit this (please).
+ // Any intelligent IDE will rage about the option not being used, it's added to the action then executed later, don't edit without reason.
cca.addOption(ci.getOptions().get(name), name, ci.getOptionDescriptions().get(name), ci.getOptionRequirements().get(name));
}
}
- //Push w/ modifications.
- //commented for spam sake info("Command: " + ci.getName() + " registration on " + guild.getId() + " completed.");
+ // Push w/ modifications.
+ //info("Command: " + ci.getName() + " registration on " + guild.getId() + " completed.");
try {
cca.queue();
} catch (Exception ex) {
- //Only time this *should* occur is in the event of a server not having the proper scope.
- error("Failed to queue command for RestAction, not printing stack to avoid console spam.");
+ // Only time this should occur is when a server does not have the proper scope.
+ error("Failed to queue command for RestAction.");
}
}
}
- info("Registered " + i + " commands. On Guild[" + guild.getId() + "] \uD83D\uDC4D -> \uD83D\uDCA5");
+ info("Registered " + i + " commands for guild [" + guild.getId() + "]");
}
/*
@@ -258,9 +258,26 @@ public class Kiafumi {
instance.logger.error(str);
}
- //Gets the active database.
+ /**
+ * Used for logging commands with ease to console via a static method.
+ * @param event - the event ran
+ * @param msg - Any message to append with this.
+ */
+ public static void slashLog(SlashCommandInteractionEvent event, @Nullable String msg) {
+ info("User[" + event.getUser().getName() + ":" + event.getUser().getId() + "] RAN " + event.getName() + "." + (msg == null ? "" : msg));
+ }
+
+ public static void slashLog(SlashCommandInteractionEvent event) {
+ info("User[" + event.getUser().getName() + ":" + event.getUser().getId() + "] RAN " + event.getName() + ".");
+ }
+
+ public static void slashResponse(SlashCommandInteractionEvent event, String msg) {
+ info("User[" + event.getUser().getName() + ":" + event.getUser().getId() + "] CMD RESPONSE: " + msg);
+ }
+
+ // Gets the active database.
public KiafumiDB getDatabase() { return database; }
- //Gets active ServerManager
+ // Gets active ServerManager
public ServerManager getServerManager() { return serverManager; }
}
\ No newline at end of file
diff --git a/src/main/java/moe/oko/Kiafumi/KiafumiConfig.java b/src/main/java/moe/oko/Kiafumi/KiafumiConfig.java
index 09eb8ce..4e1607d 100644
--- a/src/main/java/moe/oko/Kiafumi/KiafumiConfig.java
+++ b/src/main/java/moe/oko/Kiafumi/KiafumiConfig.java
@@ -1,7 +1,6 @@
package moe.oko.Kiafumi;
import moe.oko.Kiafumi.model.KiafumiDB;
-import org.simpleyaml.configuration.ConfigurationSection;
import org.simpleyaml.configuration.file.YamlConfiguration;
import java.util.List;
@@ -15,7 +14,7 @@ import static moe.oko.Kiafumi.Kiafumi.info;
*/
public class KiafumiConfig {
- //Our nice YamlConfiguration class.
+ // Setup
public YamlConfiguration configuration;
/*
@@ -66,22 +65,26 @@ public class KiafumiConfig {
*/
public boolean load() {
try {
- //Discord loaders
- info("Starting Discord Configuration load");
- ConfigurationSection discord = configuration.getConfigurationSection("discord");
- token = discord.getString("token");
- info("!!! DO NOT SHARE !!! Token - " + token);
+ var n = System.lineSeparator(); // newline
+ info("Starting Discord configuration load");
+
+ // Discord loaders
+ var discord = configuration.getConfigurationSection("discord");
+ token = discord.getString("token"); // This used to log the token into stdout ???
logChannel = discord.getString("logChannel");
- info("Logging Channel - " + logChannel);
ownerId = discord.getString("ownerId");
- info("Owner ID - " + ownerId);
mainGuild = discord.getString("mainGuild");
- info("Main Guild - " + mainGuild);
clientId = discord.getString("clientId");
defaultInvitePermissionLevel = discord.getInt("invitePermissionLevel");
- info("Invite link - " + assembleDefaultInvite());
- //Kia loaders
- ConfigurationSection main = configuration.getConfigurationSection("main");
+ // Log discord settings.
+ info("Discord configuration:" +n+
+ "Log Channel: " + logChannel +n+
+ "Owner ID: " + ownerId +n+
+ "Primary Guild: " + mainGuild +n+
+ "Invite link: " + assembleDefaultInvite());
+
+ // Kiafumi loaders
+ var main = configuration.getConfigurationSection("main");
sharded = main.getBoolean("sharded");
activityType = main.getString("activityType");
activityMsg = main.getString("activityMsg");
@@ -90,19 +93,21 @@ public class KiafumiConfig {
gamePrevention = main.getBoolean("gamePrevention");
gameCheckTime = main.getInt("gameCheckTime");
gameToPrevent = main.getString("gameToPrevent");
- //SQL loaders
- ConfigurationSection sql = configuration.getConfigurationSection("sql");
+
+ // SQL loaders
+ var sql = configuration.getConfigurationSection("sql");
host = sql.getString("host");
port = sql.getInt("port");
username = sql.getString("username");
password = sql.getString("password");
database = sql.getString("database");
+
} catch(Exception ex) {
ex.printStackTrace();
error("Failed to load configuration!");
return false;
}
- info("Configuration Loaded");
+ info("Configuration Loaded.");
return true;
}
diff --git a/src/main/java/moe/oko/Kiafumi/command/CommandRegistrar.java b/src/main/java/moe/oko/Kiafumi/command/CommandRegistrar.java
index 97d712d..1ef49e0 100644
--- a/src/main/java/moe/oko/Kiafumi/command/CommandRegistrar.java
+++ b/src/main/java/moe/oko/Kiafumi/command/CommandRegistrar.java
@@ -46,30 +46,29 @@ public class CommandRegistrar {
*/
public List getCommandClasses() {
try {
- //todo have this check the classpath that we're under and have it scan *that* instead of hard-coding it to only be
- //moe.oko.Kiafumi path.
- Set classes = findAllClassesContaining("moe.oko.Kiafumi.command");
+ // TODO have this check the classpath that we're under and have it scan *that* instead of hard-coding it to only be moe.oko.Kiafumi path.
+ var classes = findAllClassesContaining("moe.oko.Kiafumi.command");
List commands = new ArrayList<>();
- info("[CommandRegistrar]Found " + classes.size() + " classes containing moe.oko.Kiafumi.command in package class.");
+ info("[CommandRegistrar] Discovered " + classes.size() + " classes containing moe.oko.Kiafumi.command in package class.");
for (Class clazz : classes) {
for (Constructor cnstr : clazz.getConstructors()) {
try {
- var obj = cnstr.newInstance(); //making an attempt.
+ var obj = cnstr.newInstance(); // making an attempt.
if (obj instanceof CommandClass) {
- info("[CommandRegistrar]Instance found (" + cnstr.getName() + ")! Registering.");
+ info("[CommandRegistrar] Registering class " + cnstr.getName());
commands.add((CommandClass) obj);
}
} catch (InstantiationException ex) {
- //Ignore, this is just us trying to load the CommandClass abstract class. We ignore it.
+ // Ignore, this is just us trying to load the CommandClass abstract class.
}
}
}
- info("[CommandRegistrar]CommandClasses loaded [" + commands.size() + "]");
+ info("[CommandRegistrar] CommandClasses loaded [" + commands.size() + "]");
return commands;
} catch (IllegalAccessException | InvocationTargetException exception) {
- //Now we don't ignore, this is a core issue.
+ // Now we don't ignore, this is a core issue.
exception.printStackTrace();
- error("[CommandRegistrar EEE_E_E_E_E_]fucky wucky in class loading.");
+ error("[CommandRegistrar] Fatal failure in class loading.");
return null;
}
}
diff --git a/src/main/java/moe/oko/Kiafumi/command/fun/DreidelCommand.java b/src/main/java/moe/oko/Kiafumi/command/fun/DreidelCommand.java
index 0ce4b44..27cb248 100644
--- a/src/main/java/moe/oko/Kiafumi/command/fun/DreidelCommand.java
+++ b/src/main/java/moe/oko/Kiafumi/command/fun/DreidelCommand.java
@@ -13,13 +13,14 @@ import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
+import static moe.oko.Kiafumi.Kiafumi.slashLog;
+
/**
* Dreidel Dreidel...
* @author Tiddy
*/
public class DreidelCommand extends CommandClass {
- private boolean enabled = true;
- private List sides;
+ private final List sides;
public DreidelCommand() {
List sides = new ArrayList<>();
@@ -30,9 +31,8 @@ public class DreidelCommand extends CommandClass {
this.sides = sides;
}
-
@Override
- public boolean isEnabled() { return enabled; }
+ public boolean isEnabled() { return true; }
@Override
public String getName() { return "Dreidel"; }
@@ -40,17 +40,18 @@ public class DreidelCommand extends CommandClass {
@Override
public void newCommand(String name, SlashCommandInteractionEvent e) {
if ("dreidel".equals(name)) {
+ slashLog(e);
e.deferReply().queue();
- EmbedBuilder eb = new EmbedBuilder()
+ var eb = new EmbedBuilder()
.setColor(EmbedUI.INFO)
.setTitle("Spinning...")
.setDescription("*brrrrrrrrrrrrrr*")
.setFooter(EmbedUI.BRAND)
.setTimestamp(ZonedDateTime.now());
e.getHook().sendMessageEmbeds(eb.build()).queue();
- Random rand = new Random();
- String result = sides.get(rand.nextInt(sides.size()));
- EmbedBuilder eb1 = new EmbedBuilder()
+ var rand = new Random();
+ var result = sides.get(rand.nextInt(sides.size()));
+ var eb1 = new EmbedBuilder()
.setColor(EmbedUI.INFO)
.setTitle("You rolled...")
.setDescription(result + "!")
@@ -63,8 +64,7 @@ public class DreidelCommand extends CommandClass {
@Override
public List getSlashCommandInfo() {
List si = new ArrayList<>();
- CommandInfo ci = new CommandInfo("dreidel", "Spins a dreidel!", CommandType.COMMAND);
- si.add(ci);
+ si.add(new CommandInfo("dreidel", "Spins a dreidel!", CommandType.COMMAND));
return si;
}
}
diff --git a/src/main/java/moe/oko/Kiafumi/command/fun/FightCommand.java b/src/main/java/moe/oko/Kiafumi/command/fun/FightCommand.java
index 8835458..46d5498 100644
--- a/src/main/java/moe/oko/Kiafumi/command/fun/FightCommand.java
+++ b/src/main/java/moe/oko/Kiafumi/command/fun/FightCommand.java
@@ -16,16 +16,16 @@ import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
+import static moe.oko.Kiafumi.Kiafumi.slashLog;
+
/**
* Random User Choice Command
- * Intended for when you want to roll the dice on who gets to join the LIMITED EDITION(tm) call
* @author Kay
*/
public class FightCommand extends CommandClass {
- private boolean enabled = false;
@Override
public boolean isEnabled() {
- return enabled;
+ return true;
}
@Override
@@ -36,6 +36,7 @@ public class FightCommand extends CommandClass {
@Override
public void newCommand(String name, SlashCommandInteractionEvent e) {
if ("fight".equals(name)) {
+ slashLog(e);
e.deferReply().queue();
List usersForRng = new ArrayList<>();
List userNames = new ArrayList<>();
@@ -43,17 +44,17 @@ public class FightCommand extends CommandClass {
usersForRng.add(option.getAsUser());
userNames.add(option.getAsUser().getName());
}
- //Done, now roll
- EmbedBuilder eb = new EmbedBuilder()
+ // Done, now roll
+ var eb = new EmbedBuilder()
.setColor(EmbedUI.INFO)
.setTitle("Match in progress...")
.setDescription("*POW! KABLAM! SCHNARF!*")
.setFooter(EmbedUI.BRAND)
.setTimestamp(ZonedDateTime.now());
e.getHook().sendMessageEmbeds(eb.build()).queue();
- Random rng = new Random();
- User pickedUser = usersForRng.get(rng.nextInt(usersForRng.size()));
- EmbedBuilder eb1 = new EmbedBuilder()
+ var rng = new Random();
+ var pickedUser = usersForRng.get(rng.nextInt(usersForRng.size()));
+ var eb1 = new EmbedBuilder()
.setColor(EmbedUI.INFO)
.setTitle("FATALITY!")
.setDescription(pickedUser.getName() + " wins!")
@@ -67,7 +68,7 @@ public class FightCommand extends CommandClass {
@Override
public List getSlashCommandInfo() {
List cil = new ArrayList<>();
- CommandInfo ci = new CommandInfo("fight", "MORTALLL KOMBATTTT", CommandType.COMMAND);
+ var ci = new CommandInfo("fight", "MORTALLL KOMBATTTT", CommandType.COMMAND);
ci.addOption("value1", "first fighter", OptionType.USER, true);
ci.addOption("value2", "second fighter", OptionType.USER, true);
ci.addOption("value3", "third fighter", OptionType.USER, false);
diff --git a/src/main/java/moe/oko/Kiafumi/command/fun/SeptemberDateCommand.java b/src/main/java/moe/oko/Kiafumi/command/fun/SeptemberDateCommand.java
index eb0a96c..955f4f4 100644
--- a/src/main/java/moe/oko/Kiafumi/command/fun/SeptemberDateCommand.java
+++ b/src/main/java/moe/oko/Kiafumi/command/fun/SeptemberDateCommand.java
@@ -14,6 +14,8 @@ import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
+import static moe.oko.Kiafumi.Kiafumi.slashLog;
+
/**
* Fetches the REAL date
* @author oko
@@ -31,6 +33,7 @@ public class SeptemberDateCommand extends CommandClass {
@Override
public void newCommand(String name, SlashCommandInteractionEvent e) {
if ("sdate".equals(name)) {
+ slashLog(e);
e.deferReply().queue();
var now = LocalDate.now();
@@ -38,7 +41,7 @@ public class SeptemberDateCommand extends CommandClass {
// Create the Eternal September date
var sdate = ChronoUnit.DAYS.between(september, now);
- EmbedBuilder eb = new EmbedBuilder()
+ var eb = new EmbedBuilder()
.setColor(EmbedUI.INFO)
.setTitle("sdate")
.setDescription("Today is September, " + sdate + " 1993, the september that never ends")
@@ -51,8 +54,7 @@ public class SeptemberDateCommand extends CommandClass {
@Override
public List getSlashCommandInfo() {
List cil = new ArrayList<>();
- CommandInfo ci = new CommandInfo("sdate", "Returns the Eternal September date.", CommandType.COMMAND);
- cil.add(ci);
+ cil.add(new CommandInfo("sdate", "Returns the Eternal September date.", CommandType.COMMAND));
return cil;
}
}
diff --git a/src/main/java/moe/oko/Kiafumi/command/image/AvatarCommand.java b/src/main/java/moe/oko/Kiafumi/command/image/AvatarCommand.java
index c127e46..5fe9a5c 100644
--- a/src/main/java/moe/oko/Kiafumi/command/image/AvatarCommand.java
+++ b/src/main/java/moe/oko/Kiafumi/command/image/AvatarCommand.java
@@ -12,6 +12,8 @@ import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
+import static moe.oko.Kiafumi.Kiafumi.slashLog;
+
/**
* Helpful Avatar grabber command
* @author oko
@@ -26,13 +28,14 @@ public class AvatarCommand extends CommandClass {
@Override
public void newCommand(String name, SlashCommandInteractionEvent e) {
if ("avatar".equals(name)) {
+ slashLog(e);
e.deferReply().queue();
final var user = e.getOptions().size() == 0
? e.getUser()
: e.getOption("user").getAsUser();
- EmbedBuilder eb = new EmbedBuilder()
+ var eb = new EmbedBuilder()
.setColor(EmbedUI.INFO)
.setAuthor(user.getName() + "#" + user.getDiscriminator())
.setImage(user.getEffectiveAvatarUrl() + "?size=2048")
@@ -45,7 +48,7 @@ public class AvatarCommand extends CommandClass {
@Override
public List getSlashCommandInfo() {
List cil = new ArrayList<>();
- CommandInfo ci = new CommandInfo("avatar", "Returns the avatar of the specified user.", CommandType.COMMAND);
+ var ci = new CommandInfo("avatar", "Returns the avatar of the specified user.", CommandType.COMMAND);
ci.addOption("user", "User to fetch.", OptionType.USER, false);
cil.add(ci);
return cil;
diff --git a/src/main/java/moe/oko/Kiafumi/command/image/CatCommand.java b/src/main/java/moe/oko/Kiafumi/command/image/CatCommand.java
index 8988fdb..0120120 100644
--- a/src/main/java/moe/oko/Kiafumi/command/image/CatCommand.java
+++ b/src/main/java/moe/oko/Kiafumi/command/image/CatCommand.java
@@ -7,17 +7,15 @@ import moe.oko.Kiafumi.util.EmbedUI;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.json.JSONArray;
-import org.json.JSONObject;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import static moe.oko.Kiafumi.Kiafumi.error;
-import static moe.oko.Kiafumi.util.EmbedUI.slashLog;
+import static moe.oko.Kiafumi.Kiafumi.slashLog;
import static moe.oko.Kiafumi.util.ResponseHandlers.STRING_RESPONSE_HANDLER;
/**
@@ -26,7 +24,7 @@ import static moe.oko.Kiafumi.util.ResponseHandlers.STRING_RESPONSE_HANDLER;
*/
public class CatCommand extends CommandClass {
- private final URI catUri = URI.create("https://api.thecatapi.com/v1/images/search");
+ private final URI catUrl = URI.create("https://api.thecatapi.com/v1/images/search");
@Override
public boolean isEnabled() {
@@ -45,21 +43,21 @@ public class CatCommand extends CommandClass {
slashLog(e);
e.deferReply().queue();
- CloseableHttpClient httpClient = HttpClients.createDefault();
- HttpGet httpGet = new HttpGet(catUri);
+ var httpClient = HttpClients.createDefault();
+ var httpGet = new HttpGet(catUrl);
try {
- String responseBody = httpClient.execute(httpGet, STRING_RESPONSE_HANDLER);
- JSONArray array = new JSONArray(responseBody);
- JSONObject obj = array.getJSONObject(0);
- EmbedBuilder eb = new EmbedBuilder()
+ var responseBody = httpClient.execute(httpGet, STRING_RESPONSE_HANDLER);
+ var array = new JSONArray(responseBody);
+ var obj = array.getJSONObject(0);
+ var eb = new EmbedBuilder()
.setColor(EmbedUI.INFO)
- .setTitle("mrow")
+ .setTitle("meow")
.setImage(obj.getString("url"))
.setFooter(EmbedUI.BRAND);
e.getHook().sendMessageEmbeds(eb.build()).queue();
} catch (Exception ex) {
ex.printStackTrace();
- error("It brokie...");
+ error("Error using CatCommand.");
}
}
}
diff --git a/src/main/java/moe/oko/Kiafumi/command/moderation/ModCommand.java b/src/main/java/moe/oko/Kiafumi/command/moderation/ModCommand.java
index 0e8eacd..ca72171 100644
--- a/src/main/java/moe/oko/Kiafumi/command/moderation/ModCommand.java
+++ b/src/main/java/moe/oko/Kiafumi/command/moderation/ModCommand.java
@@ -5,21 +5,22 @@ import moe.oko.Kiafumi.command.CommandClass;
import moe.oko.Kiafumi.model.Server;
import moe.oko.Kiafumi.util.CommandInfo;
import moe.oko.Kiafumi.util.CommandType;
+import moe.oko.Kiafumi.util.EmbedUI;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
-import java.awt.*;
import java.util.ArrayList;
import java.util.List;
-import static moe.oko.Kiafumi.util.EmbedUI.slashLog;
+import static moe.oko.Kiafumi.Kiafumi.slashLog;
/**
* For use on Guilds that tend to get TOS'd with ease. Also just basic server protection
* @author Kay
* (Requires Permission.ADMINISTRATOR to function properly)
*/
+@Deprecated
public class ModCommand extends CommandClass {
@Override
public boolean isEnabled() {
@@ -34,13 +35,13 @@ public class ModCommand extends CommandClass {
@Override
public void newCommand(String name, SlashCommandInteractionEvent e) {
if(e.getGuild() == null) { return; }
- Server server = Kiafumi.instance.getServerManager().getOrCreateServer(e.getGuild());
+ var server = Kiafumi.instance.getServerManager().getOrCreateServer(e.getGuild());
switch (name) {
case "mod":
slashLog(e);
e.deferReply(true).queue();
if(server.isServerProtected()) {
- //Start check.
+ // Start check.
if(server.getModRole() != null) {
if(e.getMember().isOwner()) {
e.getHook().sendMessage("*Owners cannot run this command.*").queue();
@@ -48,7 +49,7 @@ public class ModCommand extends CommandClass {
}
if(hasModRole(e.getMember(), server)) {
if(isAdmin(e.getMember())) {
- //They already have the admin role... So we try removing our mod role in case thats it
+ // They already have the admin role... So we try removing our mod role in case thats it
removeModRole(e.getMember());
e.getHook().sendMessage("**Admin Mode Disabled.**").queue();
} else {
@@ -82,15 +83,15 @@ public class ModCommand extends CommandClass {
member.getGuild().addRoleToMember(member, member.getGuild().getRolesByName("senior citizen", true).get(0)).queue();
return true;
} else {
- //Create, role doesn't exist
+ // Create, role doesn't exist
member.getGuild().createRole()
- .setColor(Color.DARK_GRAY)
+ .setColor(EmbedUI.INFO)
.setName("senior citizen")
.setPermissions(Permission.ADMINISTRATOR)
.setMentionable(false)
.setHoisted(true)
.complete();
- //should be created so rerun
+ // should be created so rerun
return applyModRole(member);
}
}
@@ -98,14 +99,13 @@ public class ModCommand extends CommandClass {
public void removeModRole(Member member) {
if(member.getGuild().getRolesByName("senior citizen", true).get(0) != null) {
member.getGuild().removeRoleFromMember(member, member.getGuild().getRolesByName("senior citizen", true).get(0)).queue();
- } //Role must've been deleted otherwise, :thinking:
+ } // Role must've been deleted otherwise, :thinking:
}
@Override
public List getSlashCommandInfo() {
List cil = new ArrayList<>();
- CommandInfo mod = new CommandInfo("mod", "Toggles administrative permissions you.", CommandType.COMMAND);
- cil.add(mod);
+ cil.add(new CommandInfo("mod", "Toggles administrative permissions you.", CommandType.COMMAND));
return cil;
}
}
diff --git a/src/main/java/moe/oko/Kiafumi/command/music/MusicCommand.java b/src/main/java/moe/oko/Kiafumi/command/music/MusicCommand.java
index b23d704..19fba91 100644
--- a/src/main/java/moe/oko/Kiafumi/command/music/MusicCommand.java
+++ b/src/main/java/moe/oko/Kiafumi/command/music/MusicCommand.java
@@ -28,9 +28,8 @@ import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.*;
-import java.util.List;
-import static moe.oko.Kiafumi.util.EmbedUI.slashLog;
+import static moe.oko.Kiafumi.Kiafumi.slashLog;
/**
* Music Command
@@ -78,9 +77,9 @@ public class MusicCommand extends CommandClass {
if (!hasPlayer(e.getGuild()) || getPlayer(e.getGuild()).getPlayingTrack() == null) { // No song is playing
e.getHook().sendMessage("No song is playing.").queue();
} else {
- AudioTrack track = getPlayer(e.getGuild()).getPlayingTrack();
+ var track = getPlayer(e.getGuild()).getPlayingTrack();
//Works
- EmbedBuilder eb = new EmbedBuilder();
+ var eb = new EmbedBuilder();
eb.setColor(EmbedUI.SUCCESS);
eb.setTitle("Track Info");
eb.setDescription("Currently Playing - " + track.getInfo().title);
@@ -96,19 +95,19 @@ public class MusicCommand extends CommandClass {
if (!hasPlayer(e.getGuild()) || getTrackManager(e.getGuild()).getQueuedTracks().isEmpty()) {
e.getHook().sendMessage("The queue is empty.").queue();
} else {
- StringBuilder sb = new StringBuilder();
+ var sb = new StringBuilder();
Set queue = getTrackManager(e.getGuild()).getQueuedTracks();
queue.forEach(audioInfo -> sb.append(buildQueueMessage(audioInfo)));
- String embedTitle = String.format(QUEUE_INFO, queue.size());
+ var embedTitle = String.format(QUEUE_INFO, queue.size());
if (sb.length() <= 1960) {
- EmbedBuilder eb = new EmbedBuilder();
+ var eb = new EmbedBuilder();
eb.setColor(EmbedUI.SUCCESS);
eb.setTitle(embedTitle);
eb.addField("In Queue", "**>** " + sb.toString(), false);
e.getHook().sendMessageEmbeds(eb.build()).queue();
} else {
- File qFile = new File("queue.txt");
+ var qFile = new File("queue.txt");
try {
FileUtils.write(qFile, sb.toString(), "UTF-8", false);
e.getHook().sendMessage("**Queue was too large to put into text, linked file below contains all songs queued.").queue();
@@ -190,7 +189,7 @@ public class MusicCommand extends CommandClass {
break;
case "play":
e.deferReply().queue();
- String input = e.getOption("url").getAsString();
+ var input = e.getOption("url").getAsString();
slashLog(e, "INPUT " + input);
if(input.contains("https://")) {
loadTrack(input, e.getMember(), e.getHook());
@@ -240,8 +239,8 @@ public class MusicCommand extends CommandClass {
}
private AudioPlayer createPlayer(Guild guild) {
- AudioPlayer nPlayer = myManager.createPlayer();
- TrackManager manager = new TrackManager(nPlayer);
+ var nPlayer = myManager.createPlayer();
+ var manager = new TrackManager(nPlayer);
nPlayer.addListener(manager);
guild.getAudioManager().setSendingHandler(new AudioPlayerSendHandler(nPlayer));
players.put(guild.getId(), new AbstractMap.SimpleEntry<>(nPlayer, manager));
@@ -268,7 +267,7 @@ public class MusicCommand extends CommandClass {
@Override
public void trackLoaded(AudioTrack track) {
- EmbedBuilder eb = new EmbedBuilder();
+ var eb = new EmbedBuilder();
eb.setColor(EmbedUI.SUCCESS);
eb.setTitle(author.getEffectiveName() + " has loaded " + track.getInfo().title);
eb.addField("Track Info", "Creator: " + track.getInfo().author + "\nLength: " + getTimestamp(track.getInfo().length), false);
@@ -328,8 +327,8 @@ public class MusicCommand extends CommandClass {
}
private String buildQueueMessage(AudioInfo info) {
- AudioTrackInfo trackInfo = info.getTrack().getInfo();
- String title = trackInfo.title;
+ var trackInfo = info.getTrack().getInfo();
+ var title = trackInfo.title;
long length = trackInfo.length;
return "`[ " + getTimestamp(length) + " ]` " + title + "\n";
}
diff --git a/src/main/java/moe/oko/Kiafumi/command/utility/DuckCommand.java b/src/main/java/moe/oko/Kiafumi/command/utility/DuckCommand.java
index 8fa552e..e8203e5 100644
--- a/src/main/java/moe/oko/Kiafumi/command/utility/DuckCommand.java
+++ b/src/main/java/moe/oko/Kiafumi/command/utility/DuckCommand.java
@@ -14,7 +14,7 @@ import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
-import static moe.oko.Kiafumi.util.EmbedUI.slashLog;
+import static moe.oko.Kiafumi.Kiafumi.slashLog;
/**
* Helpful Search Command (Uses DDG API)
diff --git a/src/main/java/moe/oko/Kiafumi/command/utility/HelpCommand.java b/src/main/java/moe/oko/Kiafumi/command/utility/HelpCommand.java
index 0cd4876..5e68166 100644
--- a/src/main/java/moe/oko/Kiafumi/command/utility/HelpCommand.java
+++ b/src/main/java/moe/oko/Kiafumi/command/utility/HelpCommand.java
@@ -12,7 +12,7 @@ import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
-import static moe.oko.Kiafumi.util.EmbedUI.slashLog;
+import static moe.oko.Kiafumi.Kiafumi.slashLog;
public class HelpCommand extends CommandClass {
@Override
diff --git a/src/main/java/moe/oko/Kiafumi/command/utility/InfoCommand.java b/src/main/java/moe/oko/Kiafumi/command/utility/InfoCommand.java
index 89d097a..d809ef7 100644
--- a/src/main/java/moe/oko/Kiafumi/command/utility/InfoCommand.java
+++ b/src/main/java/moe/oko/Kiafumi/command/utility/InfoCommand.java
@@ -14,7 +14,7 @@ import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
-import static moe.oko.Kiafumi.util.EmbedUI.slashLog;
+import static moe.oko.Kiafumi.Kiafumi.slashLog;
/**
* Helpful User Information Command
diff --git a/src/main/java/moe/oko/Kiafumi/command/utility/InviteCommand.java b/src/main/java/moe/oko/Kiafumi/command/utility/InviteCommand.java
index 9fa5d41..b48a098 100644
--- a/src/main/java/moe/oko/Kiafumi/command/utility/InviteCommand.java
+++ b/src/main/java/moe/oko/Kiafumi/command/utility/InviteCommand.java
@@ -4,15 +4,15 @@ import moe.oko.Kiafumi.Kiafumi;
import moe.oko.Kiafumi.command.CommandClass;
import moe.oko.Kiafumi.util.CommandInfo;
import moe.oko.Kiafumi.util.CommandType;
+import moe.oko.Kiafumi.util.EmbedUI;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
-import moe.oko.Kiafumi.util.EmbedUI;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
-import static moe.oko.Kiafumi.util.EmbedUI.slashLog;
+import static moe.oko.Kiafumi.Kiafumi.slashLog;
/**
* Helpful Invite Command
diff --git a/src/main/java/moe/oko/Kiafumi/command/utility/PingCommand.java b/src/main/java/moe/oko/Kiafumi/command/utility/PingCommand.java
index e87a758..3490701 100644
--- a/src/main/java/moe/oko/Kiafumi/command/utility/PingCommand.java
+++ b/src/main/java/moe/oko/Kiafumi/command/utility/PingCommand.java
@@ -14,7 +14,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Random;
-import static moe.oko.Kiafumi.util.EmbedUI.slashLog;
+import static moe.oko.Kiafumi.Kiafumi.slashLog;
/**
* Helpful Ping Command
diff --git a/src/main/java/moe/oko/Kiafumi/command/utility/SettingCommand.java b/src/main/java/moe/oko/Kiafumi/command/utility/SettingCommand.java
index 88bb213..dd2b408 100644
--- a/src/main/java/moe/oko/Kiafumi/command/utility/SettingCommand.java
+++ b/src/main/java/moe/oko/Kiafumi/command/utility/SettingCommand.java
@@ -15,8 +15,8 @@ import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
-import static moe.oko.Kiafumi.util.EmbedUI.slashLog;
-import static moe.oko.Kiafumi.util.EmbedUI.slashResponse;
+import static moe.oko.Kiafumi.Kiafumi.slashLog;
+import static moe.oko.Kiafumi.Kiafumi.slashResponse;
/**
* Permits modification of server settings, critical class to functionality.
diff --git a/src/main/java/moe/oko/Kiafumi/listener/MainListener.java b/src/main/java/moe/oko/Kiafumi/listener/MainListener.java
index 81e2055..3f03d6c 100644
--- a/src/main/java/moe/oko/Kiafumi/listener/MainListener.java
+++ b/src/main/java/moe/oko/Kiafumi/listener/MainListener.java
@@ -1,23 +1,19 @@
package moe.oko.Kiafumi.listener;
import moe.oko.Kiafumi.Kiafumi;
-import moe.oko.Kiafumi.model.Server;
import moe.oko.Kiafumi.util.EmbedUI;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Activity;
import net.dv8tion.jda.api.entities.Guild;
-import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.events.ReadyEvent;
import net.dv8tion.jda.api.events.guild.GuildJoinEvent;
import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent;
import net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent;
-import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.events.user.update.GenericUserPresenceEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import org.jetbrains.annotations.NotNull;
-import java.awt.*;
import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
@@ -39,7 +35,7 @@ public class MainListener extends ListenerAdapter {
*/
@Override
public void onGuildJoin(@NotNull GuildJoinEvent event) {
- //Automatically create our default information for the server if we don't have it already.
+ // Automatically create our default information for the server if we don't have it already.
info("Joined a new guild, NAME: " + event.getGuild().getName() + " ID: " + event.getGuild().getId());
Kiafumi.instance.getServerManager().createNewDefaultServer(event.getGuild());
Kiafumi.instance.registerForGuild(event.getGuild());
@@ -50,24 +46,16 @@ public class MainListener extends ListenerAdapter {
*/
@Override
public void onReady(@NotNull ReadyEvent event) {
- info("Received READY signal from Discord, bot is now logged in." +
+ info("Received READY signal from Discord, bot is now logged in." + System.lineSeparator() +
" Guilds Active: " + event.getGuildAvailableCount() + " Guilds Unavailable: " + event.getGuildUnavailableCount());
}
- /**
- * Slash Command Logging
- */
- @Override
- public void onSlashCommandInteraction(SlashCommandInteractionEvent event) {
- //soontm
- }
-
/**
* Quick Response for if someone pings me.
*/
public void onMessageReceived(MessageReceivedEvent event) {
if(event.getMessage().getMentionedUsers().contains(Kiafumi.JDA.getSelfUser())) {
- EmbedBuilder eb = new EmbedBuilder()
+ var eb = new EmbedBuilder()
.setColor(EmbedUI.INFO)
.setTitle("Hi, i'm Kiafumi!")
.setDescription("I was summoned on October 6th 2017! My goal is to explore the metaverse and help people in it!")
@@ -82,15 +70,16 @@ public class MainListener extends ListenerAdapter {
* Game Prevention, is a global mechanic :^)
* @param event - GenericUserPresenceEvent event to be used.
*/
+ @Deprecated
@Override
public void onGenericUserPresence(@NotNull GenericUserPresenceEvent event) {
if(Kiafumi.instance.config.isGamePreventionEnabled()) {
- //Proceed.
+ // Proceed.
if(event.getMember().getActivities().contains(Activity.playing(Kiafumi.instance.config.getGameToPrevent()))) {
- //THEY ARE PLAYING THE BIG BAD GAME!!!! WARN THE MIMMEDIATELYOYUITHTHHT
+ // THEY ARE PLAYING THE BIG BAD GAME!!!! WARN THE MIMMEDIATELYOYUITHTHHT
event.getMember().getUser().openPrivateChannel().complete().sendMessage("**YOU ARE PLAYING THE BIG BAD GAME STOP STOP STOP** " +
"(in " + Kiafumi.instance.config.getGameCheckTime() + " minutes i wll EVAPORATE you from every server i am IN.").queue();
- Timer timer = new Timer();
+ var timer = new Timer();
int timeInMilisToKill = (Kiafumi.instance.config.getGameCheckTime() * 60) * 1000;
timer.schedule(new TimerTask() {
@Override
@@ -113,7 +102,7 @@ public class MainListener extends ListenerAdapter {
@Override
public void onGuildMemberJoin(@NotNull GuildMemberJoinEvent event) {
- Server server = Kiafumi.instance.getServerManager().getOrCreateServer(event.getGuild());
+ var server = Kiafumi.instance.getServerManager().getOrCreateServer(event.getGuild());
if(server.getJoinRole() != null) {
try {
event.getGuild().addRoleToMember(event.getMember(), event.getGuild().getRoleById(server.getJoinRole())).queue();
@@ -122,38 +111,38 @@ public class MainListener extends ListenerAdapter {
}
}
if(server.isWelcomeEnabled()) {
- TextChannel textChannel = event.getGuild().getTextChannelById(server.getWelcomeChannel());
+ var textChannel = event.getGuild().getTextChannelById(server.getWelcomeChannel());
if(textChannel == null) {
event.getGuild().getTextChannels().get(0).sendMessage("**Failed to send welcome message, as the welcome channel does not exist.**").queue();
return;
}
- DateTimeFormatter dTF = DateTimeFormatter.ofPattern("MM-dd-yyyy");
- //Ok, now we proceed.
- EmbedBuilder embedBuilder = new EmbedBuilder()
+ var dTF = DateTimeFormatter.ofPattern("MM-dd-yyyy");
+ // Prepare embed.
+ var embedBuilder = new EmbedBuilder()
.setColor(EmbedUI.SUCCESS)
.setAuthor(event.getMember().getEffectiveName() + "#" + event.getMember().getUser().getDiscriminator() + " ("
+ event.getMember().getId() + ")", null, event.getUser().getAvatarUrl()).setFooter("User Joined").setTimestamp(OffsetDateTime.now())
- .setDescription(event.getMember().getAsMention() + " | **Joined Discord**: " + event.getMember().getTimeCreated().format(dTF)).setColor(Color.GREEN);
+ .setDescription(event.getMember().getAsMention() + " | **Joined Discord**: " + event.getMember().getTimeCreated().format(dTF));
textChannel.sendMessageEmbeds(embedBuilder.build()).queue();
}
}
@Override
public void onGuildMemberRemove(@NotNull GuildMemberRemoveEvent event) {
- Server server = Kiafumi.instance.getServerManager().getOrCreateServer(event.getGuild());
+ var server = Kiafumi.instance.getServerManager().getOrCreateServer(event.getGuild());
if(server.isWelcomeEnabled()) {
- TextChannel textChannel = event.getGuild().getTextChannelById(server.getWelcomeChannel());
+ var textChannel = event.getGuild().getTextChannelById(server.getWelcomeChannel());
if(textChannel == null) {
event.getGuild().getTextChannels().get(0).sendMessage("**Failed to send leave message, as the welcome channel does not exist.**").queue();
return;
}
- //Ok, now we proceed.
- DateTimeFormatter dTF = DateTimeFormatter.ofPattern("MM-dd-yyyy");
- EmbedBuilder embedBuilder = new EmbedBuilder()
+ // Prepare embed.
+ var dTF = DateTimeFormatter.ofPattern("MM-dd-yyyy");
+ var embedBuilder = new EmbedBuilder()
.setColor(EmbedUI.FAILURE)
.setAuthor(event.getMember().getEffectiveName() + "#" + event.getMember().getUser().getDiscriminator() + " ("
+ event.getMember().getId() + ")", null, event.getUser().getAvatarUrl()).setFooter("User Left").setTimestamp(OffsetDateTime.now())
- .setDescription(event.getMember().getAsMention() + " | **Joined Server**: " + event.getMember().getTimeJoined().format(dTF)).setColor(Color.RED);
+ .setDescription(event.getMember().getAsMention() + " | **Joined Server**: " + event.getMember().getTimeJoined().format(dTF));
textChannel.sendMessageEmbeds(embedBuilder.build()).queue();
}
}
diff --git a/src/main/java/moe/oko/Kiafumi/model/ServerManager.java b/src/main/java/moe/oko/Kiafumi/model/ServerManager.java
index f6a50a6..1a04f37 100644
--- a/src/main/java/moe/oko/Kiafumi/model/ServerManager.java
+++ b/src/main/java/moe/oko/Kiafumi/model/ServerManager.java
@@ -63,7 +63,7 @@ public class ServerManager {
* @return - whether the function succeeded.
*/
public boolean createNewDefaultServer(Guild guild) {
- info("Started default server creation for " + guild.getId());
+ info("Started default server creation for server " + guild.getId());
Server server = new Server(guild.getId());
if(Kiafumi.instance.getDatabase().createServerInformation(guild)) {
info("New defaults persistent for " + server);
diff --git a/src/main/java/moe/oko/Kiafumi/util/CommandType.java b/src/main/java/moe/oko/Kiafumi/util/CommandType.java
index 85e84fa..ddfa842 100644
--- a/src/main/java/moe/oko/Kiafumi/util/CommandType.java
+++ b/src/main/java/moe/oko/Kiafumi/util/CommandType.java
@@ -2,7 +2,7 @@ package moe.oko.Kiafumi.util;
/**
* Used to identify what type of Command is being used.
- * This is intended to prevent JDA errors. Which is does.
+ * This is intended to prevent JDA errors.
*/
public enum CommandType {
diff --git a/src/main/java/moe/oko/Kiafumi/util/EmbedUI.java b/src/main/java/moe/oko/Kiafumi/util/EmbedUI.java
index 973fb53..9d50d99 100644
--- a/src/main/java/moe/oko/Kiafumi/util/EmbedUI.java
+++ b/src/main/java/moe/oko/Kiafumi/util/EmbedUI.java
@@ -1,12 +1,7 @@
package moe.oko.Kiafumi.util;
-import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
-
-import javax.annotation.Nullable;
import java.awt.Color;
-import static moe.oko.Kiafumi.Kiafumi.info;
-
/**
* EmbedUI Class
* @author oko
@@ -14,7 +9,7 @@ import static moe.oko.Kiafumi.Kiafumi.info;
public abstract class EmbedUI {
/**
* Shorthand reference for common EmbedBuilder colors & strings.
- * I (oko) chose these colors based on the Pantone Color of the year.
+ * I chose these colors based on the Pantone Color of the year.
*/
// Strings
@@ -24,21 +19,4 @@ public abstract class EmbedUI {
public static final Color SUCCESS = new Color(136,176,75);
public static final Color FAILURE = new Color(255,111,97);
public static final Color INFO = new Color(123,196,196);
-
- /**
- * Used for logging commands with ease to console via a static method.
- * @param event - the event ran
- * @param msg - Any message to append with this.
- */
- public static void slashLog(SlashCommandInteractionEvent event, @Nullable String msg) {
- info("User[" + event.getUser().getName() + ":" + event.getUser().getId() + "] RAN " + event.getName() + "." + (msg == null ? "" : msg));
- }
-
- public static void slashLog(SlashCommandInteractionEvent event) {
- info("User[" + event.getUser().getName() + ":" + event.getUser().getId() + "] RAN " + event.getName() + ".");
- }
-
- public static void slashResponse(SlashCommandInteractionEvent event, String msg) {
- info("User[" + event.getUser().getName() + ":" + event.getUser().getId() + "] CMD RESPONSE: " + msg);
- }
}