Crate discord [−] [src]
Client library for the Discord API.
The Discord API can be divided into three main components: the RESTful API to which calls can be made to take actions, a websocket-based permanent connection over which state updates are received, and the voice calling system.
Log in to Discord with Discord::new, new_cache, or from_bot_token as appropriate.
The resulting value can be used to make REST API calls to post messages and manipulate Discord
state. Calling connect() will open a websocket connection, through which events can be
received. These two channels are enough to write a simple chatbot which can
read and respond to messages.
For more in-depth tracking of Discord state, a State can be seeded with
the ReadyEvent obtained when opening a Connection and kept updated with
the events received over it.
To join voice servers, call Connection::voice to get a VoiceConnection and use connect
to join a channel, then play and stop to control playback. Manipulating deaf/mute state
and receiving audio are also possible.
For examples, see the examples directory in the source tree.
Modules
| builders | Builder types used for patches and other complex data structures. | 
| model | Struct and enum definitions of values in the Discord model. | 
| voice | Voice communication module. | 
Structs
| Connection | Websocket connection to the Discord servers. | 
| Discord | Client for the Discord REST API. | 
| State | Known state composed from received events. | 
Enums
| ChannelRef | A reference to a private or public channel. | 
| Error | Discord API error type. | 
| GetMessages | Argument to  | 
Functions
| get_active_maintenances | Retrieves the active maintenances from the status page. | 
| get_unresolved_incidents | Retrieves the current unresolved incidents from the status page. | 
| get_upcoming_maintenances | Retrieves the upcoming maintenances from the status page. | 
| read_image | Read an image from a file into a string suitable for upload. | 
Type Definitions
| Result | Discord API  |