Struct discord::Connection [] [src]

pub struct Connection { /* fields omitted */ }

Websocket connection to the Discord servers.

Methods

impl Connection
[src]

Establish a connection to the Discord websocket servers.

Returns both the Connection and the ReadyEvent which is always the first event received and contains initial state information.

Usually called internally by Discord::connect, which provides both the token and URL and an optional user-given shard ID and total shard count.

Change the game information that this client reports as playing.

Set the client to be playing this game, with defaults used for any extended information.

Sets the active presence of the client, including game and/or status information.

afk will help Discord determine where to send notifications.

Get a handle to the voice connection for a server.

Pass None to get the handle for group and one-on-one calls.

Drop the voice connection for a server, forgetting all settings.

Calling .voice(server_id).disconnect() will disconnect from voice but retain the mute and deaf status, audio source, and audio receiver.

Pass None to drop the connection for group and one-on-one calls.

Receive an event over the websocket, blocking until one is available.

Cleanly shut down the websocket connection. Optional.

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.

Can be used with State::all_servers.

Request a synchronize of active calls for the specified channels.

Can be used with State::all_private_channels.

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.