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> <dependency>
<groupId>net.dv8tion</groupId> <groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId> <artifactId>JDA</artifactId>
<version>4.1.0_90</version> <version>4.1.0_93</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.json</groupId> <groupId>org.json</groupId>

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

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

View file

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