Rust library for the Discord chat client API
Find a file
2016-10-06 16:53:46 +13:00
examples The bot examples shouldn't try to logout 2016-09-24 15:59:10 -07:00
src Hack to avoid error 2016-10-06 16:53:46 +13:00
.gitignore Initial commit 2015-11-20 21:57:35 -06:00
Cargo.toml update hyper and multipart dependencies 2016-09-28 17:48:20 -04:00
LICENSE.md Add readme and license 2015-11-27 03:36:37 -06:00
README.md Add installation section to README (fixes #37) 2016-07-30 19:45:58 -07:00

discord-rs

discord-rs is a Rust client library for the Discord chat client's 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 further details, browse the source or read the documentation. For examples, browse the examples directory.

Installation

On Windows, discord-rs currently requires a GNU-like environment. For details, read the installation guide.

On all platforms, discord-rs has several system dependencies, which should be installed as appropriate:

  • pkg-config
  • openssl
  • libsodium (if using voice)
  • opus (if using voice)
  • ffmpeg (if using ffmpeg features)
  • youtube-dl (if using youtube-dl features)