Added new command
//TODO do the help about it
This commit is contained in:
parent
1b0f169d93
commit
3a9eb35eb4
@ -23,7 +23,7 @@ public class Ordre66 implements Commande {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAdminCmd() {
|
public boolean isAdminCmd() {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
70
src/main/java/net/Broken/Commands/ReportUsers.java
Normal file
70
src/main/java/net/Broken/Commands/ReportUsers.java
Normal file
@ -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<Void> 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;
|
||||||
|
}
|
||||||
|
}
|
@ -119,6 +119,10 @@ public class EmbedMessageUtils {
|
|||||||
return buildStandar(temp);
|
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){
|
public static MessageEmbed searchResult(SearchResult result){
|
||||||
EmbedBuilder builder = new EmbedBuilder()
|
EmbedBuilder builder = new EmbedBuilder()
|
||||||
.setColor(Color.CYAN)
|
.setColor(Color.CYAN)
|
||||||
|
Loading…
Reference in New Issue
Block a user