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:
parent
4180b25348
commit
3468f80518
@ -25,5 +25,5 @@ public class BotConstants {
|
|||||||
|
|
||||||
// Channels
|
// Channels
|
||||||
public static final String HAROLD_LOG = "813151182758608936";
|
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";
|
||||||
}
|
}
|
@ -56,7 +56,7 @@ public class MGZBot {
|
|||||||
ex.printStackTrace();
|
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) {
|
public static void main(String[] args) {
|
||||||
|
@ -14,7 +14,6 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class AddReactionToMessageCommand extends BaseCommand {
|
public class AddReactionToMessageCommand extends BaseCommand {
|
||||||
|
|
||||||
public AddReactionToMessageCommand() {
|
public AddReactionToMessageCommand() {
|
||||||
name = "addreaction";
|
name = "addreaction";
|
||||||
aliases = new String[]{"react"};
|
aliases = new String[]{"react"};
|
||||||
|
@ -14,7 +14,6 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class EditMessageCommand extends BaseCommand {
|
public class EditMessageCommand extends BaseCommand {
|
||||||
|
|
||||||
public EditMessageCommand() {
|
public EditMessageCommand() {
|
||||||
name = "edit";
|
name = "edit";
|
||||||
aliases = new String[]{"editmessage"};
|
aliases = new String[]{"editmessage"};
|
||||||
@ -28,7 +27,7 @@ public class EditMessageCommand extends BaseCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void execute(CommandEvent event, List<String> args) {
|
protected void execute(CommandEvent event, List<String> args) {
|
||||||
if (args.size() < 3) {
|
if (args.size() < 3) {
|
||||||
MessageUtils.sendUsageMessage(event.getTextChannel(),this);
|
MessageUtils.sendUsageMessage(event.getTextChannel(), this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,10 +10,9 @@ import java.util.List;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class InviteCommand extends BaseCommand {
|
public class InviteCommand extends BaseCommand {
|
||||||
|
|
||||||
public InviteCommand() {
|
public InviteCommand() {
|
||||||
name = "invite";
|
name = "invite";
|
||||||
aliases = new String[]{"createinvite"};
|
aliases = new String[] { "createinvite" };
|
||||||
help = "Create invite link via the bot";
|
help = "Create invite link via the bot";
|
||||||
guildOnly = true;
|
guildOnly = true;
|
||||||
guilds = Collections.singletonList(zone.themcgamer.discordbot.guild.Guild.MAIN);
|
guilds = Collections.singletonList(zone.themcgamer.discordbot.guild.Guild.MAIN);
|
||||||
@ -22,7 +21,6 @@ public class InviteCommand extends BaseCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void execute(CommandEvent event, List<String> args) {
|
protected void execute(CommandEvent event, List<String> args) {
|
||||||
Guild guild = event.getGuild();
|
Guild guild = event.getGuild();
|
||||||
|
|
||||||
TextChannel textChannelById = guild.getTextChannelById(791015530001596456L);
|
TextChannel textChannelById = guild.getTextChannelById(791015530001596456L);
|
||||||
if (textChannelById == null)
|
if (textChannelById == null)
|
||||||
return;
|
return;
|
||||||
@ -31,12 +29,8 @@ public class InviteCommand extends BaseCommand {
|
|||||||
.setTemporary(true).queue(inviteLink -> {
|
.setTemporary(true).queue(inviteLink -> {
|
||||||
event.getMember().getUser().openPrivateChannel().queue(privateChannel -> {
|
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();
|
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!");
|
event.reply("Check your DMs!");
|
||||||
}, error -> {
|
}, error -> event.replyError("Could not sent you a dm!"));
|
||||||
event.replyError("Could not sent you a dm!");
|
}, error -> event.replyError("Couldn't create an invite link due to an error!"));
|
||||||
}); }, error -> {
|
|
||||||
event.replyError("Coulnd't create an invite link due an error!");
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ public class MessageCommand extends BaseCommand {
|
|||||||
|
|
||||||
public MessageCommand() {
|
public MessageCommand() {
|
||||||
name = "message";
|
name = "message";
|
||||||
aliases = new String[]{"say"};
|
aliases = new String[] { "say" };
|
||||||
help = "Announce something in an embed format.";
|
help = "Announce something in an embed format.";
|
||||||
arguments = "<title> <description>";
|
arguments = "<title> <description>";
|
||||||
userPermissions = new Permission[] { Permission.ADMINISTRATOR };
|
userPermissions = new Permission[] { Permission.ADMINISTRATOR };
|
||||||
|
@ -19,7 +19,7 @@ import java.util.stream.Collectors;
|
|||||||
public class SuggestCommand extends BaseCommand {
|
public class SuggestCommand extends BaseCommand {
|
||||||
public SuggestCommand() {
|
public SuggestCommand() {
|
||||||
name = "suggest";
|
name = "suggest";
|
||||||
aliases = new String[]{"suggestion"};
|
aliases = new String[] { "suggestion" };
|
||||||
help = "Share a suggestion!";
|
help = "Share a suggestion!";
|
||||||
arguments = "<suggestion>";
|
arguments = "<suggestion>";
|
||||||
guildOnly = true;
|
guildOnly = true;
|
||||||
|
@ -18,15 +18,15 @@ import java.util.Map;
|
|||||||
import static zone.themcgamer.discordbot.utilities.GuildUtils.toggleRole;
|
import static zone.themcgamer.discordbot.utilities.GuildUtils.toggleRole;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class MainGuildListener extends ListenerAdapter {
|
public class MainGuildListener extends ListenerAdapter {
|
||||||
private final MGZBot mgzBot;
|
private final MGZBot mgzBot;
|
||||||
|
|
||||||
private static final HashMap<String, Long> reactionRoles = new HashMap<>();
|
private static final HashMap<String, Long> reactionRoles = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
reactionRoles.put("🗞️", 812440883898875914L);
|
reactionRoles.put("🗞️", 812440883898875914L);
|
||||||
reactionRoles.put("📊", 813139198428839976L);
|
reactionRoles.put("📊", 813139198428839976L);
|
||||||
reactionRoles.put("🥁", 813140631705878549L);
|
reactionRoles.put("🥁", 813140631705878549L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -10,7 +10,6 @@ import zone.themcgamer.discordbot.command.BaseCommand;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class MessageUtils {
|
public class MessageUtils {
|
||||||
|
|
||||||
public static void sendUsageMessage(TextChannel textChannel, BaseCommand command) {
|
public static void sendUsageMessage(TextChannel textChannel, BaseCommand command) {
|
||||||
textChannel.sendMessage(EmbedUtils.errorEmbed()
|
textChannel.sendMessage(EmbedUtils.errorEmbed()
|
||||||
.appendDescription("Usage: " + BotConstants.PREFIX + command.getName() + " " + command.getArguments())
|
.appendDescription("Usage: " + BotConstants.PREFIX + command.getName() + " " + command.getArguments())
|
||||||
|
Reference in New Issue
Block a user