Change file structure

This commit is contained in:
bitfl0wer 2023-06-04 14:20:06 +02:00
parent 6b8d458eb4
commit 47d1c52014
No known key found for this signature in database
GPG Key ID: 84BBB60DF895ABF2
1 changed files with 4 additions and 8 deletions

View File

@ -7,12 +7,11 @@ use crate::{
}; };
/** /**
Extends the [`types::Reaction`] struct with useful metadata. Useful metadata for working with [`types::Reaction`], bundled together nicely.
*/ */
pub struct ReactionMeta { pub struct ReactionMeta {
pub message_id: types::Snowflake, pub message_id: types::Snowflake,
pub channel_id: types::Snowflake, pub channel_id: types::Snowflake,
pub reaction: types::Reaction,
} }
impl ReactionMeta { impl ReactionMeta {
@ -131,9 +130,7 @@ impl ReactionMeta {
) )
.await .await
} }
}
impl types::Reaction {
/** /**
Create a reaction for the message. Create a reaction for the message.
@ -156,8 +153,7 @@ impl types::Reaction {
See [https://discord.com/developers/docs/resources/channel#create-reaction](https://discord.com/developers/docs/resources/channel#create-reaction) See [https://discord.com/developers/docs/resources/channel#create-reaction](https://discord.com/developers/docs/resources/channel#create-reaction)
*/ */
pub async fn create( pub async fn create(
channel_id: &Snowflake, &self,
message_id: &Snowflake,
emoji: &str, emoji: &str,
user: &mut UserMeta, user: &mut UserMeta,
) -> Result<reqwest::Response, crate::errors::InstanceServerError> { ) -> Result<reqwest::Response, crate::errors::InstanceServerError> {
@ -165,8 +161,8 @@ impl types::Reaction {
let url = format!( let url = format!(
"{}/channels/{}/messages/{}/reactions/{}/@me/", "{}/channels/{}/messages/{}/reactions/{}/@me/",
belongs_to.urls.get_api(), belongs_to.urls.get_api(),
channel_id, self.channel_id,
message_id, self.message_id,
emoji emoji
); );
let request = Client::new().put(url).bearer_auth(user.token()); let request = Client::new().put(url).bearer_auth(user.token());