本文整理匯總了Java中net.dv8tion.jda.core.entities.User.getAvatarUrl方法的典型用法代碼示例。如果您正苦於以下問題:Java User.getAvatarUrl方法的具體用法?Java User.getAvatarUrl怎麽用?Java User.getAvatarUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.dv8tion.jda.core.entities.User
的用法示例。
在下文中一共展示了User.getAvatarUrl方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkUser
import net.dv8tion.jda.core.entities.User; //導入方法依賴的package包/類
private void checkUser(CMessage message, String[] args) {
TextChannel channel = message.getChannel();
if (args.length != 3) {
sendUsage(message, "!discord <user> <id|mention>");
return;
}
List<User> mentionedUsers = message.getMentionedUsers();
User targetUser = null;
if (mentionedUsers.size() == 0) {
targetUser = this.charrizard.getDiscordAPI().getUserById(args[2]);
} else {
targetUser = mentionedUsers.get(0);
}
if (targetUser == null) {
sendError(message, "This user does not exists!");
return;
}
OffsetDateTime creationTime = targetUser.getCreationTime();
EmbedBuilder builder = getEmbedBuilder()
.addField("Discord User", targetUser.getName(), true)
.addField("Mention tag", targetUser.getAsMention(), true)
.addField("Register Date", creationTime.getDayOfMonth() + "/" + creationTime.getMonthValue() + "/" + creationTime.getYear() + " " + creationTime.getHour() + ":" + creationTime.getMinute(), true);
String imageUrl = targetUser.getAvatarUrl();
if (imageUrl != null && !imageUrl.isEmpty() && !imageUrl.equals("null")) {
builder.setImage(imageUrl);
}
sendEmbedMessage(message, builder);
}