Merge Greg's branch into the master branch #297

Merged
greg6775 merged 14 commits from greg-dev into master 2020-01-03 15:37:09 +01:00
2 changed files with 103 additions and 94 deletions
Showing only changes of commit ba7eb974da - Show all commits

View file

@ -82,8 +82,8 @@ public class RulesCommand implements Command {
if (event3.getMessage().getMentionedRoles().size() == 1) { if (event3.getMessage().getMentionedRoles().size() == 1) {
Role role = event3.getMessage().getMentionedRoles().get(0); Role role = event3.getMessage().getMentionedRoles().get(0);
setRole(event, channel, message, event3, role); setRole(event, channel, message, event3, role);
} else if (event3.getGuild().getRolesByName(event3.getMessage().getContentStripped(), true).size() > 0) { } else if (event3.getGuild().getRolesByName(event3.getMessage().getContentRaw(), true).size() > 0) {
Role role = event3.getGuild().getRolesByName(event3.getMessage().getContentStripped(), true).get(0); Role role = event3.getGuild().getRolesByName(event3.getMessage().getContentRaw(), true).get(0);
setRole(event, channel, message, event3, role); setRole(event, channel, message, event3, role);
} else { } else {
event3.getChannel().sendMessage( 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) { public void setRole(CommandEvent event, TextChannel channel, String message, GuildMessageReceivedEvent event3, Role role) {
if (event3.getGuild().getSelfMember().canInteract(role)) { if (event3.getGuild().getSelfMember().canInteract(role)) {
if (event3.getMember().canInteract(role)) {
event3.getChannel().sendMessage( event3.getChannel().sendMessage(
event.getMessageEditor().getMessage( event.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO, MessageEditor.MessageType.INFO,
@ -213,6 +214,12 @@ public class RulesCommand implements Command {
}, event.getJDA(), event.getAuthor()); }, event.getJDA(), event.getAuthor());
} }
}, 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 { } else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue(); 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.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.title = Role does not exist
commands.moderation.rules.role.error.description = The specified role does not exist on this guild. 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.title = Wrong Guild
commands.moderation.rules.guild.error.description = The mentioned channel must be on this guild\! commands.moderation.rules.guild.error.description = The mentioned channel must be on this guild\!
commands.moderation.rules.emote.accept.title = Custom Accept Emote commands.moderation.rules.emote.accept.title = Custom Accept Emote