diff options
| author | Austin Hellyer <[email protected]> | 2016-11-20 10:24:07 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-20 10:24:07 -0800 |
| commit | 1efb05defdf837b75b25b278ce959f06b31e1839 (patch) | |
| tree | a804c28dda83e6b922160ca8cc2fd62a1abfd055 /src/client/context.rs | |
| parent | Fix context doctests (diff) | |
| download | serenity-1efb05defdf837b75b25b278ce959f06b31e1839.tar.xz serenity-1efb05defdf837b75b25b278ce959f06b31e1839.zip | |
Add methods for setting individual presence data
Diffstat (limited to 'src/client/context.rs')
| -rw-r--r-- | src/client/context.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/client/context.rs b/src/client/context.rs index d262096..e2d9fe2 100644 --- a/src/client/context.rs +++ b/src/client/context.rs @@ -1218,6 +1218,38 @@ impl Context { http::send_message(channel_id.into().0, Value::Object(map)) } + /// Sets the current user as being [`Online`]. This maintains the current + /// game and `afk` setting. + /// + /// [`Online`]: ../model/enum.OnlineStatus.html#variant.Online + pub fn online(&self) { + self.connection.lock().unwrap().set_status(OnlineStatus::Online); + } + + /// Sets the current user as being [`Idle`]. This maintains the current + /// game and `afk` setting. + /// + /// [`Idle`]: ../model/enum.OnlineStatus.html#variant.Idle + pub fn idle(&self) { + self.connection.lock().unwrap().set_status(OnlineStatus::Idle); + } + + /// Sets the current user as being [`DoNotDisturb`]. This maintains the + /// current game and `afk` setting. + /// + /// [`DoNotDisturb`]: ../model/enum.OnlineStatus.html#variant.DoNotDisturb + pub fn dnd(&self) { + self.connection.lock().unwrap().set_status(OnlineStatus::DoNotDisturb); + } + + /// Sets the current user as being [`Invisible`]. This maintains the current + /// game and `afk` setting. + /// + /// [`Invisible`]: ../model/enum.OnlineStatus.html#variant.Invisible + pub fn invisible(&self) { + self.connection.lock().unwrap().set_status(OnlineStatus::Invisible); + } + /// "Resets" the current user's presence, by setting the game to `None`, /// the online status to [`Online`], and `afk` to `false`. /// |