diff options
| author | Zeyla Hellyer <[email protected]> | 2018-01-01 10:08:57 -0800 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2018-01-01 10:08:57 -0800 |
| commit | 7e46d8f3ac5a968df9a05f8f0006522ad14891ef (patch) | |
| tree | 121546831c15f6a7ac5aaca6659cf1ca70602af6 /src/client/bridge/gateway/event.rs | |
| parent | Add a Shard Manager example in examples directory (diff) | |
| download | serenity-7e46d8f3ac5a968df9a05f8f0006522ad14891ef.tar.xz serenity-7e46d8f3ac5a968df9a05f8f0006522ad14891ef.zip | |
Add an event for shard updates
Add an event in the EventHandler to be called when a shard updates its
Connection Stage.
Diffstat (limited to 'src/client/bridge/gateway/event.rs')
| -rw-r--r-- | src/client/bridge/gateway/event.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/client/bridge/gateway/event.rs b/src/client/bridge/gateway/event.rs new file mode 100644 index 0000000..a967ab5 --- /dev/null +++ b/src/client/bridge/gateway/event.rs @@ -0,0 +1,29 @@ +//! A collection of events created by the client, not a part of the Discord API +//! itself. + +use super::ShardId; +use ::gateway::ConnectionStage; + +#[derive(Clone, Debug)] +pub(crate) enum ClientEvent { + ShardStageUpdate(ShardStageUpdateEvent), +} + +/// An event denoting that a shard's connection stage was changed. +/// +/// # Examples +/// +/// This might happen when a shard changes from [`ConnectionStage::Identifying`] +/// to [`ConnectionStage::Connected`]. +/// +/// [`ConnectionStage::Connected`]: ../../../../gateway/enum.ConnectionStage.html#variant.Connected +/// [`ConnectionStage::Identifying`]: ../../../../gateway/enum.ConnectionStage.html#variant.Identifying +#[derive(Clone, Debug)] +pub struct ShardStageUpdateEvent { + /// The new connection stage. + pub new: ConnectionStage, + /// The old connection stage. + pub old: ConnectionStage, + /// The ID of the shard that had its connection stage change. + pub shard_id: ShardId, +} |