File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
src/main/java/com/jagrosh/jmusicbot/commands/music Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -36,21 +36,29 @@ public LyricsCmd(Bot bot)
36
36
super (bot );
37
37
this .name = "lyrics" ;
38
38
this .arguments = "[song name]" ;
39
- this .help = "shows the lyrics to the currently-playing song" ;
39
+ this .help = "shows the lyrics of a song" ;
40
40
this .aliases = bot .getConfig ().getAliases (this .name );
41
41
this .botPermissions = new Permission []{Permission .MESSAGE_EMBED_LINKS };
42
- this .bePlaying = true ;
43
42
}
44
43
45
44
@ Override
46
45
public void doCommand (CommandEvent event )
47
46
{
48
- event .getChannel ().sendTyping ().queue ();
49
47
String title ;
50
48
if (event .getArgs ().isEmpty ())
51
- title = ((AudioHandler )event .getGuild ().getAudioManager ().getSendingHandler ()).getPlayer ().getPlayingTrack ().getInfo ().title ;
49
+ {
50
+ AudioHandler sendingHandler = (AudioHandler ) event .getGuild ().getAudioManager ().getSendingHandler ();
51
+ if (sendingHandler .isMusicPlaying (event .getJDA ()))
52
+ title = sendingHandler .getPlayer ().getPlayingTrack ().getInfo ().title ;
53
+ else
54
+ {
55
+ event .replyError ("There must be music playing to use that!" );
56
+ return ;
57
+ }
58
+ }
52
59
else
53
60
title = event .getArgs ();
61
+ event .getChannel ().sendTyping ().queue ();
54
62
client .getLyrics (title ).thenAccept (lyrics ->
55
63
{
56
64
if (lyrics == null )
You can’t perform that action at this time.
0 commit comments