Add Plugin system and Soundcloud searching
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,8 +1,13 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.audio.PlayCommandUtil;
|
||||
import com.fpghoti.biscuit.audio.request.PlayRequest;
|
||||
import com.fpghoti.biscuit.audio.request.RequestType;
|
||||
import com.fpghoti.biscuit.audio.request.soundcloud.SCRequest;
|
||||
import com.fpghoti.biscuit.audio.request.youtube.YTRequest;
|
||||
import com.fpghoti.biscuit.audio.result.ResultHandler;
|
||||
import com.fpghoti.biscuit.audio.result.SCResultHandler;
|
||||
import com.fpghoti.biscuit.audio.result.YTResultHandler;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||
@@ -15,7 +20,7 @@ public class PlayCommand extends MusicClientCommand{
|
||||
public PlayCommand() {
|
||||
name = "Play";
|
||||
description = "Plays the specified song or plays a song found using search parameters.";
|
||||
usage = Main.getMainBiscuit().getProperties().getCommandSignifier() + "play <YouTube link OR Search Phrase>";
|
||||
usage = Main.getMainBiscuit().getProperties().getCommandSignifier() + "play [-sc] <Link OR Search Phrase>";
|
||||
minArgs = 1;
|
||||
maxArgs = 2000;
|
||||
identifiers.add("play");
|
||||
@@ -25,8 +30,16 @@ public class PlayCommand extends MusicClientCommand{
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Guild guild = event.getGuild();
|
||||
Biscuit b = Biscuit.getBiscuit(guild);
|
||||
|
||||
int searchArg = 0;
|
||||
boolean scSearch = false;
|
||||
|
||||
if(args[0].equalsIgnoreCase("-sc")) {
|
||||
scSearch = true;
|
||||
searchArg = 1;
|
||||
}
|
||||
|
||||
String searchPhrase = PlayCommandUtil.getSearchPhrase(args);
|
||||
String searchPhrase = PlayCommandUtil.getSearchPhrase(args, searchArg);
|
||||
|
||||
b.log(event.getAuthor().getName() + " issued a command: -play " + searchPhrase);
|
||||
|
||||
@@ -34,9 +47,19 @@ public class PlayCommand extends MusicClientCommand{
|
||||
if(!connected) {
|
||||
return;
|
||||
}
|
||||
|
||||
YTRequest request = new YTRequest(event.getMessage(), searchPhrase);
|
||||
Main.getPlayerManager().loadItemOrdered(guild, PlayCommandUtil.getID(event), new YTResultHandler(request));
|
||||
|
||||
PlayRequest request;
|
||||
ResultHandler handler;
|
||||
|
||||
if(scSearch) {
|
||||
request = PlayRequest.createPlayRequest(RequestType.SOUNDCLOUD, event.getMessage(), searchPhrase);
|
||||
handler = new SCResultHandler((SCRequest)request);
|
||||
}else {
|
||||
request = PlayRequest.createPlayRequest(event.getMessage(), searchPhrase);
|
||||
handler = new YTResultHandler((YTRequest)request);
|
||||
}
|
||||
|
||||
Main.getPlayerManager().loadItemOrdered(guild, PlayCommandUtil.getID(event), handler);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.audio.PlayCommandUtil;
|
||||
import com.fpghoti.biscuit.audio.request.youtube.YTPriorityRequest;
|
||||
import com.fpghoti.biscuit.audio.request.PlayRequest;
|
||||
import com.fpghoti.biscuit.audio.request.RequestType;
|
||||
import com.fpghoti.biscuit.audio.request.soundcloud.SCRequest;
|
||||
import com.fpghoti.biscuit.audio.request.youtube.YTRequest;
|
||||
import com.fpghoti.biscuit.audio.result.ResultHandler;
|
||||
import com.fpghoti.biscuit.audio.result.SCResultHandler;
|
||||
import com.fpghoti.biscuit.audio.result.YTResultHandler;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||
@@ -19,7 +23,7 @@ public class PlayFirstCommand extends MusicClientCommand{
|
||||
public PlayFirstCommand() {
|
||||
name = "Play First";
|
||||
description = "Places specified song at the front of the queue.";
|
||||
usage = Main.getMainBiscuit().getProperties().getCommandSignifier() + "playfirst <YouTube link OR Search Phrase>";
|
||||
usage = Main.getMainBiscuit().getProperties().getCommandSignifier() + "playfirst <Link OR Search Phrase>";
|
||||
minArgs = 1;
|
||||
maxArgs = 2000;
|
||||
identifiers.add("playfirst");
|
||||
@@ -31,7 +35,15 @@ public class PlayFirstCommand extends MusicClientCommand{
|
||||
Biscuit b = Biscuit.getBiscuit(guild);
|
||||
TextChannel tchannel = event.getChannel();
|
||||
|
||||
String searchPhrase = PlayCommandUtil.getSearchPhrase(args);
|
||||
int searchArg = 0;
|
||||
boolean scSearch = false;
|
||||
|
||||
if(args[0].equalsIgnoreCase("-sc")) {
|
||||
scSearch = true;
|
||||
searchArg = 1;
|
||||
}
|
||||
|
||||
String searchPhrase = PlayCommandUtil.getSearchPhrase(args, searchArg);
|
||||
|
||||
b.log(event.getAuthor().getName() + " issued a command: -playfirst " + searchPhrase);
|
||||
|
||||
@@ -44,9 +56,19 @@ public class PlayFirstCommand extends MusicClientCommand{
|
||||
if(!connected) {
|
||||
return;
|
||||
}
|
||||
|
||||
YTRequest request = new YTPriorityRequest(event.getMessage(), searchPhrase, 1);
|
||||
Main.getPlayerManager().loadItemOrdered(guild, PlayCommandUtil.getID(event), new YTResultHandler(request));
|
||||
|
||||
PlayRequest request;
|
||||
ResultHandler handler;
|
||||
|
||||
if(scSearch) {
|
||||
request = PlayRequest.createPlayRequest(RequestType.SOUNDCLOUD_PRIORITY, event.getMessage(), searchPhrase, 1);
|
||||
handler = new SCResultHandler((SCRequest)request);
|
||||
}else {
|
||||
request = PlayRequest.createPlayRequest(event.getMessage(), searchPhrase, 1);
|
||||
handler = new YTResultHandler((YTRequest)request);
|
||||
}
|
||||
|
||||
Main.getPlayerManager().loadItemOrdered(guild, PlayCommandUtil.getID(event), handler);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.audio.queue.AudioQueue;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.fpghoti.biscuit.commands.client.music;
|
||||
package com.fpghoti.biscuit.commands.discord.music;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
Reference in New Issue
Block a user