diff --git a/pom.xml b/pom.xml index 46d460e..7548e0f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 Hadder Hadder - 1.1.0 + 1.0.3 Hadder @@ -66,7 +66,7 @@ com.rethinkdb rethinkdb-driver - 2.4.0 + 2.3.3 org.slf4j diff --git a/src/main/java/com/bbn/hadder/Rethink.java b/src/main/java/com/bbn/hadder/Rethink.java index aeaaf58..29b8346 100644 --- a/src/main/java/com/bbn/hadder/Rethink.java +++ b/src/main/java/com/bbn/hadder/Rethink.java @@ -136,18 +136,23 @@ public class Rethink { .with("blacklisted", "none")); } + // TODO + public boolean hasStarboardChannel(String guild_id) { + return !this.getByID("server", guild_id, "starboard").equals(""); + } + // TODO public void insertStarboardMessage(String message_id, String guild_id, String starboard_message_id) { this.insert("stars", r.hashMap("id", message_id).with("guild", guild_id).with("starboardmsg", starboard_message_id)); } - + // TODO public String getStarboardMessage(String message_id) { return (String) this.getByID("stars", message_id, "starboardmsg"); } - + // TODO public void removeStarboardMessage(String message_id) { this.remove("stars", "id", message_id); } - + // TODO public boolean hasStarboardMessage(String message_id) { try { this.getByID("stars", message_id, "guild"); @@ -157,6 +162,7 @@ public class Rethink { } } + public void pushServer(RethinkServer server) { JSONObject object = new JSONObject(); for (Field field : server.getClass().getDeclaredFields()) { diff --git a/src/main/java/com/bbn/hadder/RethinkServer.java b/src/main/java/com/bbn/hadder/RethinkServer.java index 200e13a..c15c448 100644 --- a/src/main/java/com/bbn/hadder/RethinkServer.java +++ b/src/main/java/com/bbn/hadder/RethinkServer.java @@ -24,15 +24,15 @@ public class RethinkServer { private Rethink rethink; - public String accept_emote = ""; - public String decline_emote = ""; - public String id; - public boolean invite_detect = false; - public String message_id = ""; - public String neededstars = "3"; - public String prefix = "h."; - public String role_id = ""; - public String starboard = ""; + String accept_emote = ""; + String decline_emote = ""; + String id; + boolean invite_detect = false; + String message_id = ""; + String neededstars = "3"; + String prefix = "h."; + String role_id = ""; + String starboard = ""; public RethinkServer(JSONObject object, Rethink rethink) { for (Field field : this.getClass().getDeclaredFields()) { @@ -68,7 +68,7 @@ public class RethinkServer { return id; } - public boolean hasInviteDetect() { + public boolean isInviteDetect() { return invite_detect; } @@ -116,10 +116,6 @@ public class RethinkServer { this.starboard = starboard; } - public boolean hasStarboardChannel() { - return !"".equals(starboard); - } - public void updateRules(String message_id, String role_id, String accept_emote, String decline_emote) { this.setMessageID(message_id); this.setRoleID(role_id); diff --git a/src/main/java/com/bbn/hadder/RethinkUser.java b/src/main/java/com/bbn/hadder/RethinkUser.java index cc3b41d..1d99ac5 100644 --- a/src/main/java/com/bbn/hadder/RethinkUser.java +++ b/src/main/java/com/bbn/hadder/RethinkUser.java @@ -24,10 +24,10 @@ public class RethinkUser { private Rethink rethink; - public String id; - public String prefix = "h."; - public String language = "en"; - public String blacklisted = "none"; + String id; + String prefix = "h."; + String language = "en"; + String blacklisted = "none"; public RethinkUser(JSONObject object, Rethink rethink) { for (Field field : this.getClass().getDeclaredFields()) { diff --git a/src/main/java/com/bbn/hadder/audio/AudioManager.java b/src/main/java/com/bbn/hadder/audio/AudioManager.java index 363581c..fe45e59 100644 --- a/src/main/java/com/bbn/hadder/audio/AudioManager.java +++ b/src/main/java/com/bbn/hadder/audio/AudioManager.java @@ -76,31 +76,17 @@ public class AudioManager { @Override public void trackLoaded(AudioTrack track) { - if (getTrackManager(guild).getQueuedTracks().isEmpty()) { - getTrackManager(guild).queue(track, event.getMember()); - msg.editMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, - "commands.music.play.success.loading.title", "⏯", - "", "") - .addField(event.getMessageEditor().getTerm("commands.music.play.success.title"), track.getInfo().title, false) - .addField(event.getMessageEditor().getTerm("commands.music.play.success.author"), track.getInfo().author, true) - .addField(event.getMessageEditor().getTerm("commands.music.play.success.length"), - String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(track.getInfo().length), - TimeUnit.MILLISECONDS.toMinutes(track.getInfo().length) % TimeUnit.HOURS.toMinutes(1), - TimeUnit.MILLISECONDS.toSeconds(track.getInfo().length) % TimeUnit.MINUTES.toSeconds(1)), true) - .build()).queue(); - } else { - getTrackManager(guild).queue(track, event.getMember()); - msg.editMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, - "commands.music.play.success.queueing.title", "⏺", - "", "") - .addField(event.getMessageEditor().getTerm("commands.music.play.success.title"), track.getInfo().title, false) - .addField(event.getMessageEditor().getTerm("commands.music.play.success.author"), track.getInfo().author, true) - .addField(event.getMessageEditor().getTerm("commands.music.play.success.length"), - String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(track.getInfo().length), - TimeUnit.MILLISECONDS.toMinutes(track.getInfo().length) % TimeUnit.HOURS.toMinutes(1), - TimeUnit.MILLISECONDS.toSeconds(track.getInfo().length) % TimeUnit.MINUTES.toSeconds(1)), true) - .build()).queue(); - } + getTrackManager(guild).queue(track, event.getMember()); + msg.editMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, + "commands.music.play.success.loading.title", "⏯", + "", "") + .addField(event.getMessageEditor().getTerm("commands.music.play.success.title"), track.getInfo().title, false) + .addField(event.getMessageEditor().getTerm("commands.music.play.success.author"), track.getInfo().author, true) + .addField(event.getMessageEditor().getTerm("commands.music.play.success.length"), + String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(track.getInfo().length), + TimeUnit.MILLISECONDS.toMinutes(track.getInfo().length) % TimeUnit.HOURS.toMinutes(1), + TimeUnit.MILLISECONDS.toSeconds(track.getInfo().length) % TimeUnit.MINUTES.toSeconds(1)), true) + .build()).queue(); } @Override diff --git a/src/main/java/com/bbn/hadder/audio/AudioPlayerSendHandler.java b/src/main/java/com/bbn/hadder/audio/AudioPlayerSendHandler.java index 17b49f9..cdbda28 100644 --- a/src/main/java/com/bbn/hadder/audio/AudioPlayerSendHandler.java +++ b/src/main/java/com/bbn/hadder/audio/AudioPlayerSendHandler.java @@ -18,13 +18,12 @@ package com.bbn.hadder.audio; import com.sedmelluq.discord.lavaplayer.player.AudioPlayer; import com.sedmelluq.discord.lavaplayer.track.playback.AudioFrame; -import net.dv8tion.jda.api.audio.AudioReceiveHandler; import net.dv8tion.jda.api.audio.AudioSendHandler; import javax.annotation.Nullable; import java.nio.ByteBuffer; -public class AudioPlayerSendHandler implements AudioSendHandler, AudioReceiveHandler { +public class AudioPlayerSendHandler implements AudioSendHandler { private final AudioPlayer audioPlayer; private AudioFrame lastFrame; diff --git a/src/main/java/com/bbn/hadder/audio/TrackManager.java b/src/main/java/com/bbn/hadder/audio/TrackManager.java index 669f32c..bb4141f 100644 --- a/src/main/java/com/bbn/hadder/audio/TrackManager.java +++ b/src/main/java/com/bbn/hadder/audio/TrackManager.java @@ -63,19 +63,17 @@ public class TrackManager extends AudioEventAdapter { @Override public void onTrackEnd(AudioPlayer player, AudioTrack track, AudioTrackEndReason endReason) { + Guild g = queue.poll().getAuthor().getGuild(); + this.lastTrack = track; if (loop) { - this.lastTrack = track; player.playTrack(lastTrack.makeClone()); + } else if (queue.isEmpty()) { + manager.players.remove(g.getId()); + manager.getPlayer(g).destroy(); + manager.getTrackManager(g).purgeQueue(); + g.getAudioManager().closeAudioConnection(); } else { - Guild g = queue.poll().getAuthor().getGuild(); - manager.getPlayer(g).stopTrack(); - if (!queue.isEmpty()) player.playTrack(queue.element().getTrack().makeClone()); - else { - manager.players.remove(g.getId()); - manager.getPlayer(g).destroy(); - manager.getTrackManager(g).purgeQueue(); - g.getAudioManager().closeAudioConnection(); - } + player.playTrack(queue.element().getTrack()); } } @@ -100,4 +98,8 @@ public class TrackManager extends AudioEventAdapter { { this.loop = repeating; } + + public AudioInfo getTrackInfo(AudioTrack track) { + return queue.stream().filter(audioInfo -> audioInfo.getTrack().equals(track)).findFirst().orElse(null); + } } diff --git a/src/main/java/com/bbn/hadder/commands/misc/CodeCommand.java b/src/main/java/com/bbn/hadder/commands/misc/CodeCommand.java index a154bb2..728a975 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/CodeCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/CodeCommand.java @@ -41,12 +41,11 @@ public class CodeCommand implements Command { "commands.misc.code.success.description") .addField("Code", "[" + args[0] + "](https://discord.gg/" + args[0] + ")", true) .addField("Guild Name", json.getJSONObject("guild").getString("name"), true) - .addBlankField(true) - .addField("Verification Level", String.valueOf(json.getJSONObject("guild").getInt("verification_level")), true) .addField("Guild ID", json.getJSONObject("guild").getString("id"), true) - .addBlankField(true) + .addField("Verification Level", json.getJSONObject("guild").getString("verification_level"), true) .setThumbnail("https://cdn.discordapp.com/icons/" + json.getJSONObject("guild").getString("id") + "/" + json.getJSONObject("guild").getString("icon") + ".png") .build()).queue(); + e.getTextChannel().sendMessage(json.toString()).queue(); } catch (JSONException ex) { e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.code.error.title", diff --git a/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java b/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java index 009a8a0..6ea8bbf 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java @@ -43,7 +43,6 @@ public class ServerStatsCommand implements Command { .addField("Member Count", String.valueOf(e.getGuild().getMemberCount()), true) .addField("Explicit Content Level", e.getGuild().getExplicitContentLevel().getKey() + ": " + e.getGuild().getExplicitContentLevel(), true) .addField("Features", e.getGuild().getFeatures().toString().replaceAll("\\[", "`").replaceAll(",", "`, `").replaceAll("]", "`"), true) - .addBlankField(true) .setThumbnail(e.getGuild().getIconUrl()) .setImage(e.getGuild().getBannerUrl()); diff --git a/src/main/java/com/bbn/hadder/commands/moderation/InviteDetectCommand.java b/src/main/java/com/bbn/hadder/commands/moderation/InviteDetectCommand.java index 5205372..faad4da 100644 --- a/src/main/java/com/bbn/hadder/commands/moderation/InviteDetectCommand.java +++ b/src/main/java/com/bbn/hadder/commands/moderation/InviteDetectCommand.java @@ -31,7 +31,7 @@ public class InviteDetectCommand implements Command { String opinion = args[0].toLowerCase(); switch (opinion) { case "on": - if (!e.getRethinkServer().hasInviteDetect()) { + if (!e.getRethinkServer().isInviteDetect()) { e.getRethinkServer().setInviteDetect(true); e.getTextChannel().sendMessage( e.getMessageEditor().getMessage( @@ -50,7 +50,7 @@ public class InviteDetectCommand implements Command { break; case "off": - if (e.getRethinkServer().hasInviteDetect()) { + if (e.getRethinkServer().isInviteDetect()) { e.getRethinkServer().setInviteDetect(false); e.getTextChannel().sendMessage(e.getMessageEditor().getMessage( MessageEditor.MessageType.INFO, diff --git a/src/main/java/com/bbn/hadder/commands/moderation/RegionChangeCommand.java b/src/main/java/com/bbn/hadder/commands/moderation/RegionChangeCommand.java index 5e7efcf..59c7a0d 100644 --- a/src/main/java/com/bbn/hadder/commands/moderation/RegionChangeCommand.java +++ b/src/main/java/com/bbn/hadder/commands/moderation/RegionChangeCommand.java @@ -86,16 +86,17 @@ public class RegionChangeCommand implements Command { case "us-south": setRegion(Region.US_SOUTH, "US South", e); break; - case "south-korea": + /*case "south-korea": setRegion(Region.SOUTH_KOREA, "South Korea", e); break; + TODO: Publish when JDA v4.2.0 is released*/ default: e.getTextChannel().sendMessage( e.getMessageEditor().getMessage( MessageEditor.MessageType.INFO, "commands.moderation.regionchange.regions.title", "") - .setDescription("**LOCKED:**\n`amsterdam` `frankfurt` `eu-west` `eu-central` `london` `south korea`\n\n**UNLOCKED:**\n`europe` `brazil` `hongkong` `india` `japan` `singapore` `south-africa` `sydney` `us-central` `us-east` `us-west` `us-south`") + .setDescription("**LOCKED:**\n`amsterdam` `frankfurt` `eu-west` `eu-central` `london`\n\n**UNLOCKED:**\n`europe` `brazil` `hongkong` `india` `japan` `singapore` `south-africa` `sydney` `us-central` `us-east` `us-west` `us-south`") .build()).queue(); break; } @@ -123,7 +124,7 @@ public class RegionChangeCommand implements Command { @Override public String[] labels() { - return new String[]{"changeregion", "cr", "change-region", "region"}; + return new String[]{"changeregion", "cr", "change-region"}; } @Override diff --git a/src/main/java/com/bbn/hadder/commands/music/EchoCommand.java b/src/main/java/com/bbn/hadder/commands/music/EchoCommand.java index 35beaf4..268498b 100644 --- a/src/main/java/com/bbn/hadder/commands/music/EchoCommand.java +++ b/src/main/java/com/bbn/hadder/commands/music/EchoCommand.java @@ -16,28 +16,68 @@ package com.bbn.hadder.commands.music; -import com.bbn.hadder.audio.AudioPlayerSendHandler; import com.bbn.hadder.commands.Command; import com.bbn.hadder.commands.CommandEvent; +import com.bbn.hadder.core.Perm; +import com.bbn.hadder.core.Perms; +import net.dv8tion.jda.api.audio.*; import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.managers.AudioManager; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.nio.ByteBuffer; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; + +@Perms(Perm.BOT_OWNER) public class EchoCommand implements Command { @Override - public void executed(String[] args, CommandEvent e) { - Guild guild = e.getMember().getVoiceState().getChannel().getGuild(); + public void executed(String[] args, CommandEvent event) { + Guild guild = event.getMember().getVoiceState().getChannel().getGuild(); AudioManager audioManager = guild.getAudioManager(); - AudioPlayerSendHandler handler = new AudioPlayerSendHandler(e.getAudioManager().getPlayer(e.getGuild())); + EchoHandler handler = new EchoHandler(); if (!audioManager.isConnected()) { audioManager.setSendingHandler(handler); audioManager.setReceivingHandler(handler); - audioManager.openAudioConnection(e.getMember().getVoiceState().getChannel()); + audioManager.openAudioConnection(event.getMember().getVoiceState().getChannel()); } else { audioManager.closeAudioConnection(); } } + public static class EchoHandler implements AudioSendHandler, AudioReceiveHandler { + + private final Queue queue = new ConcurrentLinkedQueue<>(); + + @Override + public boolean canProvide() { + return !queue.isEmpty(); + } + + @Nullable + @Override + public ByteBuffer provide20MsAudio() { + byte[] data = queue.poll(); + return data == null ? null : ByteBuffer.wrap(data); // Wrap this in a java.nio.ByteBuffer + } + + @Override + public boolean canReceiveCombined() { + return queue.size() < 10; + } + + @Override + public void handleCombinedAudio(@Nonnull CombinedAudio combinedAudio) { + if (combinedAudio.getUsers().isEmpty()) + return; + + byte[] data = combinedAudio.getAudioData(1.0f); // volume at 100% = 1.0 (50% = 0.5 / 55% = 0.55) + queue.add(data); + } + } + @Override public String[] labels() { return new String[]{"echo"}; @@ -45,7 +85,7 @@ public class EchoCommand implements Command { @Override public String description() { - return "commands.music.echo.help.description"; + return null; } @Override @@ -57,4 +97,5 @@ public class EchoCommand implements Command { public String example() { return null; } + } diff --git a/src/main/java/com/bbn/hadder/commands/music/RecordCommand.java b/src/main/java/com/bbn/hadder/commands/music/RecordCommand.java index 95ca154..48339ed 100644 --- a/src/main/java/com/bbn/hadder/commands/music/RecordCommand.java +++ b/src/main/java/com/bbn/hadder/commands/music/RecordCommand.java @@ -1,17 +1,5 @@ /* - * Copyright 2019-2020 GregTCLTK and Schlauer-Hax - * - * Licensed under the GNU Affero General Public License, Version 3.0; - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.gnu.org/licenses/agpl-3.0.en.html - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * @author Hax / Hax6775 / Schlauer_Hax */ package com.bbn.hadder.commands.music; @@ -95,7 +83,7 @@ public class RecordCommand implements Command { @Override public String[] labels() { - return new String[]{"record"}; + return new String[]{"echo"}; } @Override diff --git a/src/main/java/com/bbn/hadder/commands/music/SkipCommand.java b/src/main/java/com/bbn/hadder/commands/music/SkipCommand.java index be1a5b1..9500988 100644 --- a/src/main/java/com/bbn/hadder/commands/music/SkipCommand.java +++ b/src/main/java/com/bbn/hadder/commands/music/SkipCommand.java @@ -33,7 +33,7 @@ public class SkipCommand implements Command { } else { e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.music.skip.error.connected.title", - "commands.music.skip.error.connected.description").build()).queue(); + "commands.music.skip.error.connected.description ").build()).queue(); } } else { e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, diff --git a/src/main/java/com/bbn/hadder/commands/owner/EvalCommand.java b/src/main/java/com/bbn/hadder/commands/owner/EvalCommand.java index f573ce5..5b5f512 100644 --- a/src/main/java/com/bbn/hadder/commands/owner/EvalCommand.java +++ b/src/main/java/com/bbn/hadder/commands/owner/EvalCommand.java @@ -43,6 +43,7 @@ public class EvalCommand implements Command { } catch (ScriptException ex) { ex.printStackTrace(); } + engine.put("msg".toLowerCase(), e.getMessage()); engine.put("shardmanager".toLowerCase(), Hadder.shardManager); engine.put("rethink".toLowerCase(), e.getRethink()); diff --git a/src/main/java/com/bbn/hadder/listener/InviteLinkListener.java b/src/main/java/com/bbn/hadder/listener/InviteLinkListener.java index ea00e93..88aa3ee 100644 --- a/src/main/java/com/bbn/hadder/listener/InviteLinkListener.java +++ b/src/main/java/com/bbn/hadder/listener/InviteLinkListener.java @@ -41,11 +41,11 @@ public class InviteLinkListener extends ListenerAdapter { @Override public void onMessageReceived(@Nonnull MessageReceivedEvent e) { + RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink); if (e.isFromType(ChannelType.TEXT)) { - RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink); - if (e.getMessage().getContentRaw().contains("discord.gg/") && (!e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.hasInviteDetect())) { + if (e.getMessage().getContentRaw().contains("discord.gg/") && (!e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.isInviteDetect())) { checkInvite(e.getMessage(), "discord.gg/"); - } else if (e.getMessage().getContentRaw().contains("discordapp.com/invite") && !e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.hasInviteDetect()) { + } else if (e.getMessage().getContentRaw().contains("discordapp.com/invite") && (!e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.isInviteDetect())) { checkInvite(e.getMessage(), "discordapp.com/invite/"); } } @@ -69,11 +69,11 @@ public class InviteLinkListener extends ListenerAdapter { @Override public void onMessageUpdate(@Nonnull MessageUpdateEvent e) { + RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink); if (e.isFromType(ChannelType.TEXT)) { - RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink); - if (e.getMessage().getContentRaw().contains("discord.gg/") && !e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.hasInviteDetect()) { + if (e.getMessage().getContentRaw().contains("discord.gg/") && !e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.isInviteDetect()) { checkInvite(e.getMessage(), "discord.gg/"); - } else if (e.getMessage().getContentRaw().contains("discordapp.com/invite") && !e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.hasInviteDetect()) { + } else if (e.getMessage().getContentRaw().contains("discordapp.com/invite") && !e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.isInviteDetect()) { checkInvite(e.getMessage(), "discordapp.com/invite/"); } } diff --git a/src/main/java/com/bbn/hadder/listener/StarboardListener.java b/src/main/java/com/bbn/hadder/listener/StarboardListener.java index 2467ad5..ba66f81 100644 --- a/src/main/java/com/bbn/hadder/listener/StarboardListener.java +++ b/src/main/java/com/bbn/hadder/listener/StarboardListener.java @@ -50,7 +50,7 @@ public class StarboardListener extends ListenerAdapter { if (e.getReaction().getReactionEmote().getName().equals("⭐")) { RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink); if (!rethink.hasStarboardMessage(e.getMessageId())) { - if (rethinkServer.hasStarboardChannel()) { + if (rethink.hasStarboardChannel(e.getGuild().getId())) { e.getTextChannel().retrieveMessageById(e.getMessageId()).queue( msg -> { int stars = 0; diff --git a/src/main/java/com/bbn/hadder/listener/VoiceLeaveListener.java b/src/main/java/com/bbn/hadder/listener/VoiceLeaveListener.java index 753cf7f..d53391f 100644 --- a/src/main/java/com/bbn/hadder/listener/VoiceLeaveListener.java +++ b/src/main/java/com/bbn/hadder/listener/VoiceLeaveListener.java @@ -30,7 +30,7 @@ public class VoiceLeaveListener extends ListenerAdapter { @Override public void onGuildVoiceLeave(GuildVoiceLeaveEvent e) { - if (!e.getMember().getUser().isBot() && audioManager.hasPlayer(e.getGuild()) && e.getChannelLeft().getMembers().size() == 1 && e.getChannelLeft().getMembers().get(0).equals(e.getGuild().getSelfMember())) { + if (audioManager.hasPlayer(e.getGuild()) && e.getChannelLeft().getMembers().equals(e.getGuild().getSelfMember())) { audioManager.players.remove(e.getGuild().getId()); audioManager.getPlayer(e.getGuild()).destroy(); audioManager.getTrackManager(e.getGuild()).purgeQueue(); diff --git a/src/main/resources/Translations/Translations_de.properties b/src/main/resources/Translations/Translations_de.properties index b71565c..1c0ee4f 100644 --- a/src/main/resources/Translations/Translations_de.properties +++ b/src/main/resources/Translations/Translations_de.properties @@ -87,16 +87,16 @@ commands.misc.screenshare.number.error.description = Dies ist keine Zahl. commands.misc.screenshare.channel.existing.error = Warte ma' commands.misc.screenshare.channel.existing.description = Es existiert kein Sprachkanal mit diesem Namen. \n\nHinweis\: Stelle sicher, dass der Sprachkanal auf diesem Server ist. commands.misc.screenshare.help.description = Zeigt dir den Link zum Teilen deines Bildschirms. -commands.misc.serverstats.title = Serverstats +commands.misc.serverstats.title = Serverstatistiken commands.misc.serverstats.description = This message contains some information about `%extra%` commands.misc.serverstats.help.description = Shows information about a server. -commands.misc.profile.error.title = Not found -commands.misc.profile.error.description = I can't find the specified user. +commands.misc.profile.error.title = Nicht gefunden +commands.misc.profile.error.description = Ich kann den angegebenen Benutzer nicht finden. commands.misc.profile.help.description = Shows some information about the specified user. -commands.misc.code.success.title = Invite code information -commands.misc.code.success.description = This message contains some information about the specified invite code. -commands.misc.code.error.title = Code not found -commands.misc.code.error.description = I can't find the specified invite code. +commands.misc.code.success.title = Informationen zum Einladungscode +commands.misc.code.success.description = Diese Nachricht enthält einige Informationen über den angegebenen Einladungscode. +commands.misc.code.error.title = Code nicht gefunden +commands.misc.code.error.description = Ich kann den angegebenen Einladungscode nicht finden. commands.misc.code.help.description = Shows information about a invite code. commands.moderation.ban.success.title = Erfolgreich gebannt @@ -165,7 +165,7 @@ commands.moderation.rules.role.permission.error.title = Keine Berechtigung commands.moderation.rules.role.permission.error.description = You cannot select this role because you cannot interact with it. commands.moderation.rules.guild.error.title = Falsche Guild commands.moderation.rules.guild.error.description = Der erwähnte Kanal muss auf diesem Server sein\! -commands.moderation.rules.emote.accept.title = Custom Accept Emote +commands.moderation.rules.emote.accept.title = Benutzerdefiniertes Zustimmungsemote commands.moderation.rules.emote.accept.description = The role has been successfully set to %extra%. Now send me the emote on which your user should react to to get verified. commands.moderation.rules.emote.decline.title = Custom Decline Emote commands.moderation.rules.emote.decline.description = The first emote has been successfully set to %extra%. Please send me now the decline emote. @@ -196,7 +196,7 @@ commands.moderation.editrules.message.description = Please send me the new rules commands.moderation.editrules.error.title = Keine Regeln commands.moderation.editrules.error.description = There is nor rules message in this server. Please setup the rules first with %extra%rules commands.moderation.editrules.success.title = Erfolgreich geändert -commands.moderation.editrules.success.description = I successfully changed the rules +commands.moderation.editrules.success.description = Ich habe erfolgreich die Regeln geändert commands.moderation.editrules.help.description = Bearbeitet die Regelnachricht. commands.music.bass.error.connected.title = Kein Kanal @@ -232,7 +232,7 @@ commands.music.play.error.load.description = Leider kann ich das angegebene Lied commands.music.play.error.match.title = %extra% Keine Treffer %extra% commands.music.play.error.match.description = Ich kann keinen Song mit diesem Namen auf YouTube finden commands.music.play.success.unpause.title = Erfolgreich fortgesetzt -commands.music.play.success.unpause.description = I successfully continued playing the song. +commands.music.play.success.unpause.description = Ich habe erfolgreich den Song fortgesetzt. commands.music.play.error.connected.title = Kein Kanal commands.music.play.error.connected.description = Du musst im selben Sprachkanal wie der Bot sein, um den Song fortzusetzen. commands.music.play.help.description = Spielt den angegebenen Song ab. @@ -317,7 +317,7 @@ commands.owner.blacklist.success.remove.description = I successfully removed the commands.owner.blacklist.help.description = Blacklist a user for specific commands commands.settings.language.success.title = Sprache festgelegt -commands.settings.language.success.description = `%extra%` is your new language now. +commands.settings.language.success.description = `%extra%` ist jetzt deine neue Sprache. commands.settings.language.help.description = Führt den angegebenen Code aus. commands.settings.prefix.success.title = Erfolgreich festgelegt commands.settings.prefix.success.description = Ich habe erfolgreich den neuen Prefix für dich auf `%extra% `gesetzt. diff --git a/src/main/resources/Translations/Translations_en.properties b/src/main/resources/Translations/Translations_en.properties index f21bac2..75aaadd 100644 --- a/src/main/resources/Translations/Translations_en.properties +++ b/src/main/resources/Translations/Translations_en.properties @@ -117,17 +117,17 @@ commands.moderation.clear.message.error.title = No messages\! commands.moderation.clear.message.error.description = There are no messages in this channel. commands.moderation.clear.help.description = Deletes the specified number of messages. commands.moderation.prefix.success.title = %extra% Successfully set %extra% -commands.moderation.prefix.success.description = I successfully set the new prefix for the server to `%extra%`. +commands.moderation.prefix.success.description = I successfully set the new prefix for the guild to `%extra%`. commands.moderation.prefix.error.description = The prefix must not contain **"** commands.moderation.prefix.help.description = Sets the Guild-Prefix. commands.moderation.invitedetect.activate.success.title = Successfully activated -commands.moderation.invitedetect.activate.success.description = I successfully activated the invite link detection for this server. +commands.moderation.invitedetect.activate.success.description = I successfully activated the invite link detection for this guild. commands.moderation.invitedetect.activate.error.title = Already activated -commands.moderation.invitedetect.activate.error.description = The invite link detection is already activated on this server. +commands.moderation.invitedetect.activate.error.description = The invite link detection is already activated on this guild. commands.moderation.invitedetect.deactivate.success.title = Successfully deactivated -commands.moderation.invitedetect.deactivate.success.description = I successfully deactivated the invite link detection for this server. +commands.moderation.invitedetect.deactivate.success.description = I successfully deactivated the invite link detection for this guild. commands.moderation.invitedetect.deactivate.error.title = Already deactivated -commands.moderation.invitedetect.deactivate.error.description = The invite link detection is already deactivated on this server. +commands.moderation.invitedetect.deactivate.error.description = The invite link detection is already deactivated on this guild. commands.moderation.invitedetect.help.description = Activate or deactivate the Discord invite link detection. commands.moderation.kick.success.title = %extra% Successfully kicked %extra% commands.moderation.kick.success.description = I successfully kicked %extra%. @@ -160,11 +160,11 @@ commands.moderation.rules.rules.description = The channel was successfully set t 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 server. +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 server\! +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.description = The role has been successfully set to %extra%. Now send me the emote on which your user should react to to get verified. commands.moderation.rules.emote.decline.title = Custom Decline Emote @@ -223,7 +223,6 @@ commands.music.leave.help.description = Leaves your voice channel. commands.music.play.load.title = %extra% Now loading %extra% commands.music.play.load.description = Trying to load the song... commands.music.play.success.loading.title = %extra% Now playing %extra% -commands.music.play.success.queueing.title = %extra% Added to queue %extra% commands.music.play.success.title = Title commands.music.play.success.author = Author commands.music.play.success.length = Length @@ -277,7 +276,6 @@ commands.music.loop.success.unloop.description = I will no longer repeat the cur commands.music.loop.error.connected.title = No channel commands.music.loop.error.connected.description = You have to be in the same voice channel as the bot to set the repeat status. commands.music.loop.help.description = Repeats a song/queue. -commands.music.echo.help.description = Sends your voice through Hadder. commands.nsfw.gif.error.title = GIF not showing? Click here commands.nsfw.img.error.title = Image not showing? Click here @@ -305,8 +303,8 @@ commands.owner.eval.help.description = Execute the given code commands.owner.guildleave.success.title = Successfully left commands.owner.guildleave.success.description = I successfully left %extra%. commands.owner.guildleave.error.title = Can not leave -commands.owner.guildleave.error.description = I can not leave from this server. Maybe this isn't a ID? -commands.owner.guildleave.help.description = Quit from a server +commands.owner.guildleave.error.description = I can not leave from this guild. Maybe this isn't a ID? +commands.owner.guildleave.help.description = Quit from a guild commands.owner.reboot.help.description = Restart the bot commands.owner.shutdown.success.title = Shutdown commands.owner.shutdown.help.description = Shuts the Bot down