因此,我想赋予所有人无权控制时间Muted的角色,我尝试实现以下代码,但控制台仅将bot和我的名字作为输出
if (message.equalsIgnoreCase("The World!")) {
Role e = findRole(event.getMember(), "Time");
if (e.equals(null)) return;
event.getChannel().sendMessage("https://tenor.com/view/dio-the-world-power-charge-gif-13331683").queue();
Role role = event.getGuild().getRolesByName("Muted", false).get(0);
java.util.List<Member> users = guild.getMembers();
for (Member member :users) {
System.out.println(String.valueOf(member));
Role e1 = findRole(member, "Time");
System.out.println(member+String.valueOf(e1));
if (e1.equals(null)){
guild.addRoleToMember(member, role).queue();
System.out.println(member+" "+e1);
}
}
}
MB:Prime(U:Prime(737242975335350285)/ G:Chaos Reloaded(617029996921487360)) MB:Prime(U:Prime(737242975335350285)/ G:Chaos Reloaded(617029996921487360))R:Time(760807424810156032) MB:mZe(U:mZe(680322904449220660)/ G:混沌已重装(617029996921487360)) MB:mZe(U:mZe(680322904449220660)/ G:Chaos Reloaded(617029996921487360))为空