/**
* Adds an reaction to the message.
*
* @param reaction The reaction to add. Whether a unicode emoji or a custom emoji in the format <code>name:id</code>.
* @return A future which tells us if the creation was a success.
*/
private Future<Void> addReaction(final String reaction) {
return api.getThreadPool().getExecutorService().submit(new Callable<Void>() {
@Override
public Void call() throws Exception {
logger.debug("Trying to add reaction to message with id {} (reaction: {})", getId(), reaction);
HttpResponse<JsonNode> response = Unirest
.put("https://discordapp.com/api/v6/channels/" + channelId + "/messages/" + getId() + "/reactions/" + reaction + "/@me")
.header("authorization", api.getToken())
.header("content-type", "application/json")
.body("{}")
.asJson();
api.checkResponse(response);
if (isPrivateMessage()) {
api.checkRateLimit(response, RateLimitType.UNKNOWN, null, null);
} else {
api.checkRateLimit(response, RateLimitType.UNKNOWN, null, getChannelReceiver());
}
logger.debug("Added reaction to message with id {} (reaction: {})", getId(), reaction);
return null;
}
});
}
ImplMessage.java 文件源码
java
阅读 17
收藏 0
点赞 0
评论 0
项目:Javacord
作者:
评论列表
文章目录