Skip to content

Commit

Permalink
play command accepts file uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
jagrosh committed Mar 15, 2018
1 parent af98eb5 commit c49a559
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/jagrosh/jmusicbot/commands/PlayCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public PlayCmd(Bot bot, String loadingEmoji)

@Override
public void doCommand(CommandEvent event) {
if(event.getArgs().isEmpty())
if(event.getArgs().isEmpty() && event.getMessage().getAttachments().isEmpty())
{
AudioHandler handler = (AudioHandler)event.getGuild().getAudioManager().getSendingHandler();
if(handler!=null && handler.getPlayer().getPlayingTrack()!=null && handler.getPlayer().isPaused())
Expand Down Expand Up @@ -85,7 +85,7 @@ public void doCommand(CommandEvent event) {
}
String args = event.getArgs().startsWith("<") && event.getArgs().endsWith(">")
? event.getArgs().substring(1,event.getArgs().length()-1)
: event.getArgs();
: event.getArgs().isEmpty() ? event.getMessage().getAttachments().get(0).getUrl() : event.getArgs();
event.reply(loadingEmoji+" Loading... `["+args+"]`", m -> bot.getAudioManager().loadItemOrdered(event.getGuild(), args, new ResultHandler(m,event,false)));
}

Expand Down

0 comments on commit c49a559

Please sign in to comment.