Change file structure
This commit is contained in:
parent
5dd9d095cf
commit
92e768d5a6
|
@ -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());
|
||||||
|
|
Loading…
Reference in New Issue