More error msgs

This commit is contained in:
GregTCLTK 2020-01-20 18:16:05 +01:00
parent 949ad0acf0
commit 6b09db43d9
No known key found for this signature in database
GPG key ID: A91BADE5C070FF67
2 changed files with 27 additions and 16 deletions

View file

@ -1,13 +1,14 @@
package com.bbn.hadder.commands.fun; package com.bbn.hadder.commands.fun;
/*
* @author Skidder / GregTCLTK
*/
import com.bbn.hadder.commands.Command; import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent; import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor; import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.User;
/**
* @author Skidder / GregTCLTK
*/
public class AvatarCommand implements Command { public class AvatarCommand implements Command {
@ -37,18 +38,26 @@ public class AvatarCommand implements Command {
.setImage(member.getUser().getAvatarUrl()) .setImage(member.getUser().getAvatarUrl())
.setFooter(member.getUser().getAsTag()) .setFooter(member.getUser().getAsTag())
.build()).queue(); .build()).queue();
} else if (args[0].length() == 18){ } else if (args[0].length() == 18) {
Member member = event.getGuild().getMemberById(args[0]); try {
event.getTextChannel().sendMessage( User u = event.getGuild().getMemberById(args[0]).getUser();
event.getMessageEditor().getMessage( event.getTextChannel().sendMessage(
MessageEditor.MessageType.INFO, event.getMessageEditor().getMessage(
"commands.fun.avatar.success.title", MessageEditor.MessageType.INFO,
member.getUser().getAsTag(), "commands.fun.avatar.success.title",
"", u.getAsTag(),
"") "",
.setImage(member.getUser().getAvatarUrl()) "")
.setFooter(member.getUser().getAsTag()) .setImage(u.getAvatarUrl())
.build()).queue(); .setFooter(u.getAsTag())
.build()).queue();
} catch (NullPointerException e) {
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.fun.avatar.error.title",
"commands.fun.avatar.error.description"
).build()).queue();
}
} else { } else {
event.getHelpCommand().sendHelp(this, event); event.getHelpCommand().sendHelp(this, event);
} }

View file

@ -9,6 +9,8 @@ none = None
success\! = Success\! success\! = Success\!
commands.fun.avatar.success.title = Avatar of %extra% commands.fun.avatar.success.title = Avatar of %extra%
commands.fun.avatar.error.title = User not found
commands.fun.avatar.error.description = I can not find a user with this id!
commands.fun.avatar.help.description = Sends the avatar of the specified member. commands.fun.avatar.help.description = Sends the avatar of the specified member.
commands.fun.gif.error.description = Please try again with another term. commands.fun.gif.error.description = Please try again with another term.
commands.fun.gif.help.description = Looks for a GIF on Giphy. commands.fun.gif.help.description = Looks for a GIF on Giphy.