- #317

Merged
greg6775 merged 72 commits from master into greg-dev 2020-01-13 08:40:12 +01:00
2 changed files with 10 additions and 4 deletions
Showing only changes of commit aebe60d27c - Show all commits

View file

@ -22,7 +22,7 @@ public class RulesListener extends ListenerAdapter {
if (event.getMessageId().equals(rethink.getRulesMID(event.getGuild().getId())) && !event.getMember().getUser().isBot()) {
if (event.getReactionEmote().isEmote()) {
if (rethink.getRulesAEmote(event.getGuild().getId()).equals(event.getReactionEmote().getId())) {
event.getGuild().addRoleToMember(event.getMember(), event.getGuild().getRoleById(rethink.getRulesRID(event.getGuild().getId()))).reason("Accepted rules").queue();
addRole(event);
} else if (rethink.getRulesDEmote(event.getGuild().getId()).equals(event.getReactionEmote().getId())) {
event.getReaction().removeReaction(event.getUser()).queue();
if (event.getGuild().getSelfMember().canInteract(event.getMember())) {
@ -31,7 +31,7 @@ public class RulesListener extends ListenerAdapter {
}
} else if (event.getReactionEmote().isEmoji()) {
if (rethink.getRulesAEmote(event.getGuild().getId()).equals(event.getReactionEmote().getEmoji())) {
event.getGuild().addRoleToMember(event.getMember(), event.getGuild().getRoleById(rethink.getRulesRID(event.getGuild().getId()))).reason("Accepted rules").queue();
addRole(event);
} else if (rethink.getRulesDEmote(event.getGuild().getId()).equals(event.getReactionEmote().getEmoji())) {
event.getReaction().removeReaction(event.getUser()).queue();
if (event.getGuild().getSelfMember().canInteract(event.getMember())) {
@ -42,6 +42,12 @@ public class RulesListener extends ListenerAdapter {
}
}
private void addRole(MessageReactionAddEvent event) {
if (event.getMember().getRoles().contains(event.getGuild().getRoleById(rethink.getRulesRID(event.getGuild().getId())))) {
event.getGuild().removeRoleFromMember(event.getMember(), event.getGuild().getRoleById(rethink.getRulesRID(event.getGuild().getId()))).reason("Accepted rules").queue();
} else event.getGuild().addRoleToMember(event.getMember(), event.getGuild().getRoleById(rethink.getRulesRID(event.getGuild().getId()))).reason("Accepted rules").queue();
}
@Override
public void onMessageReactionRemove(MessageReactionRemoveEvent event) {
if (event.getMessageId().equals(rethink.getRulesMID(event.getGuild().getId())) && !event.getMember().getUser().isBot()) {

View file

@ -132,8 +132,8 @@ commands.moderation.rules.channel.error.title = Channel not found
commands.moderation.rules.channel.error.description = I can't find the specified channel. Please start the setup again.
commands.moderation.rules.rules.title = Rules message
commands.moderation.rules.rules.description = The channel was successfully set to %extra%. Please send me the rules now.
commands.moderation.rules.role.title = Role to assign
commands.moderation.rules.role.description = The rules were successfully set. Please send me the name of the role which the user receives after he accepted the rules.
commands.moderation.rules.role.title = Role to assign/remove
commands.moderation.rules.role.description = The rules were successfully set. Please send me the name of the role which the user receives/loses after he accepted the rules.
commands.moderation.rules.role.error.title = Role does not exist
commands.moderation.rules.role.error.description = The specified role does not exist on this guild.
commands.moderation.rules.role.permission.error.title = No permission