Integrate the loop function

This commit is contained in:
GregTCLTK 2020-01-06 18:40:03 +01:00
parent 4198f1e245
commit fb0ef99d83
No known key found for this signature in database
GPG key ID: A91BADE5C070FF67
2 changed files with 11 additions and 1 deletions

View file

@ -14,7 +14,13 @@ public class LoopCommand implements Command {
public void executed(String[] args, CommandEvent event) {
if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) {
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
if (event.getAudioManager().getTrackManager(event.getGuild()).isLoop()) {
event.getAudioManager().getTrackManager(event.getGuild()).setLoop(false);
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.loop.title", "commands.music.loop.success.loop.description").build()).queue();
} else {
event.getAudioManager().getTrackManager(event.getGuild()).setLoop(true);
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.unloop.title", "commands.music.loop.success.unloop.description").build()).queue();
}
} else {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.loop.error.connected.title",

View file

@ -237,6 +237,10 @@ commands.music.pause.error.paused.description = The song is already paused.
commands.music.pause.error.connected.title = No channel
commands.music.pause.error.connected.description = You have to be in the same voice channel as the bot to pause the song.
commands.music.pause.help.description = Pause the playing song.
commands.music.loop.success.loop.title = Successfully activated
commands.music.loop.success.loop.description = I will now repeat the currently played song.
commands.music.loop.success.unloop.title = Successfully deactivated
commands.music.loop.success.unloop.description = I will no longer repeat the currently played song.
commands.music.loop.error.connected.title = No channel
commands.music.loop.error.connected.description = You have to be in the same voice channel as the bot to set the repeat status.
commands.music.loop.help.description = Repeats a song/queue.