From 049c436ac39f197881ffdbba7742df9ef4107d5f Mon Sep 17 00:00:00 2001 From: Nicholas Rees <70386214+nickreesdev@users.noreply.github.com> Date: Mon, 15 Mar 2021 11:30:56 -0500 Subject: [PATCH] Discord Bot: Fixed an issue with the panel not properly marking the server hosting the bot as RUNNING. Also fixed a few wording issues and cleaned up some things. --- .../zone/themcgamer/discordbot/BotConstants.java | 2 +- .../java/zone/themcgamer/discordbot/MGZBot.java | 2 +- .../command/impl/AddReactionToMessageCommand.java | 5 ++--- .../command/impl/EditMessageCommand.java | 5 ++--- .../discordbot/command/impl/InviteCommand.java | 15 +++++---------- .../discordbot/command/impl/MessageCommand.java | 5 ++--- .../discordbot/utilities/GuildUtils.java | 2 +- 7 files changed, 14 insertions(+), 22 deletions(-) diff --git a/discordbot/src/main/java/zone/themcgamer/discordbot/BotConstants.java b/discordbot/src/main/java/zone/themcgamer/discordbot/BotConstants.java index b81e384..cffba5e 100644 --- a/discordbot/src/main/java/zone/themcgamer/discordbot/BotConstants.java +++ b/discordbot/src/main/java/zone/themcgamer/discordbot/BotConstants.java @@ -25,5 +25,5 @@ public class BotConstants { // Channels public static final String HAROLD_LOG = "813151182758608936"; - public static final String SUGGESTIONS = "802304706701426730"; // TODO: 2/15/2021 Change this to the main guild's suggestions channel when the bot is on the main guild. + public static final String SUGGESTIONS = "802304706701426730"; } \ No newline at end of file diff --git a/discordbot/src/main/java/zone/themcgamer/discordbot/MGZBot.java b/discordbot/src/main/java/zone/themcgamer/discordbot/MGZBot.java index d187695..8466a8f 100644 --- a/discordbot/src/main/java/zone/themcgamer/discordbot/MGZBot.java +++ b/discordbot/src/main/java/zone/themcgamer/discordbot/MGZBot.java @@ -56,7 +56,7 @@ public class MGZBot { ex.printStackTrace(); } - System.out.println("Done (" + (System.currentTimeMillis() - time) + "ms)!"); + System.out.println("Done (" + (System.currentTimeMillis() - time) + ")! For help, type \"help\" or \"?\"\n"); } public static void main(String[] args) { diff --git a/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/AddReactionToMessageCommand.java b/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/AddReactionToMessageCommand.java index 55e797e..d6c2b2c 100644 --- a/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/AddReactionToMessageCommand.java +++ b/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/AddReactionToMessageCommand.java @@ -14,10 +14,9 @@ import java.util.Arrays; import java.util.List; public class AddReactionToMessageCommand extends BaseCommand { - public AddReactionToMessageCommand() { name = "addreaction"; - aliases = new String[]{"react"}; + aliases = new String[] { "react" }; help = "Edit a message from the bot."; arguments = " "; userPermissions = new Permission[] { Permission.ADMINISTRATOR }; @@ -46,4 +45,4 @@ public class AddReactionToMessageCommand extends BaseCommand { event.reply(embedBuilder.build()); }); } -} +} \ No newline at end of file diff --git a/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/EditMessageCommand.java b/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/EditMessageCommand.java index 0f020e6..903fdd9 100644 --- a/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/EditMessageCommand.java +++ b/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/EditMessageCommand.java @@ -14,10 +14,9 @@ import java.util.Arrays; import java.util.List; public class EditMessageCommand extends BaseCommand { - public EditMessageCommand() { name = "edit"; - aliases = new String[]{"editmessage"}; + aliases = new String[] { "editmessage" }; help = "Edit a message from the bot."; arguments = " <description>"; userPermissions = new Permission[] { Permission.ADMINISTRATOR }; @@ -51,4 +50,4 @@ public class EditMessageCommand extends BaseCommand { event.reply("Message with this ID does not exist, are you sure this is the right id?"); }); } -} +} \ No newline at end of file diff --git a/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/InviteCommand.java b/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/InviteCommand.java index 3df10aa..5ca07ea 100644 --- a/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/InviteCommand.java +++ b/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/InviteCommand.java @@ -10,11 +10,10 @@ import java.util.List; import java.util.concurrent.TimeUnit; public class InviteCommand extends BaseCommand { - public InviteCommand() { name = "invite"; - aliases = new String[]{"createinvite"}; - help = "Create invite link via the bot"; + aliases = new String[] { "createinvite" }; + help = "Create an invite link via the bot"; guildOnly = true; guilds = Collections.singletonList(zone.themcgamer.discordbot.guild.Guild.MAIN); } @@ -22,7 +21,6 @@ public class InviteCommand extends BaseCommand { @Override protected void execute(CommandEvent event, List<String> args) { Guild guild = event.getGuild(); - TextChannel textChannelById = guild.getTextChannelById(791015530001596456L); if (textChannelById == null) return; @@ -31,12 +29,9 @@ public class InviteCommand extends BaseCommand { .setTemporary(true).queue(inviteLink -> { event.getMember().getUser().openPrivateChannel().queue(privateChannel -> { privateChannel.sendMessage("I have generated an invite link for you! This invite link will work for 24 hours! " + inviteLink.getUrl()).queue(); - event.reply("Check your dm's!"); - }, error -> { - event.replyError("Could not sent you a dm!"); - }); }, error -> { - event.replyError("Coulnd't create an invite link due an error!"); - }); + event.reply("Check your DMs!"); + }, error -> event.replyError("Could not sent you a dm!")); + }, error -> event.replyError("Couldn't create an invite link due an error!")); } } \ No newline at end of file diff --git a/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/MessageCommand.java b/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/MessageCommand.java index 9940f05..b109f68 100644 --- a/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/MessageCommand.java +++ b/discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/MessageCommand.java @@ -12,10 +12,9 @@ import java.util.Arrays; import java.util.List; public class MessageCommand extends BaseCommand { - public MessageCommand() { name = "message"; - aliases = new String[]{"say"}; + aliases = new String[] { "say" }; help = "Announce something in an embed format."; arguments = "<title> <description>"; userPermissions = new Permission[] { Permission.ADMINISTRATOR }; @@ -36,4 +35,4 @@ public class MessageCommand extends BaseCommand { embedBuilder.setDescription(event.getMessage().getContentRaw().replace(args.get(1), "").replace("." + args.get(0), "")); event.getChannel().sendMessage(embedBuilder.build()).queue(); } -} +} \ No newline at end of file diff --git a/discordbot/src/main/java/zone/themcgamer/discordbot/utilities/GuildUtils.java b/discordbot/src/main/java/zone/themcgamer/discordbot/utilities/GuildUtils.java index a849d30..04ed4cf 100644 --- a/discordbot/src/main/java/zone/themcgamer/discordbot/utilities/GuildUtils.java +++ b/discordbot/src/main/java/zone/themcgamer/discordbot/utilities/GuildUtils.java @@ -41,7 +41,7 @@ public class GuildUtils { }, error -> { EmbedBuilder embedBuilder = EmbedUtils.successEmbed(); embedBuilder.setTitle("Role Manager"); - embedBuilder.setDescription("Succesfully toggled " + role.getName() + " " + (!member.getRoles().contains(role) ? "On" : "Off")); + embedBuilder.setDescription("Successfully toggled " + role.getName() + " " + (!member.getRoles().contains(role) ? "On" : "Off")); TextChannel textChannelById = guild.getTextChannelById(813139125195898880L); if (textChannelById == null) return;