This commit is contained in:
GregTCLTK 2020-01-03 15:35:51 +01:00
parent ec6c295947
commit ba7eb974da
No known key found for this signature in database
GPG key ID: A91BADE5C070FF67
2 changed files with 103 additions and 94 deletions

View file

@ -82,8 +82,8 @@ public class RulesCommand implements Command {
if (event3.getMessage().getMentionedRoles().size() == 1) {
Role role = event3.getMessage().getMentionedRoles().get(0);
setRole(event, channel, message, event3, role);
} else if (event3.getGuild().getRolesByName(event3.getMessage().getContentStripped(), true).size() > 0) {
Role role = event3.getGuild().getRolesByName(event3.getMessage().getContentStripped(), true).get(0);
} else if (event3.getGuild().getRolesByName(event3.getMessage().getContentRaw(), true).size() > 0) {
Role role = event3.getGuild().getRolesByName(event3.getMessage().getContentRaw(), true).get(0);
setRole(event, channel, message, event3, role);
} else {
event3.getChannel().sendMessage(
@ -113,6 +113,7 @@ public class RulesCommand implements Command {
public void setRole(CommandEvent event, TextChannel channel, String message, GuildMessageReceivedEvent event3, Role role) {
if (event3.getGuild().getSelfMember().canInteract(role)) {
if (event3.getMember().canInteract(role)) {
event3.getChannel().sendMessage(
event.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
@ -213,6 +214,12 @@ public class RulesCommand implements Command {
}, event.getJDA(), event.getAuthor());
}
}, event.getJDA(), event.getAuthor());
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.moderation.rules.role.permission.error.title",
"commands.moderation.rules.role.permission.error.description")
.build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
}

View file

@ -136,6 +136,8 @@ 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.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
commands.moderation.rules.role.permission.error.description = You cannot select this role because you cannot interact with it.
commands.moderation.rules.guild.error.title = Wrong Guild
commands.moderation.rules.guild.error.description = The mentioned channel must be on this guild\!
commands.moderation.rules.emote.accept.title = Custom Accept Emote