Queue Command but queue is not working

This commit is contained in:
GregTCLTK 2019-12-23 15:32:34 +01:00
parent 2552062b9d
commit ef74e3240b
No known key found for this signature in database
GPG key ID: A91BADE5C070FF67
3 changed files with 17 additions and 4 deletions

View file

@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit;
public class AudioManager {
public AudioManager() {
AudioSourceManagers.registerRemoteSources(myManager);
}

View file

@ -5,6 +5,7 @@ import com.bbn.hadder.audio.AudioManager;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.EmbedBuilder;
import java.util.Set;
@ -17,11 +18,20 @@ public class QueueCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (!new AudioManager().hasPlayer(event.getGuild()) || new AudioManager().getTrackManager(event.getGuild()).getQueuedTracks().isEmpty()) {
event.getTextChannel().sendMessage(
event.getMessageEditor().getMessage(MessageEditor.MessageType.WARNING, "", "").build()).queue();
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.WARNING,
"commands.music.queue.error.title",
"commands.music.queue.error.description"
).build()).queue();
} else {
Set<AudioInfo> queue = new AudioManager().getTrackManager(event.getGuild()).getQueuedTracks();
// Insert message here
EmbedBuilder b = event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.music.queue.success.title",
"commands.music.queue.success.description")
.addField("Queued songs", String.valueOf(queue.size()), true);
for (AudioInfo g : queue) {
b.addField(g.getTrack().getInfo().author, g.getTrack().getInfo().title, true);
}
event.getTextChannel().sendMessage(b.build()).queue();
}
}

View file

@ -186,6 +186,10 @@ commands.music.play.help.description = Plays a song
commands.music.stop.success.title = Successfully stopped
commands.music.stop.success.description = I successfully stopped the song.
commands.music.stop.help.description = Stops the song
commands.music.queue.error.title = No queue
commands.music.queue.error.description = There are no queued songs at the moment
commands.music.queue.success.title = Queue
commands.music.queue.success.description = This is the queue: %extra%
commands.nsfw.gif.error.title = GIF not showing? Click here
commands.nsfw.img.error.title = Image not showing? Click here