Add error msg

This commit is contained in:
GregTCLTK 2020-04-06 19:57:59 +02:00
parent c6f2db6e54
commit 295e88a89a
No known key found for this signature in database
GPG key ID: A91BADE5C070FF67
2 changed files with 17 additions and 8 deletions

View file

@ -30,14 +30,21 @@ public class MoveAllCommand implements Command {
if (args.length == 2) {
if (StringUtils.isNumeric(args[0]) && args[0].length() == 18) {
if (StringUtils.isNumeric(args[1]) && args[1].length() == 18) {
int count = e.getGuild().getVoiceChannelById(args[0]).getMembers().size();
e.getGuild().getVoiceChannelById(args[0]).getMembers().forEach(
member -> e.getGuild().moveVoiceMember(member, e.getGuild().getVoiceChannelById(args[1])).queue()
);
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.misc.moveall.success.title", "",
"commands.misc.moveall.success.description", String.valueOf(count))
.build()).queue();
if (!args[0].equals(args[1])) {
int count = e.getGuild().getVoiceChannelById(args[0]).getMembers().size();
e.getGuild().getVoiceChannelById(args[0]).getMembers().forEach(
member -> e.getGuild().moveVoiceMember(member, e.getGuild().getVoiceChannelById(args[1])).queue()
);
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.misc.moveall.success.title", "",
"commands.misc.moveall.success.description", String.valueOf(count))
.build()).queue();
} else {
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.misc.moveall.error.equals.title",
"commands.misc.moveall.error.equals.description")
.build()).queue();
}
} else {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.misc.moveall.error.target.int.title",

View file

@ -100,6 +100,8 @@ commands.misc.code.error.description = I can't find the specified invite code.
commands.misc.code.help.description = Shows information about a invite code.
commands.misc.moveall.success.title = Successfully moved
commands.misc.moveall.success.description = I successfully moved %extra% members. Have fun\!
commands.misc.moveall.error.equals.title = Not twice
commands.misc.moveall.error.equals.description = The first voice channel equals the second. You have to specify two different voice channels.
commands.misc.moveall.error.source.int.title = Invalid ID
commands.misc.moveall.error.source.int.description = You didn't specified a ID as the source channel.
commands.misc.moveall.error.target.int.title = Invalid ID