Merge Greg's branch into the master branch #288
3 changed files with 66 additions and 14 deletions
|
|
@ -97,6 +97,7 @@ public class Hadder {
|
||||||
new InfoCommand(),
|
new InfoCommand(),
|
||||||
new SkipCommand(),
|
new SkipCommand(),
|
||||||
new EditRulesCommand(),
|
new EditRulesCommand(),
|
||||||
|
new VolumeCommand(),
|
||||||
new StopCommand()), config, helpCommand);
|
new StopCommand()), config, helpCommand);
|
||||||
|
|
||||||
builder.addEventListeners(
|
builder.addEventListeners(
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.bbn.hadder.commands.music;
|
||||||
|
|
||||||
|
import com.bbn.hadder.commands.Command;
|
||||||
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Skidder / GregTCLTK
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class VolumeCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (args.length > 0) {
|
||||||
|
if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) {
|
||||||
|
try {
|
||||||
|
int volume = Integer.parseInt(args[0]);
|
||||||
|
if (volume < 200 && volume > 0 || event.getConfig().getOwners().contains(event.getAuthor().getId())) {
|
||||||
|
event.getAudioManager().getPlayer(event.getGuild()).setVolume(volume);
|
||||||
|
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
|
"commands.music.volume.success.title", "",
|
||||||
|
"commands.music.volume.success.description", String.valueOf(volume)).build()).queue();
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
|
"commands.music.volume.error.int.title",
|
||||||
|
"commands.music.volume.error.int.description").build()).queue();
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
event.getHelpCommand().sendHelp(this, event);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
|
"commands.music.info.error.title",
|
||||||
|
"commands.music.info.error.description").build()).queue();
|
||||||
|
}
|
||||||
|
} else event.getHelpCommand().sendHelp(this, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"volume"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Change the volume of the music.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "[New volume]";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String example() {
|
||||||
|
return "100";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,20 +4,6 @@
|
||||||
|
|
||||||
Hadder = Hadder
|
Hadder = Hadder
|
||||||
|
|
||||||
user = <@User>
|
|
||||||
searchterm = <SearchTerm>
|
|
||||||
username = <Username>
|
|
||||||
number = <Number>/all
|
|
||||||
prefix = <New Prefix>
|
|
||||||
userprefix = <New User-Prefix>
|
|
||||||
vc-name/id = <VoiceChannelID|VoiceChannelName>
|
|
||||||
user+nickname = <@user> <New Nickname>
|
|
||||||
region = <region>
|
|
||||||
guildid = <Guild-ID>
|
|
||||||
content = <Message-content>
|
|
||||||
song = <Song>
|
|
||||||
user/id= [@User]/[ID]
|
|
||||||
|
|
||||||
error = Error
|
error = Error
|
||||||
none = None
|
none = None
|
||||||
success\! = Success\!
|
success\! = Success\!
|
||||||
|
|
@ -221,6 +207,10 @@ commands.music.queue.help.description = Shows the music queue
|
||||||
commands.music.skip.success.title = Successfully skipped
|
commands.music.skip.success.title = Successfully skipped
|
||||||
commands.music.skip.success.description = I successfully skipped to the next song
|
commands.music.skip.success.description = I successfully skipped to the next song
|
||||||
commands.music.skip.help.description = Skips the currently playing song
|
commands.music.skip.help.description = Skips the currently playing song
|
||||||
|
commands.music.volume.success.title = Successfully set
|
||||||
|
commands.music.volume.success.description = I successfully set the new volume to %extra%
|
||||||
|
commands.music.volume.error.int.title = Invalid number
|
||||||
|
commands.music.volume.error.int.description = The volume have to be between 1 and 200
|
||||||
|
|
||||||
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