diff --git a/Dockerfile b/Dockerfile
index bad7422..a443484 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,2 +1,2 @@
-FROM debian:buster
+FROM debian:latest
WORKDIR /home/Hadder
diff --git a/pom.xml b/pom.xml
index 6926c73..712e13f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,18 +19,18 @@
net.dv8tion
JDA
- 4.1.0_95
+ 4.1.0_93
org.json
json
20190722
-
- com.rethinkdb
- rethinkdb-driver
- 2.3.3
-
+
+ com.rethinkdb
+ rethinkdb-driver
+ 2.3.3
+
org.slf4j
slf4j-simple
@@ -39,7 +39,7 @@
club.minnced
discord-webhooks
- 0.2.0
+ 0.1.8
org.kohsuke
@@ -49,7 +49,7 @@
com.sedmelluq
lavaplayer
- 1.3.33
+ 1.3.32
diff --git a/src/main/java/com/bbn/hadder/Hadder.java b/src/main/java/com/bbn/hadder/Hadder.java
index b4a6cbb..f257042 100644
--- a/src/main/java/com/bbn/hadder/Hadder.java
+++ b/src/main/java/com/bbn/hadder/Hadder.java
@@ -102,8 +102,7 @@ public class Hadder {
new VolumeCommand(),
new StopCommand(),
new BlacklistCommand(),
- new PauseCommand(),
- new LoopCommand()), config, helpCommand);
+ new PauseCommand()), config, helpCommand);
builder.addEventListeners(
new MentionListener(rethink),
diff --git a/src/main/java/com/bbn/hadder/Rethink.java b/src/main/java/com/bbn/hadder/Rethink.java
index 5ff7c94..6ef9d10 100644
--- a/src/main/java/com/bbn/hadder/Rethink.java
+++ b/src/main/java/com/bbn/hadder/Rethink.java
@@ -70,22 +70,6 @@ public class Rethink {
}
}
- public void update(String table, String value, String what, int whatvalue) {
- try {
- r.table(table).get(value).update(r.hashMap(what, whatvalue)).run(conn);
- } catch (ClassCastException e) {
- e.printStackTrace();
- }
- }
-
- public void update(String table, String value, String what, boolean whatvalue) {
- try {
- r.table(table).get(value).update(r.hashMap(what, whatvalue)).run(conn);
- } catch (ClassCastException e) {
- e.printStackTrace();
- }
- }
-
public void insert(String table, Object object) {
try {
r.table(table).insert(object).run(conn);
@@ -138,8 +122,7 @@ public class Rethink {
}
public void insertGuild(String id) {
- this.insert("server", r
- .hashMap("id", id)
+ this.insert("server", r.hashMap("id", id)
.with("prefix", "h.")
.with("message_id", "")
.with("role_id", "")
@@ -150,11 +133,7 @@ public class Rethink {
}
public void insertUser(String id) {
- this.insert("user", r
- .hashMap("id", id)
- .with("prefix", "h.")
- .with("language", "en")
- .with("blacklisted", "none"));
+ this.insert("user", r.hashMap("id", id).with("prefix", "h.").with("language", "en").with("blacklisted", "none"));
}
public void setBlackListed(String id, String commands) {
@@ -225,7 +204,11 @@ public class Rethink {
}
public void setInviteDetection(String guild_id, boolean b) {
- this.update("server", guild_id, "invite_detect", b);
+ try {
+ r.table("server").get(guild_id).update(r.hashMap("invite_detect", b)).run(conn);
+ } catch (ClassCastException e) {
+ e.printStackTrace();
+ }
}
public Boolean getInviteDetection(String guild_id) {
diff --git a/src/main/java/com/bbn/hadder/audio/TrackManager.java b/src/main/java/com/bbn/hadder/audio/TrackManager.java
index 489c12f..b4c1e9a 100644
--- a/src/main/java/com/bbn/hadder/audio/TrackManager.java
+++ b/src/main/java/com/bbn/hadder/audio/TrackManager.java
@@ -19,7 +19,6 @@ public class TrackManager extends AudioEventAdapter {
private final AudioPlayer player;
private final Queue queue;
- private boolean loop = false;
public TrackManager(AudioPlayer player) {
this.player = player;
@@ -48,10 +47,8 @@ public class TrackManager extends AudioEventAdapter {
@Override
public void onTrackEnd(AudioPlayer player, AudioTrack track, AudioTrackEndReason endReason) {
- Guild g = queue.element().getAuthor().getGuild();
- if (loop) {
- player.playTrack(track.makeClone());
- } else if (queue.isEmpty()) {
+ Guild g = queue.poll().getAuthor().getGuild();
+ if (queue.isEmpty()) {
g.getAudioManager().closeAudioConnection();
} else {
player.playTrack(queue.element().getTrack());
@@ -70,16 +67,6 @@ public class TrackManager extends AudioEventAdapter {
queue.remove(entry);
}
- public boolean isLoop()
- {
- return loop;
- }
-
- public void setLoop(boolean repeating)
- {
- 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/music/LoopCommand.java b/src/main/java/com/bbn/hadder/commands/music/LoopCommand.java
deleted file mode 100644
index 5003134..0000000
--- a/src/main/java/com/bbn/hadder/commands/music/LoopCommand.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.bbn.hadder.commands.music;
-
-import com.bbn.hadder.commands.Command;
-import com.bbn.hadder.commands.CommandEvent;
-import com.bbn.hadder.utils.MessageEditor;
-
-/**
- * @author Skidder / GregTCLTK
- */
-
-public class LoopCommand implements Command {
-
- @Override
- public void executed(String[] args, CommandEvent event) {
- if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) {
- if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
- if (event.getAudioManager().getTrackManager(event.getGuild()).isLoop()) {
- event.getAudioManager().getTrackManager(event.getGuild()).setLoop(false);
- event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.unloop.title", "commands.music.loop.success.unloop.description").build()).queue();
- } else {
- event.getAudioManager().getTrackManager(event.getGuild()).setLoop(true);
- event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.loop.title", "commands.music.loop.success.loop.description").build()).queue();
- }
- } else {
- event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
- "commands.music.loop.error.connected.title",
- "commands.music.loop.error.connected.description")
- .build()).queue();
- }
- } else {
- event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
- "commands.music.info.error.title",
- "commands.music.info.error.description").build()).queue();
- }
- }
-
- @Override
- public String[] labels() {
- return new String[]{"loop", "repeat"};
- }
-
- @Override
- public String description() {
- return "commands.music.loop.help.description";
- }
-
- @Override
- public String usage() {
- return null;
- }
-
- @Override
- public String example() {
- return null;
- }
-}
diff --git a/src/main/resources/Translations/Translations_de.properties b/src/main/resources/Translations/Translations_de.properties
index bdd918a..862eb82 100644
--- a/src/main/resources/Translations/Translations_de.properties
+++ b/src/main/resources/Translations/Translations_de.properties
@@ -237,6 +237,13 @@ commands.music.pause.error.paused.description = The song is already paused.
commands.music.pause.error.connected.title = No channel
commands.music.pause.error.connected.description = You have to be in the same voice channel as the bot to pause the song.
commands.music.pause.help.description = Pause the playing song.
+commands.music.loop.success.loop.title = Erfolgreich aktiviert
+commands.music.loop.success.loop.description = I will now repeat the currently played song.
+commands.music.loop.success.unloop.title = Erfolgreich deaktiviert
+commands.music.loop.success.unloop.description = I will no longer repeat the currently played song.
+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.nsfw.gif.error.title = GIF wird nicht angezeigt? Klicke hier
commands.nsfw.img.error.title = Bild wird nicht angezeigt? Klicke hier
diff --git a/src/main/resources/Translations/Translations_es.properties b/src/main/resources/Translations/Translations_es.properties
index f5dd88b..a3a2891 100644
--- a/src/main/resources/Translations/Translations_es.properties
+++ b/src/main/resources/Translations/Translations_es.properties
@@ -237,6 +237,13 @@ commands.music.pause.error.paused.description = The song is already paused.
commands.music.pause.error.connected.title = No channel
commands.music.pause.error.connected.description = You have to be in the same voice channel as the bot to pause the song.
commands.music.pause.help.description = Pause the playing song.
+commands.music.loop.success.loop.title = Successfully activated
+commands.music.loop.success.loop.description = I will now repeat the currently played song.
+commands.music.loop.success.unloop.title = Successfully deactivated
+commands.music.loop.success.unloop.description = I will no longer repeat the currently played song.
+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.nsfw.gif.error.title = GIF not showing? Click here
commands.nsfw.img.error.title = Image not showing? Click here
diff --git a/src/main/resources/Translations/Translations_fr.properties b/src/main/resources/Translations/Translations_fr.properties
index f5dd88b..a3a2891 100644
--- a/src/main/resources/Translations/Translations_fr.properties
+++ b/src/main/resources/Translations/Translations_fr.properties
@@ -237,6 +237,13 @@ commands.music.pause.error.paused.description = The song is already paused.
commands.music.pause.error.connected.title = No channel
commands.music.pause.error.connected.description = You have to be in the same voice channel as the bot to pause the song.
commands.music.pause.help.description = Pause the playing song.
+commands.music.loop.success.loop.title = Successfully activated
+commands.music.loop.success.loop.description = I will now repeat the currently played song.
+commands.music.loop.success.unloop.title = Successfully deactivated
+commands.music.loop.success.unloop.description = I will no longer repeat the currently played song.
+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.nsfw.gif.error.title = GIF not showing? Click here
commands.nsfw.img.error.title = Image not showing? Click here
diff --git a/src/main/resources/Translations/Translations_ru.properties b/src/main/resources/Translations/Translations_ru.properties
index f5dd88b..a3a2891 100644
--- a/src/main/resources/Translations/Translations_ru.properties
+++ b/src/main/resources/Translations/Translations_ru.properties
@@ -237,6 +237,13 @@ commands.music.pause.error.paused.description = The song is already paused.
commands.music.pause.error.connected.title = No channel
commands.music.pause.error.connected.description = You have to be in the same voice channel as the bot to pause the song.
commands.music.pause.help.description = Pause the playing song.
+commands.music.loop.success.loop.title = Successfully activated
+commands.music.loop.success.loop.description = I will now repeat the currently played song.
+commands.music.loop.success.unloop.title = Successfully deactivated
+commands.music.loop.success.unloop.description = I will no longer repeat the currently played song.
+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.nsfw.gif.error.title = GIF not showing? Click here
commands.nsfw.img.error.title = Image not showing? Click here
diff --git a/src/main/resources/Translations/Translations_tr.properties b/src/main/resources/Translations/Translations_tr.properties
index f5dd88b..a3a2891 100644
--- a/src/main/resources/Translations/Translations_tr.properties
+++ b/src/main/resources/Translations/Translations_tr.properties
@@ -237,6 +237,13 @@ commands.music.pause.error.paused.description = The song is already paused.
commands.music.pause.error.connected.title = No channel
commands.music.pause.error.connected.description = You have to be in the same voice channel as the bot to pause the song.
commands.music.pause.help.description = Pause the playing song.
+commands.music.loop.success.loop.title = Successfully activated
+commands.music.loop.success.loop.description = I will now repeat the currently played song.
+commands.music.loop.success.unloop.title = Successfully deactivated
+commands.music.loop.success.unloop.description = I will no longer repeat the currently played song.
+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.nsfw.gif.error.title = GIF not showing? Click here
commands.nsfw.img.error.title = Image not showing? Click here
diff --git a/src/main/resources/Translations/Translations_zh.properties b/src/main/resources/Translations/Translations_zh.properties
index f5dd88b..a3a2891 100644
--- a/src/main/resources/Translations/Translations_zh.properties
+++ b/src/main/resources/Translations/Translations_zh.properties
@@ -237,6 +237,13 @@ commands.music.pause.error.paused.description = The song is already paused.
commands.music.pause.error.connected.title = No channel
commands.music.pause.error.connected.description = You have to be in the same voice channel as the bot to pause the song.
commands.music.pause.help.description = Pause the playing song.
+commands.music.loop.success.loop.title = Successfully activated
+commands.music.loop.success.loop.description = I will now repeat the currently played song.
+commands.music.loop.success.unloop.title = Successfully deactivated
+commands.music.loop.success.unloop.description = I will no longer repeat the currently played song.
+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.nsfw.gif.error.title = GIF not showing? Click here
commands.nsfw.img.error.title = Image not showing? Click here