Outsource yk

This commit is contained in:
GregTCLTK 2019-12-22 20:48:11 +01:00
parent 7bc151fc48
commit 6ea63342af
No known key found for this signature in database
GPG key ID: A91BADE5C070FF67
3 changed files with 44 additions and 19 deletions

View file

@ -91,6 +91,7 @@ public class Hadder {
new ClydeCommand(), new ClydeCommand(),
new PlayCommand(), new PlayCommand(),
new StarBoardCommand(), new StarBoardCommand(),
new QueueCommand(),
new StopCommand()), config, helpCommand); new StopCommand()), config, helpCommand);
builder.addEventListeners( builder.addEventListeners(

View file

@ -18,7 +18,6 @@ public class PlayCommand implements Command {
private static final String CD = "\uD83D\uDCBF"; private static final String CD = "\uD83D\uDCBF";
private static final String MIC = "\uD83C\uDFA4 **|>** "; */ private static final String MIC = "\uD83C\uDFA4 **|>** "; */
@Override @Override
public void executed(String[] args, CommandEvent event) { public void executed(String[] args, CommandEvent event) {
if (args.length > 0) { if (args.length > 0) {
@ -48,9 +47,6 @@ public class PlayCommand implements Command {
/* OUTSOURCE THIS /* OUTSOURCE THIS
Guild guild = event.getGuild(); Guild guild = event.getGuild();
if (args.length == 1) {
switch (args[0].toLowerCase()) {
case "info":
if (!hasPlayer(guild) || getPlayer(guild).getPlayingTrack() == null) { // No song is playing if (!hasPlayer(guild) || getPlayer(guild).getPlayingTrack() == null) { // No song is playing
event.getTextChannel().sendMessage("No song is being played at the moment! *It's your time to shine..*").queue(); event.getTextChannel().sendMessage("No song is being played at the moment! *It's your time to shine..*").queue();
} else { } else {
@ -59,21 +55,7 @@ public class PlayCommand implements Command {
"\n\u23F1 **|>** `[ " + getTimestamp(track.getPosition()) + " / " + getTimestamp(track.getInfo().length) + " ]`", "\n\u23F1 **|>** `[ " + getTimestamp(track.getPosition()) + " / " + getTimestamp(track.getInfo().length) + " ]`",
"\n" + MIC, getOrNull(track.getInfo().author), "\n" + MIC, getOrNull(track.getInfo().author),
"\n\uD83C\uDFA7 **|>** " + "")).queue(); "\n\uD83C\uDFA7 **|>** " + "")).queue();
} }*/
break;
case "queue":
if (!hasPlayer(guild) || getTrackManager(guild).getQueuedTracks().isEmpty()) {
event.getTextChannel().sendMessage("The queue is empty! Load a song with **"
+ "dd" + "music play**!").queue();
} else {
StringBuilder sb = new StringBuilder();
Set<AudioInfo> queue = getTrackManager(guild).getQueuedTracks();
queue.forEach(audioInfo -> sb.append(buildQueueMessage(audioInfo)));
}
break;
}
} */
} }

View file

@ -0,0 +1,42 @@
package com.bbn.hadder.commands.music;
import com.bbn.hadder.audio.AudioInfo;
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 java.util.Set;
/**
* @author Skidder / GregTCLTK
*/
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();
} else {
Set<AudioInfo> queue = new AudioManager().getTrackManager(event.getGuild()).getQueuedTracks();
// Insert message here
}
}
@Override
public String[] labels() {
return new String[]{"queue"};
}
@Override
public String description() {
return "Shows the music queue.";
}
@Override
public String usage() {
return "";
}
}