本文整理匯總了Java中net.dv8tion.jda.utils.AvatarUtil類的典型用法代碼示例。如果您正苦於以下問題:Java AvatarUtil類的具體用法?Java AvatarUtil怎麽用?Java AvatarUtil使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AvatarUtil類屬於net.dv8tion.jda.utils包,在下文中一共展示了AvatarUtil類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: update
import net.dv8tion.jda.utils.AvatarUtil; //導入依賴的package包/類
/**
* Updates the profile of the connected account, sends the changed data to the Discord server.
* <br>
* The provided password is used to authenticate and apply the updates to the profile.
*
* @param password
* The password used to login to currently logged in account.
*/
public void update(String password)
{
try
{
JSONObject object = new JSONObject();
object.put("email", email == null ? ((JDAClient) api).getSelfInfo().getEmail() : email);
object.put("password", password);
object.put("username", username == null ? api.getSelfInfo().getUsername() : username);
object.put("avatar", avatar == null
? api.getSelfInfo().getAvatarId()
: (avatar == AvatarUtil.DELETE_AVATAR
? JSONObject.NULL
: avatar.getEncoded()));
if (newPassword != null)
{
object.put("new_password", newPassword);
}
Requester.Response response = api.getRequester().patch(ClientRequester.DISCORD_API_PREFIX + "users/@me", object);
if (!response.isOk() || !response.getObject().has("token"))
{
throw new Exception("Something went wrong while changing the account settings.");
}
api.setAuthToken(response.getObject().getString("token"));
this.avatar = null;
this.email = null;
this.newPassword = null;
this.username = null;
}
catch (Exception e)
{
JDAImpl.LOG.log(e);
}
}
示例2: setAvatar
import net.dv8tion.jda.utils.AvatarUtil; //導入依賴的package包/類
@Override
public ClientAccountManager setAvatar(AvatarUtil.Avatar avatar)
{
return (ClientAccountManager) super.setAvatar(avatar);
}