diff --git a/src/main/java/net/Broken/Commands/Ordre66.java b/src/main/java/net/Broken/Commands/Ordre66.java index 913e767..6b653a3 100644 --- a/src/main/java/net/Broken/Commands/Ordre66.java +++ b/src/main/java/net/Broken/Commands/Ordre66.java @@ -23,7 +23,7 @@ public class Ordre66 implements Commande { @Override public boolean isAdminCmd() { - return false; + return true; } /** diff --git a/src/main/java/net/Broken/Commands/ReportUsers.java b/src/main/java/net/Broken/Commands/ReportUsers.java new file mode 100644 index 0000000..7c16842 --- /dev/null +++ b/src/main/java/net/Broken/Commands/ReportUsers.java @@ -0,0 +1,70 @@ +package net.Broken.Commands; + +import net.Broken.Commande; +import net.Broken.Tools.EmbedMessageUtils; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.requests.RestAction; +import net.dv8tion.jda.api.requests.restaction.MessageAction; + + +public class ReportUsers implements Commande { + + @Override + public void action(String[] args, MessageReceivedEvent event) { + + event.getGuild().loadMembers().onSuccess(members -> { + if (event.getMessage().getMentionedRoles().size() == 1 && args.length == 1) { + RestAction restAction = null; + for (Member member : members) { + if (member.getRoles().size() == 1) { //check if the member has a role + if (member.getRoles().contains(event.getMessage().getMentionedRoles().get(0))) { //check if the mentioned role is the same as the member's role + if (restAction == null) { + restAction = event.getTextChannel().sendMessage("List des membres : ").and(event.getTextChannel().sendMessage(member.getEffectiveName())); + } else { + restAction = restAction.and(event.getTextChannel().sendMessage(member.getEffectiveName())); + } + } + } + } + if(restAction!=null) + restAction.queue(); + } else if (args.length == 0) { + + for (Member member : members) { + if (member.getRoles().size() == 0) { + event.getTextChannel().sendMessage(member.getEffectiveName()).complete(); + } + } + } else { + event.getTextChannel().sendMessage(EmbedMessageUtils.getReportUsersError()).complete(); + } + }); + } + + @Override + public boolean isPrivateUsable() { + return false; + } + + @Override + public boolean isAdminCmd() { + return true; + } + + /** + * Determines if the command is usable only by bot level admin user + * + * @return boolean + */ + @Override + public boolean isBotAdminCmd() { + return false; + } + + @Override + public boolean isNSFW() { + return false; + } +} diff --git a/src/main/java/net/Broken/Tools/EmbedMessageUtils.java b/src/main/java/net/Broken/Tools/EmbedMessageUtils.java index f9e3be4..d5f865a 100644 --- a/src/main/java/net/Broken/Tools/EmbedMessageUtils.java +++ b/src/main/java/net/Broken/Tools/EmbedMessageUtils.java @@ -119,6 +119,10 @@ public class EmbedMessageUtils { return buildStandar(temp); } + public static MessageEmbed getReportUsersError(){ + return new EmbedBuilder().setTitle(":warning: Command error :warning: ").setDescription("").setColor(Color.red).setFooter("'//help move' for more info.", MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build(); + } + public static MessageEmbed searchResult(SearchResult result){ EmbedBuilder builder = new EmbedBuilder() .setColor(Color.CYAN)