diff options
| author | acdenisSK <[email protected]> | 2017-06-30 11:12:31 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-06-30 11:12:31 +0200 |
| commit | 561b0e38b4cda6661425f76c8d707d58d0f12d09 (patch) | |
| tree | 4dc13d5beef1615183e72ea3df32e9454722ac8f /src | |
| parent | Also update examples (diff) | |
| download | serenity-561b0e38b4cda6661425f76c8d707d58d0f12d09.tar.xz serenity-561b0e38b4cda6661425f76c8d707d58d0f12d09.zip | |
Add a `quit` function`
Fixes #70
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/context.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/client/context.rs b/src/client/context.rs index a65ffe3..eaae7b3 100644 --- a/src/client/context.rs +++ b/src/client/context.rs @@ -337,4 +337,15 @@ impl Context { let mut shard = self.shard.lock().unwrap(); shard.set_presence(game, status, afk) } + + /// Disconnects the shard from the websocket, essentially "quiting" it. + /// Note however that this will only exit the one which the `Context` was given. + /// If it's just one shard that's on, then serenity will stop any further actions + /// until [`Client::start`] and vice versa are called again. + /// + /// [`Client::start`]: ./struct.Client.html#method.start + pub fn quit(&self) -> Result<()> { + let mut shard = self.shard.lock().unwrap(); + shard.shutdown_clean() + } } |