aboutsummaryrefslogtreecommitdiff
path: root/src/model/gateway.rs
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-07 11:43:15 -0800
committerAustin Hellyer <[email protected]>2016-11-07 11:43:15 -0800
commita114a55efb5b08f9e5f289203db2dfd4db82852a (patch)
tree8522e8eb3e77534ecf5c8e0208746b587eae887b /src/model/gateway.rs
parentAdd Attachment::download{,to_directory} (diff)
downloadserenity-a114a55efb5b08f9e5f289203db2dfd4db82852a.tar.xz
serenity-a114a55efb5b08f9e5f289203db2dfd4db82852a.zip
Add webhook support
Diffstat (limited to 'src/model/gateway.rs')
-rw-r--r--src/model/gateway.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/model/gateway.rs b/src/model/gateway.rs
index 60c9566..5748302 100644
--- a/src/model/gateway.rs
+++ b/src/model/gateway.rs
@@ -302,6 +302,12 @@ pub struct VoiceStateUpdateEvent {
pub voice_state: VoiceState,
}
+#[derive(Clone, Debug)]
+pub struct WebhookUpdateEvent {
+ pub channel_id: ChannelId,
+ pub guild_id: GuildId,
+}
+
#[derive(Debug, Clone)]
pub enum GatewayEvent {
Dispatch(u64, Event),
@@ -483,6 +489,11 @@ pub enum Event {
VoiceStateUpdate(VoiceStateUpdateEvent),
/// Voice server information is available
VoiceServerUpdate(VoiceServerUpdateEvent),
+ /// A webhook for a [channel][`PublicChannel`] was updated in a [`Guild`].
+ ///
+ /// [`Guild`]: struct.Guild.html
+ /// [`PublicChannel`]: struct.PublicChannel.html
+ WebhookUpdate(WebhookUpdateEvent),
/// An event type not covered by the above
Unknown(UnknownEvent),
}
@@ -748,6 +759,11 @@ impl Event {
guild_id: try!(opt(&mut value, "guild_id", GuildId::decode)),
voice_state: try!(VoiceState::decode(Value::Object(value))),
}))
+ } else if kind == "WEBHOOKS_UPDATE" {
+ Ok(Event::WebhookUpdate(WebhookUpdateEvent {
+ channel_id: try!(remove(&mut value, "channel_id").and_then(ChannelId::decode)),
+ guild_id: try!(remove(&mut value, "guild_id").and_then(GuildId::decode)),
+ }))
} else {
Ok(Event::Unknown(UnknownEvent {
kind: kind,