use of net.kodehawa.mantarobot.data.entities.MantaroObj in project MantaroBot by Mantaro.
the class OwnerCmd method blacklist.
@Command
public static void blacklist(CommandRegistry cr) {
cr.register("blacklist", new SimpleCommand(Category.OWNER, CommandPermission.OWNER) {
@Override
protected void call(GuildMessageReceivedEvent event, String content, String[] args) {
MantaroObj obj = MantaroData.db().getMantaroData();
if (args[0].equals("guild")) {
if (args[1].equals("add")) {
if (MantaroBot.getInstance().getGuildById(args[2]) == null)
return;
obj.getBlackListedGuilds().add(args[2]);
event.getChannel().sendMessage(EmoteReference.CORRECT + "Blacklisted Guild: " + event.getJDA().getGuildById(args[2])).queue();
obj.save();
} else if (args[1].equals("remove")) {
if (!obj.getBlackListedGuilds().contains(args[2]))
return;
obj.getBlackListedGuilds().remove(args[2]);
event.getChannel().sendMessage(EmoteReference.CORRECT + "Unblacklisted Guild: " + args[2]).queue();
obj.save();
}
return;
}
if (args[0].equals("user")) {
if (args[1].equals("add")) {
if (MantaroBot.getInstance().getUserById(args[2]) == null)
return;
obj.getBlackListedUsers().add(args[2]);
event.getChannel().sendMessage(EmoteReference.CORRECT + "Blacklisted User: " + event.getJDA().getUserById(args[2])).queue();
obj.save();
} else if (args[1].equals("remove")) {
if (!obj.getBlackListedUsers().contains(args[2]))
return;
obj.getBlackListedUsers().remove(args[2]);
event.getChannel().sendMessage(EmoteReference.CORRECT + "Unblacklisted User: " + event.getJDA().getUserById(args[2])).queue();
obj.save();
}
}
}
@Override
public MessageEmbed help(GuildMessageReceivedEvent event) {
return helpEmbed(event, "Blacklist command").setDescription("**Blacklists a user (user argument) or a guild (guild argument) by id.**").setFooter("Examples", "~>blacklist user add/remove 293884638101897216\n" + "~>blacklist guild add/remove 305408763915927552").build();
}
});
}
Aggregations