diff options
| author | Austin Hellyer <[email protected]> | 2016-11-07 11:43:15 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-07 11:43:15 -0800 |
| commit | a114a55efb5b08f9e5f289203db2dfd4db82852a (patch) | |
| tree | 8522e8eb3e77534ecf5c8e0208746b587eae887b /src/model/gateway.rs | |
| parent | Add Attachment::download{,to_directory} (diff) | |
| download | serenity-a114a55efb5b08f9e5f289203db2dfd4db82852a.tar.xz serenity-a114a55efb5b08f9e5f289203db2dfd4db82852a.zip | |
Add webhook support
Diffstat (limited to 'src/model/gateway.rs')
| -rw-r--r-- | src/model/gateway.rs | 16 |
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, |