diff --git a/src/discord/MagicBot.java b/src/discord/MagicBot.java index 8be071ee..9bf6b233 100644 --- a/src/discord/MagicBot.java +++ b/src/discord/MagicBot.java @@ -182,22 +182,22 @@ public class MagicBot extends ListenerAdapter { PasswordChangeHandler.handleRequest(event, args); break; case "#changelog": - ChangeLogHandler.handleRequest(event, args); + ChatChannelHandler.handleRequest(ChatChannel.CHANGELOG, event, args); break; case "#general": - GeneralChannelHandler.handleRequest(event, args); + ChatChannelHandler.handleRequest(ChatChannel.GENERAL, event, args); break; case "#politics": - PoliticalChannelHandler.handleRequest(event, args); + ChatChannelHandler.handleRequest(ChatChannel.POLITICAL, event, args); break; case "#announce": - AnnounceChannelHandler.handleRequest(event, args); + ChatChannelHandler.handleRequest(ChatChannel.ANNOUNCE, event, args); break; case "#bug": - ForToFixChannelHandler.handleRequest(event, args); + ChatChannelHandler.handleRequest(ChatChannel.FORTOFIX, event, args); break; case "#recruit": - RecruitChannelHandler.handleRequest(event, args); + ChatChannelHandler.handleRequest(ChatChannel.RECRUIT, event, args); break; case "#lookup": LookupRequestHandler.handleRequest(event, args); diff --git a/src/discord/handlers/AnnounceChannelHandler.java b/src/discord/handlers/AnnounceChannelHandler.java deleted file mode 100644 index be534e6b..00000000 --- a/src/discord/handlers/AnnounceChannelHandler.java +++ /dev/null @@ -1,55 +0,0 @@ -// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . -// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· -// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ -// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ -// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ -// Magicbane Emulator Project © 2013 - 2022 -// www.magicbane.com - -package discord.handlers; - -import discord.MagicBot; -import discord.RobotSpeak; -import net.dv8tion.jda.api.events.message.MessageReceivedEvent; -import org.pmw.tinylog.Logger; - -import static discord.ChatChannel.ANNOUNCE; - -public class AnnounceChannelHandler { - - public static void handleRequest(MessageReceivedEvent event, String[] args) { - - String chatText; - String outString; - - // Early exit if database unavailable or is not an admin - - if (MagicBot.isAdminEvent(event) == false) - return; - - // Nothing to send? - - if (args.length == 0) - return; - - // Convert argument array into string; - - chatText = String.join(" ", args); - - // Build String - - if (chatText.startsWith("-r ")) - outString = - "```\n" + "Hello Players \n\n" + - chatText.substring(3) + "\n\n" + - RobotSpeak.getRobotSpeak() + "\n```"; - else outString = chatText; - - // Write string to announce channel - - if (ANNOUNCE.textChannel.canTalk()) - ANNOUNCE.textChannel.sendMessage(outString).queue(); - - Logger.info(event.getAuthor().getName() + " announce: " + chatText); - } -} diff --git a/src/discord/handlers/ChangeLogHandler.java b/src/discord/handlers/ChangeLogHandler.java deleted file mode 100644 index 73ec2710..00000000 --- a/src/discord/handlers/ChangeLogHandler.java +++ /dev/null @@ -1,44 +0,0 @@ -// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . -// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· -// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ -// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ -// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ -// Magicbane Emulator Project © 2013 - 2022 -// www.magicbane.com - -package discord.handlers; - -import discord.MagicBot; -import net.dv8tion.jda.api.events.message.MessageReceivedEvent; -import org.pmw.tinylog.Logger; - -import static discord.ChatChannel.CHANGELOG; - -public class ChangeLogHandler { - - public static void handleRequest(MessageReceivedEvent event, String[] args) { - - String outString; - - // Early exit if database unavailable or is not an admin - - if (MagicBot.isAdminEvent(event) == false) - return; - - // Nothing to send? - - if (args.length == 0) - return; - - // Convert argument array into string; - - outString = String.join(" ", args); - - // Write string to changelog channel - - if (CHANGELOG.textChannel.canTalk()) - CHANGELOG.textChannel.sendMessage(outString).queue(); - - Logger.info(event.getAuthor().getName() + " changelog entry: " + outString); - } -} diff --git a/src/discord/handlers/ForToFixChannelHandler.java b/src/discord/handlers/ForToFixChannelHandler.java deleted file mode 100644 index 8af07639..00000000 --- a/src/discord/handlers/ForToFixChannelHandler.java +++ /dev/null @@ -1,56 +0,0 @@ -// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . -// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· -// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ -// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ -// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ -// Magicbane Emulator Project © 2013 - 2022 -// www.magicbane.com - -package discord.handlers; - -import discord.MagicBot; -import discord.RobotSpeak; -import net.dv8tion.jda.api.events.message.MessageReceivedEvent; -import org.pmw.tinylog.Logger; - -import static discord.ChatChannel.FORTOFIX; - -public class ForToFixChannelHandler { - - public static void handleRequest(MessageReceivedEvent event, String[] args) { - - String chatText; - String outString; - - // Early exit if database unavailable or is not an admin - - if (MagicBot.isAdminEvent(event) == false) - return; - - // Nothing to send? - - if (args.length == 0) - return; - - // Convert argument array into string; - - chatText = String.join(" ", args); - - // Build String - - if (chatText.startsWith("-r ")) - outString = - "```\n" + "Hello Players \n\n" + - chatText.substring(3) + "\n\n" + - RobotSpeak.getRobotSpeak() + "\n```"; - else outString = chatText; - - // Write string to changelog channel - - if (FORTOFIX.textChannel.canTalk()) - FORTOFIX.textChannel.sendMessage(outString).queue(); - - Logger.info(event.getAuthor().getName() + "fortofix: " + chatText); - - } -} diff --git a/src/discord/handlers/GeneralChannelHandler.java b/src/discord/handlers/GeneralChannelHandler.java deleted file mode 100644 index 90e36c2c..00000000 --- a/src/discord/handlers/GeneralChannelHandler.java +++ /dev/null @@ -1,56 +0,0 @@ -// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . -// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· -// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ -// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ -// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ -// Magicbane Emulator Project © 2013 - 2022 -// www.magicbane.com - -package discord.handlers; - -import discord.MagicBot; -import discord.RobotSpeak; -import net.dv8tion.jda.api.events.message.MessageReceivedEvent; -import org.pmw.tinylog.Logger; - -import static discord.ChatChannel.GENERAL; - -public class GeneralChannelHandler { - - public static void handleRequest(MessageReceivedEvent event, String[] args) { - - String chatText; - String outString; - - // Early exit if database unavailable or is not an admin - - if (MagicBot.isAdminEvent(event) == false) - return; - - // Nothing to send? - - if (args.length == 0) - return; - - // Convert argument array into string; - - chatText = String.join(" ", args); - - // Build String - - if (chatText.startsWith("-r ")) - outString = - "```\n" + "Hello Players \n\n" + - chatText.substring(3) + "\n\n" + - RobotSpeak.getRobotSpeak() + "\n```"; - else outString = chatText; - - // Write string to changelog channel - - if (GENERAL.textChannel.canTalk()) - GENERAL.textChannel.sendMessage(outString).queue(); - - Logger.info(event.getAuthor().getName() + "general: " + chatText); - - } -} diff --git a/src/discord/handlers/PoliticalChannelHandler.java b/src/discord/handlers/PoliticalChannelHandler.java deleted file mode 100644 index 1b046407..00000000 --- a/src/discord/handlers/PoliticalChannelHandler.java +++ /dev/null @@ -1,55 +0,0 @@ -// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . -// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· -// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ -// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ -// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ -// Magicbane Emulator Project © 2013 - 2022 -// www.magicbane.com - -package discord.handlers; - -import discord.MagicBot; -import discord.RobotSpeak; -import net.dv8tion.jda.api.events.message.MessageReceivedEvent; -import org.pmw.tinylog.Logger; - -import static discord.ChatChannel.POLITICAL; - -public class PoliticalChannelHandler { - - public static void handleRequest(MessageReceivedEvent event, String[] args) { - - String chatText; - String outString; - - // Early exit if database unavailable or is not an admin - - if (MagicBot.isAdminEvent(event) == false) - return; - - // Nothing to send? - - if (args.length == 0) - return; - - // Convert argument array into string; - - chatText = String.join(" ", args); - - // Build String - - if (chatText.startsWith("-r ")) - outString = - "```\n" + "Hello Players \n\n" + - chatText.substring(3) + "\n\n" + - RobotSpeak.getRobotSpeak() + "\n```"; - else outString = chatText; - - // Write string to changelog channel - - if (POLITICAL.textChannel.canTalk()) - POLITICAL.textChannel.sendMessage(outString).queue(); - - Logger.info(event.getAuthor().getName() + " politics: " + chatText); - } -} diff --git a/src/discord/handlers/RecruitChannelHandler.java b/src/discord/handlers/RecruitChannelHandler.java deleted file mode 100644 index 798c1588..00000000 --- a/src/discord/handlers/RecruitChannelHandler.java +++ /dev/null @@ -1,56 +0,0 @@ -// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . -// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· -// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ -// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ -// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ -// Magicbane Emulator Project © 2013 - 2022 -// www.magicbane.com - -package discord.handlers; - -import discord.MagicBot; -import discord.RobotSpeak; -import net.dv8tion.jda.api.events.message.MessageReceivedEvent; -import org.pmw.tinylog.Logger; - -import static discord.ChatChannel.RECRUIT; - -public class RecruitChannelHandler { - - public static void handleRequest(MessageReceivedEvent event, String[] args) { - - String chatText; - String outString; - - // Early exit if database unavailable or is not an admin - - if (MagicBot.isAdminEvent(event) == false) - return; - - // Nothing to send? - - if (args.length == 0) - return; - - // Convert argument array into string; - - chatText = String.join(" ", args); - - // Build String - - if (chatText.startsWith("-r ")) - outString = - "```\n" + "Hello Players \n\n" + - chatText.substring(3) + "\n\n" + - RobotSpeak.getRobotSpeak() + "\n```"; - else outString = chatText; - - // Write string to changelog channel - - if (RECRUIT.textChannel.canTalk()) - RECRUIT.textChannel.sendMessage(outString).queue(); - - Logger.info(event.getAuthor().getName() + "recruit: " + chatText); - - } -}