Merge remote-tracking branch 'origin/master' into hax-dev

This commit is contained in:
Hax 2020-01-03 15:59:02 +01:00
commit a9f8e9ed24
5 changed files with 112 additions and 103 deletions

View file

@ -19,7 +19,7 @@
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.1.0_90</version>
<version>4.1.0_93</version>
</dependency>
<dependency>
<groupId>org.json</groupId>

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

@ -1,15 +1,14 @@
package com.bbn.hadder.commands.music;
/*
* @author Skidder / GregTCLTK
*/
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.entities.VoiceChannel;
import net.dv8tion.jda.api.managers.AudioManager;
/*
* @author Skidder / GregTCLTK
*/
public class JoinCommand implements Command {

View file

@ -41,8 +41,9 @@ public class CommandHandler {
for (Perm perm : cmd.getClass().getAnnotation(Perms.class).value()) {
if (!perm.check(commandEvent)) {
commandEvent.getTextChannel()
.sendMessage(commandEvent.getMessageEditor().getMessage(MessageEditor.MessageType.NO_PERMISSION).build())
.queue();
.sendMessage(commandEvent.getMessageEditor().getMessage(MessageEditor.MessageType.NO_PERMISSION)
.setDescription("To execute this command, you need the `" + cmd.getClass().getAnnotation(Perms.class).value()[0] + "` permission.")
.build()).queue();
return;
}
}
@ -51,8 +52,8 @@ public class CommandHandler {
boolean run = true;
String blacklisted = rethink.getBlackListed(event.getAuthor().getId());
if (!"none".equals(blacklisted)) {
for (String blacklistedlabel : blacklisted.split(",")) {
if (Arrays.asList(cmd.labels()).contains(blacklistedlabel)) {
for (String BLLabel : blacklisted.split(",")) {
if (Arrays.asList(cmd.labels()).contains(BLLabel)) {
run = false;
}
}

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