Struct discord::State
[−]
[src]
pub struct State { // some fields omitted }
Known state composed from received events.
Methods
impl State
[src]
fn new(ready: ReadyEvent) -> State
Create a new state from an initial ReadyEvent
.
fn unknown_members(&self) -> u64
Count the total number of server members not yet downloaded.
fn download_online_members(&mut self, connection: &Connection)
Requests a download of online member lists.
It is recommended to avoid calling this method until the online member list is actually needed, especially for large servers, in order to save bandwidth and memory.
fn download_all_members(&mut self, connection: &Connection)
Requests a download of all member information for large servers.
The members lists are cleared on call, and then refilled as chunks are received. When
unknown_members()
returns 0, the download has completed.
fn update(&mut self, event: &Event)
Update the state according to the changes described in the given event.
fn user(&self) -> &CurrentUser
Get information about the logged-in user.
fn settings(&self) -> Option<&UserSettings>
Get the logged-in user's client settings. Will return None
for bots.
fn server_settings(&self) -> Option<&[UserServerSettings]>
Get the logged-in user's per-server notification settings. Will return None
for bots.
fn session_id(&self) -> &str
Get the websocket session ID.
fn private_channels(&self) -> &[PrivateChannel]
Get the list of private channels with other users.
fn servers(&self) -> &[LiveServer]
Get the list of servers this user has access to.
fn find_channel(&self, id: &ChannelId) -> Option<ChannelRef>
Look up a private or public channel by its ID.
fn find_voice_user(&self, user_id: UserId) -> Option<(ServerId, ChannelId)>
Look up the voice channel a user is in, if any.
For bot users which may be in multiple voice channels, the first found is returned.
fn notes(&self) -> Option<&BTreeMap<UserId, String>>
Get the map of notes that have been made by this user.
Trait Implementations
Derived Implementations
impl Clone for State
[src]
fn clone(&self) -> State
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more