Skip to content

Commit

Permalink
allow members with kick perms to view voter list
Browse files Browse the repository at this point in the history
  • Loading branch information
drdeee committed May 28, 2021
1 parent 14748d1 commit b22839e
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions Discord-Bot/src/main/java/util/PollManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ public void handleReactionEvent(GenericMessageReactionEvent event) {
builder.append("\n```");
event.getUser().openPrivateChannel().queue(channel -> channel.sendMessage(builder.toString()).queue());
} else if (Emojis.VIEW.equalsIgnoreCase(emote)) {
if (event.getMember().getId().equalsIgnoreCase(poll.getPollOwner()) || event.getMember().hasPermission(Permission.ADMINISTRATOR) || event.getMember().hasPermission(Permission.BAN_MEMBERS)) {
if (event.getMember().getId().equalsIgnoreCase(poll.getPollOwner())
|| event.getMember().hasPermission(Permission.ADMINISTRATOR)
|| event.getMember().hasPermission(Permission.KICK_MEMBERS)) {
event.getMember().getUser().openPrivateChannel().queue(pChannel -> {
sendVoters(poll, pChannel);
});
Expand Down Expand Up @@ -351,18 +353,15 @@ public void handleMessageCreateEvent(MessageReceivedEvent event) {
event.getMessage().delete().queue();
}
} else if (setEndTime.contains(id)) {
try {
DateTime time = DiscordBot.FORMATTER.parseDateTime(event.getMessage().getContentRaw());
if (time.isBeforeNow()) throw new IllegalArgumentException();
setup.endTime = time;
setEndTime.remove(id);
resetMessage(setup.msg, setup);
} catch (IllegalArgumentException e) {
event.getChannel().sendMessage("Du musst ein gültiges Datum angeben!")
.queue(msg -> msg.delete().queueAfter(5, TimeUnit.SECONDS));
} finally {
event.getMessage().delete().queue();
}
if (time.isBeforeNow()) {
event.getChannel().sendMessage("Du musst ein gültiges Datum angeben!")
.queue(msg -> msg.delete().queueAfter(5, TimeUnit.SECONDS));
} else {
setup.endTime = time;
setEndTime.remove(id);
resetMessage(setup.msg, setup);
}
} else if (setTargetChannel.contains(id)) {
if (event.getMessage().getMentionedChannels().size() != 1) {
event.getChannel().sendMessage("DU musst exakt EINEN Textchannel angeben.").queue(msg -> msg.delete().queueAfter(5, TimeUnit.SECONDS));
Expand Down

0 comments on commit b22839e

Please sign in to comment.