Merge Greg's branch into the master branch #288

Merged
greg6775 merged 3 commits from greg-dev into master 2019-12-31 13:50:02 +01:00
3 changed files with 66 additions and 14 deletions
Showing only changes of commit 9e66fa1a3b - Show all commits

View file

@ -97,6 +97,7 @@ public class Hadder {
new InfoCommand(),
new SkipCommand(),
new EditRulesCommand(),
new VolumeCommand(),
new StopCommand()), config, helpCommand);
builder.addEventListeners(

View file

@ -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";
}
}

View file

@ -4,20 +4,6 @@
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
none = None
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.description = I successfully skipped to the next 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.img.error.title = Image not showing? Click here