-
Notifications
You must be signed in to change notification settings - Fork 599
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Added additional reaction controls to channel_id and message structs #2533
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a GuildChannel::delete_reactions
wrapper method as well? (A PrivateChannel::delete_reactions
method doesn't make sense, because only reactions by the current user can be removed in a private channel.)
Also, make sure to run cargo +nightly fmt
.
src/model/channel/channel_id.rs
Outdated
/// Deletes all of the [`Reaction`]s associated with the provided message id. | ||
/// | ||
/// **Note**: Requires the [Manage Messages] permission. | ||
/// | ||
/// [Manage Messages]: Permissions::MANAGE_MESSAGES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should include an # Errors
section.
src/model/channel/message.rs
Outdated
cache_http | ||
.http() | ||
.as_ref() | ||
.delete_reaction( | ||
self.channel_id.0, | ||
self.id.0, | ||
user_id.map(|uid| uid.0), | ||
&reaction_type.into(), | ||
) | ||
.await |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be reworked to just a wrapper around ChannelId::delete_reaction
. The same goes for Message::delete_reactions
, now that ChannelId::delete_reactions
exists.
src/model/channel/message.rs
Outdated
/// Returns [`Error::Http`] if the currend user did not perform the reaction, | ||
/// and lacks permission |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Returns [`Error::Http`] if the currend user did not perform the reaction, | |
/// and lacks permission | |
/// Returns [`Error::Http`] if the current user did not perform the reaction, or lacks | |
/// permission. |
formatting
Co-authored-by: Michael Krasnitski <42564254+mkrasnitski@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good. Could you also change the implementation of Message::delete_reactions
to be:
self.channel_id.delete_reactions(cache_http.http(), self.id).await
Co-authored-by: Michael Krasnitski <42564254+mkrasnitski@users.noreply.github.com>
Co-authored-by: Michael Krasnitski <42564254+mkrasnitski@users.noreply.github.com>
This slipped past in review, but |
#2532 In reference to this issue.