updated functionality

#13 Added functionality to allow players to play a song by id
This commit is contained in:
Isaac Parenteau
2019-10-08 21:34:42 -05:00
parent a0021abf07
commit 4ee4a87835
4 changed files with 138 additions and 22 deletions

View File

@@ -30,7 +30,11 @@ package net.locusworks.discord.eighttrack.handlers;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
@@ -109,16 +113,19 @@ public class DiscordEventHandler extends ListenerAdapter {
GuildMusicHandler gmh = GuildMusicService.getMap().get(event.getGuild().getIdLong());
gmh.accept((id) -> GuildMusicService.getMap().remove(id));
String command = event.getMessage().getContentRaw().trim().toLowerCase();
List<String> commands = new ArrayList<String>(Arrays.asList(event.getMessage().getContentRaw().trim().toLowerCase().split(" ")));
String command = commands.remove(0);
switch(command) {
case "-upload":
gmh.upload(event);
return;
case "-play":
gmh.play(event, commands);
gmh.isPlaying(true);
gmh.play(event);
return;
case "-stop":
gmh.isPlaying(false);
@@ -126,15 +133,20 @@ public class DiscordEventHandler extends ListenerAdapter {
event.getGuild().getAudioManager().closeAudioConnection();
return;
case "-next":
gmh.next(event);
gmh.next(event, commands);
return;
case "-repeat":
gmh.isPlaying(true);
gmh.repeat(event);
gmh.isPlaying(true);
return;
case "-whatsnext":
gmh.whatsNext(event);
break;
case "-upnext":
gmh.upNext(event, commands);
return;
case "-list":
gmh.list(event);
return;
case "-playlist":
gmh.playlist(event, commands);
default:
return;
}