aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-18 11:53:46 -0800
committerAustin Hellyer <[email protected]>2016-11-18 11:53:46 -0800
commit0bacf7b64960ae743c6cd7407b0665781b201766 (patch)
treeff271a3e96c5ba61e2ab01ed49ac0be290961945 /src/model
parentA bit of docs (diff)
downloadserenity-0bacf7b64960ae743c6cd7407b0665781b201766.tar.xz
serenity-0bacf7b64960ae743c6cd7407b0665781b201766.zip
Register friend suggestion events
Diffstat (limited to 'src/model')
-rw-r--r--src/model/gateway.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/model/gateway.rs b/src/model/gateway.rs
index 1a286af..29dd7ce 100644
--- a/src/model/gateway.rs
+++ b/src/model/gateway.rs
@@ -63,6 +63,17 @@ pub struct ChannelUpdateEvent {
}
#[derive(Clone, Debug)]
+pub struct FriendSuggestionCreateEvent {
+ pub reasons: Vec<SuggestionReason>,
+ pub suggested_user: User,
+}
+
+#[derive(Clone, Copy, Debug)]
+pub struct FriendSuggestionDeleteEvent {
+ pub suggested_user_id: UserId,
+}
+
+#[derive(Clone, Debug)]
pub struct GuildBanAddEvent {
pub guild_id: GuildId,
pub user: User,
@@ -373,6 +384,13 @@ pub enum Event {
/// A user has been removed from a group
ChannelRecipientRemove(ChannelRecipientRemoveEvent),
ChannelUpdate(ChannelUpdateEvent),
+ /// When a suggestion for a friend is created, due to a connection like
+ /// [`Skype`].
+ ///
+ /// [`Connection::Skype`]: enum.Connection.html#variant.Skype
+ FriendSuggestionCreate(FriendSuggestionCreateEvent),
+ /// When a suggestion for a friend is removed.
+ FriendSuggestionDelete(FriendSuggestionDeleteEvent),
GuildBanAdd(GuildBanAddEvent),
GuildBanRemove(GuildBanRemoveEvent),
GuildCreate(GuildCreateEvent),
@@ -511,6 +529,15 @@ impl Event {
Ok(Event::ChannelUpdate(ChannelUpdateEvent {
channel: try!(Channel::decode(Value::Object(value))),
}))
+ } else if kind == "FRIEND_SUGGESTION_CREATE" {
+ missing!(value, Event::FriendSuggestionCreate(FriendSuggestionCreateEvent {
+ reasons: try!(decode_array(try!(remove(&mut value, "reasons")), SuggestionReason::decode)),
+ suggested_user: try!(remove(&mut value, "suggested_user").and_then(User::decode)),
+ }))
+ } else if kind == "FRIEND_SUGGESTION_DELETE" {
+ missing!(value, Event::FriendSuggestionDelete(FriendSuggestionDeleteEvent {
+ suggested_user_id: try!(remove(&mut value, "suggested_user_id").and_then(UserId::decode)),
+ }))
} else if kind == "GUILD_BAN_ADD" {
missing!(value, Event::GuildBanAdd(GuildBanAddEvent {
guild_id: try!(remove(&mut value, "guild_id").and_then(GuildId::decode)),