Add reactions: get

This commit is contained in:
bitfl0wer 2023-06-03 18:53:53 +02:00
parent fab9bc1c62
commit 4f91f26a28
No known key found for this signature in database
GPG Key ID: 84BBB60DF895ABF2
1 changed files with 25 additions and 0 deletions

View File

@ -34,4 +34,29 @@ impl ReactionMeta {
)
.await
}
pub async fn get(
&self,
emoji: &str,
user: &mut UserMeta,
) -> Result<reqwest::Response, crate::errors::InstanceServerError> {
let mut belongs_to = user.belongs_to.borrow_mut();
let url = format!(
"{}/channels/{}/messages/{}/reactions/{}/",
belongs_to.urls.get_api(),
self.channel_id,
self.message_id,
emoji
);
let request = Client::new().get(url).bearer_auth(user.token());
LimitedRequester::new()
.await
.send_request(
request,
crate::api::limits::LimitType::Channel,
&mut belongs_to.limits,
&mut user.limits,
)
.await
}
}