aboutsummaryrefslogtreecommitdiff
path: root/src/model/gateway.rs
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-11 13:07:18 -0800
committerAustin Hellyer <[email protected]>2016-11-11 13:07:18 -0800
commita40d821a7cf0361bbffdedcb5f91761a1a285401 (patch)
treeb787a46ad5619bb29121f6134bff4f0005fa2f96 /src/model/gateway.rs
parentAdd a clippy config (diff)
downloadserenity-a40d821a7cf0361bbffdedcb5f91761a1a285401.tar.xz
serenity-a40d821a7cf0361bbffdedcb5f91761a1a285401.zip
Add delete_message_reactions + register event
Add the `delete_message_reactions` endpoint (`DELETE /channels/{}/messages/{}/reactions`) and implement a method on the `Message` struct for easy access, `delete_reactions`. Register the `MESSAGE_REACTION_REMOVE_ALL` event and add an event handler.
Diffstat (limited to 'src/model/gateway.rs')
-rw-r--r--src/model/gateway.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/model/gateway.rs b/src/model/gateway.rs
index dfdddf2..35a65d0 100644
--- a/src/model/gateway.rs
+++ b/src/model/gateway.rs
@@ -222,6 +222,12 @@ pub struct ReactionRemoveEvent {
pub reaction: Reaction,
}
+#[derive(Clone, Copy, Debug)]
+pub struct ReactionRemoveAllEvent {
+ pub channel_id: ChannelId,
+ pub message_id: MessageId,
+}
+
/// The "Ready" event, containing initial state
#[derive(Clone, Debug)]
pub struct ReadyEvent {
@@ -467,6 +473,14 @@ pub enum Event {
///
/// [`on_message_reaction_remove`]: ../client/struct.Client.html#method.on_message_reaction_remove
ReactionRemove(ReactionRemoveEvent),
+ /// A request was issued to remove all [`Reaction`]s from a [`Message`].
+ ///
+ /// Fires the [`on_reaction_remove_all`] event handler.
+ ///
+ /// [`Message`]: struct.Message.html
+ /// [`Reaction`]: struct.Reaction.html
+ /// [`on_reaction_remove_all`]: ../client/struct.Clint.html#method.on_reaction_remove_all
+ ReactionRemoveAll(ReactionRemoveAllEvent),
/// The first event in a connection, containing the initial state.
///
/// May also be received at a later time in the event of a reconnect.
@@ -670,6 +684,11 @@ impl Event {
Ok(Event::ReactionRemove(ReactionRemoveEvent {
reaction: try!(Reaction::decode(Value::Object(value)))
}))
+ } else if kind == "MESSAGE_REACTION_REMOVE_ALL" {
+ Ok(Event::ReactionRemoveAll(ReactionRemoveAllEvent {
+ channel_id: try!(remove(&mut value, "channel_id").and_then(ChannelId::decode)),
+ message_id: try!(remove(&mut value, "message_id").and_then(MessageId::decode)),
+ }))
} else if kind == "MESSAGE_UPDATE" {
missing!(value, Event::MessageUpdate(MessageUpdateEvent {
id: try!(remove(&mut value, "id").and_then(MessageId::decode)),