Discord Bot: Cleaned things up a little bit and fixed an issue where the panel wouldn't mark the bot server as RUNNING.

This commit is contained in:
nickreesdev 2021-03-15 11:15:42 -05:00
parent 4180b25348
commit 3468f80518
9 changed files with 16 additions and 25 deletions

View File

@ -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";
}

View File

@ -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) {

View File

@ -14,7 +14,6 @@ import java.util.Arrays;
import java.util.List;
public class AddReactionToMessageCommand extends BaseCommand {
public AddReactionToMessageCommand() {
name = "addreaction";
aliases = new String[]{"react"};
@ -46,4 +45,4 @@ public class AddReactionToMessageCommand extends BaseCommand {
event.reply(embedBuilder.build());
});
}
}
}

View File

@ -14,7 +14,6 @@ import java.util.Arrays;
import java.util.List;
public class EditMessageCommand extends BaseCommand {
public EditMessageCommand() {
name = "edit";
aliases = new String[]{"editmessage"};
@ -28,7 +27,7 @@ public class EditMessageCommand extends BaseCommand {
@Override
protected void execute(CommandEvent event, List<String> args) {
if (args.size() < 3) {
MessageUtils.sendUsageMessage(event.getTextChannel(),this);
MessageUtils.sendUsageMessage(event.getTextChannel(), this);
return;
}
@ -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?");
});
}
}
}

View File

@ -10,10 +10,9 @@ import java.util.List;
import java.util.concurrent.TimeUnit;
public class InviteCommand extends BaseCommand {
public InviteCommand() {
name = "invite";
aliases = new String[]{"createinvite"};
aliases = new String[] { "createinvite" };
help = "Create 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,8 @@ 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 to an error!"));
}
}

View File

@ -15,7 +15,7 @@ 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 };

View File

@ -19,7 +19,7 @@ import java.util.stream.Collectors;
public class SuggestCommand extends BaseCommand {
public SuggestCommand() {
name = "suggest";
aliases = new String[]{"suggestion"};
aliases = new String[] { "suggestion" };
help = "Share a suggestion!";
arguments = "<suggestion>";
guildOnly = true;

View File

@ -18,15 +18,15 @@ import java.util.Map;
import static zone.themcgamer.discordbot.utilities.GuildUtils.toggleRole;
@RequiredArgsConstructor
public class MainGuildListener extends ListenerAdapter {
public class MainGuildListener extends ListenerAdapter {
private final MGZBot mgzBot;
private static final HashMap<String, Long> reactionRoles = new HashMap<>();
static {
reactionRoles.put("🗞️", 812440883898875914L);
reactionRoles.put("📊", 813139198428839976L);
reactionRoles.put("🥁", 813140631705878549L);
reactionRoles.put("🗞️", 812440883898875914L);
reactionRoles.put("📊", 813139198428839976L);
reactionRoles.put("🥁", 813140631705878549L);
}
@Override

View File

@ -10,7 +10,6 @@ import zone.themcgamer.discordbot.command.BaseCommand;
import java.util.Objects;
public class MessageUtils {
public static void sendUsageMessage(TextChannel textChannel, BaseCommand command) {
textChannel.sendMessage(EmbedUtils.errorEmbed()
.appendDescription("Usage: " + BotConstants.PREFIX + command.getName() + " " + command.getArguments())
@ -36,4 +35,4 @@ public class MessageUtils {
}
return logChannel;
}
}
}