-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from brendonmiranda/1.2.0-rc
1.2.0 rc
- Loading branch information
Showing
38 changed files
with
951 additions
and
445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/io/github/brendonmiranda/javabot/command/NowPlayingCmd.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package io.github.brendonmiranda.javabot.command; | ||
|
||
import com.jagrosh.jdautilities.command.CommandEvent; | ||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer; | ||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack; | ||
import io.github.brendonmiranda.javabot.listener.AudioSendHandlerImpl; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* @author evelynvieira | ||
*/ | ||
@Component | ||
public class NowPlayingCmd extends MusicCmd { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(NowPlayingCmd.class); | ||
|
||
public NowPlayingCmd() { | ||
this.name = "now"; | ||
this.help = "shows the song which is playing in the moment"; | ||
} | ||
|
||
@Override | ||
public void command(CommandEvent event) { | ||
AudioSendHandlerImpl audioSendHandler = getAudioSendHandler(event.getGuild()); | ||
|
||
if (audioSendHandler == null) { | ||
event.replyError("There is no track playing"); | ||
return; | ||
} | ||
|
||
AudioPlayer audioPlayer = getAudioPlayer(audioSendHandler); | ||
|
||
if (audioPlayer.getPlayingTrack() != null) { | ||
AudioTrack audioTrack = audioPlayer.getPlayingTrack(); | ||
event.replySuccess("Now playing the track **" + audioTrack.getInfo().title + "**."); | ||
} | ||
else { | ||
event.replyWarning("There is no track playing"); | ||
} | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/io/github/brendonmiranda/javabot/command/PauseCmd.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.github.brendonmiranda.javabot.command; | ||
|
||
import com.jagrosh.jdautilities.command.CommandEvent; | ||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer; | ||
import io.github.brendonmiranda.javabot.listener.AudioSendHandlerImpl; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* @author evelynvieira | ||
*/ | ||
@Component | ||
public class PauseCmd extends MusicCmd { | ||
|
||
public PauseCmd() { | ||
this.name = "pause"; | ||
this.help = "pauses the current song"; | ||
} | ||
|
||
public void command(CommandEvent event) { | ||
AudioSendHandlerImpl audioSendHandler = getAudioSendHandler(event.getGuild()); | ||
|
||
if (audioSendHandler == null) { | ||
event.replyError("There is no track playing to pause."); | ||
return; | ||
} | ||
|
||
AudioPlayer audioPlayer = getAudioPlayer(audioSendHandler); | ||
|
||
if (audioPlayer.isPaused()) { | ||
// todo: instantiate ResumeCmd and use it instead | ||
audioPlayer.setPaused(false); | ||
event.replySuccess("Resumed **" + audioPlayer.getPlayingTrack().getInfo().title + "**."); | ||
return; | ||
} | ||
|
||
if (audioPlayer.getPlayingTrack() != null) { | ||
audioPlayer.setPaused(true); | ||
event.replySuccess("Paused **" + audioPlayer.getPlayingTrack().getInfo().title + "**. Type `" | ||
+ event.getClient().getPrefix() + " resume` to unpause!"); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/io/github/brendonmiranda/javabot/command/ResumeCmd.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package io.github.brendonmiranda.javabot.command; | ||
|
||
import com.jagrosh.jdautilities.command.CommandEvent; | ||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer; | ||
import io.github.brendonmiranda.javabot.listener.AudioSendHandlerImpl; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* @author evelynvieira | ||
*/ | ||
@Component | ||
public class ResumeCmd extends MusicCmd { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(ResumeCmd.class); | ||
|
||
public ResumeCmd() { | ||
this.name = "resume"; | ||
this.help = "resumes the current song"; | ||
} | ||
|
||
public void command(CommandEvent event) { | ||
AudioSendHandlerImpl audioSendHandler = getAudioSendHandler(event.getGuild()); | ||
|
||
if (audioSendHandler == null) { | ||
event.replyError("There is no track to resume."); | ||
return; | ||
} | ||
|
||
AudioPlayer audioPlayer = getAudioPlayer(audioSendHandler); | ||
|
||
if (audioPlayer.getPlayingTrack() != null && audioPlayer.isPaused()) { | ||
audioPlayer.setPaused(false); | ||
event.replySuccess("Resumed **" + audioPlayer.getPlayingTrack().getInfo().title + "**."); | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.