Early 1.0 REST Preview

This commit is contained in:
RogueException
2016-04-04 20:15:16 -03:00
parent b888ea23dc
commit 5bdd6a7ff3
470 changed files with 6804 additions and 14042 deletions

View File

@@ -3,19 +3,21 @@ Events
Usage
-----
Messages from the Discord server are exposed via events on the DiscordClient class and follow the standard EventHandler<EventArgs> C# pattern.
Messages from the Discord server are exposed via events on the DiscordClient class and follow the standard EventHandler<EventArgs> C# pattern.
.. warning::
Note that all synchronous code in an event handler will run on the gateway socket's thread and should be handled as quickly as possible.
Note that all synchronous code in an event handler will run on the gateway socket's thread and should be handled as quickly as possible.
Using the async-await pattern to let the thread continue immediately is recommended and is demonstrated in the examples below.
Ready
-----
Connection State
----------------
The Ready Event is raised only once, when your client finishes processing the READY packet from Discord.
This has replaced the previous "Connected" event, and indicates that it is safe to begin retrieving users, channels, or servers from the cache.
Connection Events will be raised when the Connection State of your client changes.
.. warning::
You should not use DiscordClient.Connected to run code when your client first connects to Discord.
If you lose connection and automatically reconnect, this code will be ran again, which may lead to unexpected behavior.
Messages
--------
@@ -24,7 +26,7 @@ Messages
Example of MessageReceived:
.. code-block:: csharp6
.. code-block:: c#
// (Preface: Echo Bots are discouraged, make sure your bot is not running in a public server if you use them)
@@ -54,7 +56,7 @@ There are several user events:
Examples:
.. code-block:: csharp6
.. code-block:: c#
// Register a Hook into the UserBanned event using a Lambda
_client.UserBanned += async (s, e) => {