Struct discord::State
[−]
[src]
pub struct State { /* 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 all_private_channels(&self) -> Vec<ChannelId>
Build a list of all known private and group channel IDs.
fn all_servers(&self) -> Vec<ServerId>
Build a list of all known server IDs.
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 servers(&self) -> &[LiveServer]
Get the servers this user has access to.
Get the currently unavailable servers.
fn private_channels(&self) -> &[PrivateChannel]
Get the active 1-on-1 private channels with other users.
fn groups(&self) -> &BTreeMap<ChannelId, Group>
Get the active groups with other users.
fn calls(&self) -> &BTreeMap<ChannelId, Call>
Get the currently ongoing calls.
Calls which were already ongoing when the user connected may require
calling Connection::sync_calls
to appear here.
fn presences(&self) -> &[Presence]
Get the presences of online friends.
Usually empty for bot accounts.
fn relationships(&self) -> &[Relationship]
Get the friend/block relationships with other users.
Usually empty for bot accounts.
fn settings(&self) -> Option<&UserSettings>
Get the logged-in user's client settings.
Returns None
on bot accounts.
fn server_settings(&self) -> Option<&[UserServerSettings]>
Get the logged-in user's per-server notification settings.
Returns None
on bot accounts.
fn notes(&self) -> Option<&BTreeMap<UserId, String>>
Get the map of notes that have been made by this user.
Returns None
on bot accounts.
fn find_server(&self, id: ServerId) -> Option<&LiveServer>
Look up a server by its ID.
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<(Option<ServerId>, ChannelId)>
&self,
user_id: UserId
) -> Option<(Option<ServerId>, ChannelId)>
Look up the voice channel or group call a user is in, if any.
For bot users which may be in multiple voice channels, the first found is returned.
Trait Implementations
impl Debug for State
[src]
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