Merge Greg's branch into the master branch #304
5 changed files with 89 additions and 1 deletions
2
Dockerfile
Normal file
2
Dockerfile
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
FROM debian:latest
|
||||||
|
WORKDIR /home/Hadder
|
||||||
|
|
@ -101,7 +101,8 @@ public class Hadder {
|
||||||
new EditRulesCommand(),
|
new EditRulesCommand(),
|
||||||
new VolumeCommand(),
|
new VolumeCommand(),
|
||||||
new StopCommand(),
|
new StopCommand(),
|
||||||
new BlacklistCommand()), config, helpCommand);
|
new BlacklistCommand(),
|
||||||
|
new PauseCommand()), config, helpCommand);
|
||||||
|
|
||||||
builder.addEventListeners(
|
builder.addEventListeners(
|
||||||
new MentionListener(rethink),
|
new MentionListener(rethink),
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.bbn.hadder.commands.music;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @author Skidder / GregTCLTK
|
||||||
|
*/
|
||||||
|
|
||||||
|
import com.bbn.hadder.commands.Command;
|
||||||
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
||||||
|
public class PauseCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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().getPlayer(event.getGuild()).isPaused()) {
|
||||||
|
event.getAudioManager().getPlayer(event.getGuild()).setPaused(true);
|
||||||
|
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
|
"commands.music.pause.success.title",
|
||||||
|
"commands.music.pause.success.description")
|
||||||
|
.build()).queue();
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
|
"commands.music.pause.error.paused.title",
|
||||||
|
"commands.music.pause.error.paused.description")
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
|
"commands.music.pause.error.connected.title",
|
||||||
|
"commands.music.pause.error.connected.description")
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
|
"commands.music.info.error.title",
|
||||||
|
"commands.music.info.error.description").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"pause"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "commands.music.pause.help.description";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String example() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -43,6 +43,19 @@ public class PlayCommand implements Command {
|
||||||
"commands.music.join.error.channel.description")
|
"commands.music.join.error.channel.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
|
} else if (event.getAudioManager().getPlayer(event.getGuild()).isPaused()) {
|
||||||
|
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
|
||||||
|
event.getAudioManager().getPlayer(event.getGuild()).setPaused(false);
|
||||||
|
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
|
"commands.music.play.success.unpause.title",
|
||||||
|
"commands.music.play.success.unpause.description")
|
||||||
|
.build()).queue();
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
|
"commands.music.play.error.connected.title",
|
||||||
|
"commands.music.play.error.connected.description")
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
} else event.getHelpCommand().sendHelp(this, event);
|
} else event.getHelpCommand().sendHelp(this, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -199,6 +199,10 @@ commands.music.play.error.load.title = %extra% Load failed %extra%
|
||||||
commands.music.play.error.load.description = Unfortunately I can not load the given song
|
commands.music.play.error.load.description = Unfortunately I can not load the given song
|
||||||
commands.music.play.error.match.title = %extra% No matches %extra%
|
commands.music.play.error.match.title = %extra% No matches %extra%
|
||||||
commands.music.play.error.match.description = I can not find a song named this on YouTube
|
commands.music.play.error.match.description = I can not find a song named this on YouTube
|
||||||
|
commands.music.play.success.unpause.title = Successfully continued
|
||||||
|
commands.music.play.success.unpause.description = I successfully continued playing the song.
|
||||||
|
commands.music.play.error.connected.title = No channel
|
||||||
|
commands.music.play.error.connected.description = You have to be in the same voice channel as the bot to continue the song.
|
||||||
commands.music.play.help.description = Plays the specified song.
|
commands.music.play.help.description = Plays the specified song.
|
||||||
commands.music.stop.success.title = Successfully stopped
|
commands.music.stop.success.title = Successfully stopped
|
||||||
commands.music.stop.success.description = I successfully stopped the song.
|
commands.music.stop.success.description = I successfully stopped the song.
|
||||||
|
|
@ -226,6 +230,13 @@ commands.music.volume.error.int.description = The volume have to be between 1 an
|
||||||
commands.music.volume.error.connected.title = No channel
|
commands.music.volume.error.connected.title = No channel
|
||||||
commands.music.volume.error.connected.description = You have to be in the same voice channel as the bot to change the volume.
|
commands.music.volume.error.connected.description = You have to be in the same voice channel as the bot to change the volume.
|
||||||
commands.music.volume.help.description = Change the volume of the music.
|
commands.music.volume.help.description = Change the volume of the music.
|
||||||
|
commands.music.pause.success.title = Successfully paused
|
||||||
|
commands.music.pause.success.description = I successfully paused the played song.
|
||||||
|
commands.music.pause.error.paused.title = Already paused
|
||||||
|
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.nsfw.gif.error.title = GIF not showing? Click here
|
commands.nsfw.gif.error.title = GIF not showing? Click here
|
||||||
commands.nsfw.img.error.title = Image not showing? Click here
|
commands.nsfw.img.error.title = Image not showing? Click here
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue