[−][src]Struct serenity::client::bridge::gateway::ShardMessenger
A lightweight wrapper around an mpsc sender.
This is used to cleanly communicate with a shard's respective
ShardRunner
. This can be used for actions such as setting the activity
via set_activity
or shutting down via shutdown_clean
.
Implementations
impl ShardMessenger
[src]
pub fn new(tx: Sender<InterMessage>) -> Self
[src]
Creates a new shard messenger.
If you are using the Client
, you do not need to do this.
pub fn chunk_guild(
&self,
guild_id: GuildId,
limit: Option<u16>,
filter: ChunkGuildFilter,
nonce: Option<String>
)
[src]
&self,
guild_id: GuildId,
limit: Option<u16>,
filter: ChunkGuildFilter,
nonce: Option<String>
)
Requests that one or multiple Guild
s be chunked.
This will ask the gateway to start sending member chunks for large guilds (250 members+). If a guild is over 250 members, then a full member list will not be downloaded, and must instead be requested to be sent in "chunks" containing members.
Member chunks are sent as the Event::GuildMembersChunk
event. Each
chunk only contains a partial amount of the total members.
If the cache
feature is enabled, the cache will automatically be
updated with member chunks.
Examples
Chunk a single guild by Id, limiting to 2000 Member
s, and not
specifying a query parameter:
use serenity::model::id::GuildId; shard.chunk_guild(GuildId(81384788765712384), Some(2000), ChunkGuildFilter::None, None);
Chunk a single guild by Id, limiting to 20 members, specifying a
query parameter of "do"
and a nonce of "request"
:
use serenity::model::id::GuildId; shard.chunk_guild(GuildId(81384788765712384), Some(20), ChunkGuildFilter::Query("do".to_owned()), Some("request"));
pub fn set_activity(&self, activity: Option<Activity>)
[src]
Sets the user's current activity, if any.
Other presence settings are maintained.
Examples
Setting the current activity to playing "Heroes of the Storm"
:
use serenity::model::gateway::Activity; shard.set_activity(Some(Activity::playing("Heroes of the Storm")));
pub fn set_presence(&self, activity: Option<Activity>, status: OnlineStatus)
[src]
Sets the user's full presence information.
Consider using the individual setters if you only need to modify one of these.
Examples
Set the current user as playing "Heroes of the Storm"
and being
online:
use serenity::model::gateway::Activity; use serenity::model::user::OnlineStatus; let activity = Activity::playing("Heroes of the Storm"); shard.set_presence(Some(activity), OnlineStatus::Online);
pub fn set_status(&self, online_status: OnlineStatus)
[src]
Sets the user's current online status.
Note that Offline
is not a valid online status, so it is
automatically converted to Invisible
.
Other presence settings are maintained.
Examples
Setting the current online status for the shard to DoNotDisturb
.
use serenity::model::user::OnlineStatus; shard.set_status(OnlineStatus::DoNotDisturb);
pub fn shutdown_clean(&self)
[src]
Shuts down the websocket by attempting to cleanly close the connection.
pub fn websocket_message(&self, message: Message)
[src]
Sends a raw message over the WebSocket.
The given message is not mutated in any way, and is sent as-is.
You should only use this if you know what you're doing. If you're
wanting to, for example, send a presence update, prefer the usage of
the set_presence
method.
pub fn send_to_shard(
&self,
msg: ShardRunnerMessage
) -> Result<(), TrySendError<InterMessage>>
[src]
&self,
msg: ShardRunnerMessage
) -> Result<(), TrySendError<InterMessage>>
Sends a message to the shard.
pub fn set_message_filter(&self, collector: MessageFilter)
[src]
Sets a new filter for a message collector.
pub fn set_reaction_filter(&self, collector: ReactionFilter)
[src]
Sets a new filter for a message collector.
Trait Implementations
impl AsRef<ShardMessenger> for ShardMessenger
[src]
pub fn as_ref(&self) -> &ShardMessenger
[src]
impl AsRef<ShardMessenger> for ShardRunnerInfo
[src]
pub fn as_ref(&self) -> &ShardMessenger
[src]
impl AsRef<ShardMessenger> for Context
[src]
pub fn as_ref(&self) -> &ShardMessenger
[src]
impl Clone for ShardMessenger
[src]
pub fn clone(&self) -> ShardMessenger
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ShardMessenger
[src]
Auto Trait Implementations
impl !RefUnwindSafe for ShardMessenger
[src]
impl Send for ShardMessenger
[src]
impl Sync for ShardMessenger
[src]
impl Unpin for ShardMessenger
[src]
impl !UnwindSafe for ShardMessenger
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,