1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
use tokio_tungstenite::tungstenite::Message;
use super::ShardId;
use crate::gateway::{ActivityData, ChunkGuildFilter};
use crate::model::id::GuildId;
use crate::model::user::OnlineStatus;
/// A message to send from a shard over a WebSocket.
#[derive(Debug)]
pub enum ShardRunnerMessage {
/// Indicator that a shard should be restarted.
Restart(ShardId),
/// Indicator that a shard should be fully shutdown without bringing it
/// back up.
Shutdown(ShardId, u16),
/// Indicates that the client is to send a member chunk message.
ChunkGuild {
/// The IDs of the [`Guild`] to chunk.
///
/// [`Guild`]: crate::model::guild::Guild
guild_id: GuildId,
/// The maximum number of members to receive [`GuildMembersChunkEvent`]s for.
///
/// [`GuildMembersChunkEvent`]: crate::model::event::GuildMembersChunkEvent
limit: Option<u16>,
/// Used to specify if we want the presences of the matched members.
///
/// Requires [`crate::model::gateway::GatewayIntents::GUILD_PRESENCES`].
presences: bool,
/// A filter to apply to the returned members.
filter: ChunkGuildFilter,
/// Optional nonce to identify [`GuildMembersChunkEvent`] responses.
///
/// [`GuildMembersChunkEvent`]: crate::model::event::GuildMembersChunkEvent
nonce: Option<String>,
},
/// Indicates that the client is to send a request soundboard sounds message.
SoundboardSounds {
/// The IDs of the [`Guild`] to request soundboard sounds from.
///
/// [`Guild`]: crate::model::guild::Guild
guild_ids: Vec<GuildId>,
},
/// Indicates that the client is to close with the given status code and reason.
///
/// You should rarely - if _ever_ - need this, but the option is available. Prefer to use the
/// [`ShardManager`] to shutdown WebSocket clients if you are intending to send a 1000 close
/// code.
///
/// [`ShardManager`]: super::ShardManager
Close(u16, Option<String>),
/// Indicates that the client is to send a custom WebSocket message.
Message(Message),
/// Indicates that the client is to update the shard's presence's activity.
SetActivity(Option<ActivityData>),
/// Indicates that the client is to update the shard's presence in its entirety.
SetPresence(Option<ActivityData>, OnlineStatus),
/// Indicates that the client is to update the shard's presence's status.
SetStatus(OnlineStatus),
}