=Fixing Youtube Player
This commit is contained in:
@@ -15,6 +15,9 @@ public class CommandMusicMain extends Command
|
||||
framework.addCommand("join", new SubCommandJoin(KittyRole.General, KittyRating.Safe));
|
||||
framework.addCommand("leave", new SubCommandLeave(KittyRole.General, KittyRating.Safe));
|
||||
framework.addCommand("add", new SubCommandAddTrack(KittyRole.General, KittyRating.Safe));
|
||||
framework.addCommand("skip", new SubCommandSkip(KittyRole.General, KittyRating.Safe));
|
||||
framework.addCommand("stop", new SubCommandStop(KittyRole.General, KittyRating.Safe));
|
||||
framework.addCommand("playlist", new SubCommandPlaylist(KittyRole.General, KittyRating.Safe));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,7 +9,6 @@ import dataStructures.KittyRole;
|
||||
import dataStructures.KittyUser;
|
||||
import dataStructures.UserInput;
|
||||
import network.NetworkYoutube;
|
||||
import utils.audio.AudioController;
|
||||
|
||||
public class SubCommandAddTrack extends SubCommand
|
||||
{
|
||||
@@ -17,16 +16,17 @@ public class SubCommandAddTrack extends SubCommand
|
||||
public SubCommandAddTrack(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||
|
||||
NetworkYoutube YT = new NetworkYoutube();
|
||||
AudioController ac = new AudioController();
|
||||
|
||||
@Override
|
||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||
{
|
||||
//Get track from Youtube
|
||||
String video = YT.getYT(input.args);
|
||||
ac.loadAndPlay(video, guild);
|
||||
System.out.println("Internal: " + ac.response);
|
||||
|
||||
String video = input.args;
|
||||
if(!(video.startsWith("https://www.youtube") || video.startsWith("https://www.youtu.be")))
|
||||
{
|
||||
video = YT.getYT(video);
|
||||
}
|
||||
guild.audio.playVideo(video);
|
||||
return new SubCommandFormattable(video);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package commands.music;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||
|
||||
import core.SubCommand;
|
||||
import core.SubCommandFormattable;
|
||||
import dataStructures.*;
|
||||
|
||||
public class SubCommandPlaylist extends SubCommand
|
||||
{
|
||||
|
||||
public SubCommandPlaylist(KittyRole roleLevel, KittyRating contentRating) {super(roleLevel, contentRating); }
|
||||
|
||||
@Override
|
||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||
{
|
||||
// ArrayList<AudioTrack> playlist = guild.audio.getPlaylist();
|
||||
String stringPlaylist = guild.audio.getPlaylist(guild.audio.player);
|
||||
return new SubCommandFormattable(stringPlaylist);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package commands.music;
|
||||
|
||||
import core.SubCommand;
|
||||
import core.SubCommandFormattable;
|
||||
import dataStructures.KittyChannel;
|
||||
import dataStructures.KittyGuild;
|
||||
import dataStructures.KittyRating;
|
||||
import dataStructures.KittyRole;
|
||||
import dataStructures.KittyUser;
|
||||
import dataStructures.UserInput;
|
||||
|
||||
public class SubCommandSkip extends SubCommand
|
||||
{
|
||||
public SubCommandSkip(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||
{
|
||||
|
||||
}
|
||||
@Override
|
||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||
{
|
||||
return new SubCommandFormattable(guild.audio.skipVideo(guild.audio.player));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package commands.music;
|
||||
|
||||
import core.SubCommand;
|
||||
import core.SubCommandFormattable;
|
||||
import dataStructures.KittyChannel;
|
||||
import dataStructures.KittyGuild;
|
||||
import dataStructures.KittyRating;
|
||||
import dataStructures.KittyRole;
|
||||
import dataStructures.KittyUser;
|
||||
import dataStructures.UserInput;
|
||||
|
||||
public class SubCommandStop extends SubCommand
|
||||
{
|
||||
|
||||
public SubCommandStop(KittyRole roleLevel, KittyRating contentRating) {super(roleLevel, contentRating);}
|
||||
|
||||
@Override
|
||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||
{
|
||||
|
||||
return new SubCommandFormattable(guild.audio.stopPlayer(guild.audio.player));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user