aboutsummaryrefslogtreecommitdiff
path: root/src/client/mod.rs
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/client/mod.rs
parentA bit of docs (diff)
downloadserenity-0bacf7b64960ae743c6cd7407b0665781b201766.tar.xz
serenity-0bacf7b64960ae743c6cd7407b0665781b201766.zip
Register friend suggestion events
Diffstat (limited to 'src/client/mod.rs')
-rw-r--r--src/client/mod.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs
index 7665955..44e951b 100644
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -520,6 +520,26 @@ impl Client {
.on_channel_update = Some(Arc::new(handler));
}
+ /// Attaches a handler for when a [`FriendSuggestionCreate`] is received.
+ ///
+ /// [`FriendSuggestionCreate`]: ../model/enum.Event.html#variant.FriendSuggestionCreate
+ pub fn on_friend_suggestion_create<F>(&mut self, handler: F)
+ where F: Fn(Context, User, Vec<SuggestionReason>) + Send + Sync + 'static {
+ self.event_store.lock()
+ .unwrap()
+ .on_friend_suggestion_create = Some(Arc::new(handler));
+ }
+
+ /// Attaches a handler for when a [`FriendSuggestionDelete`] is received.
+ ///
+ /// [`FriendSuggestionDelete`]: ../model/enum.Event.html#variant.FriendSuggestionDelete
+ pub fn on_friend_suggestion_delete<F>(&mut self, handler: F)
+ where F: Fn(Context, UserId) + Send + Sync + 'static {
+ self.event_store.lock()
+ .unwrap()
+ .on_friend_suggestion_delete = Some(Arc::new(handler));
+ }
+
/// Attaches a handler for when a [`GuildCreate`] is received.
///
/// [`GuildCreate`]: ../model/enum.Event.html#variant.GuildCreate