Port terminology + logging
This commit is contained in:
@@ -35,4 +35,4 @@ For more information, go to [MSDN's Async-Await section.](https://msdn.microsoft
|
|||||||
|
|
||||||
>[!NOTE]
|
>[!NOTE]
|
||||||
>In previous versions of Discord.Net, you had to hook into the `Ready` and `GuildAvailable` events to determine when your client was ready for use.
|
>In previous versions of Discord.Net, you had to hook into the `Ready` and `GuildAvailable` events to determine when your client was ready for use.
|
||||||
>In 1.0, the [ConnectAsync](xref:Discord.DiscordSocketClient.ConnectAsync) method will automatically wait for the Ready event, and for all guilds to stream. To avoid this, pass `false` into `ConnectAsync`.
|
>In 1.0, the [ConnectAsync](xref:Discord.DiscordSocketClient#ConnectAsync) method will automatically wait for the Ready event, and for all guilds to stream. To avoid this, pass `false` into `ConnectAsync`.
|
||||||
11
docs/guides/logging.md
Normal file
11
docs/guides/logging.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Using the Logger
|
||||||
|
|
||||||
|
Discord.Net will automatically output log messages through the @Discord.DiscordSocketClient#Log event.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To handle Log Messages through Discord.Net's Logger, hook into the @Discord.DiscordSocketClient#Log event.
|
||||||
|
|
||||||
|
The @Discord.LogMessage object has a custom `ToString` method attached to it, when outputting log messages, it is reccomended you use this, instead of building your own output message.
|
||||||
|
|
||||||
|
[!code-csharp[](samples/logging.cs)]
|
||||||
19
docs/guides/samples/logging.cs
Normal file
19
docs/guides/samples/logging.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using Discord;
|
||||||
|
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
// Note: This is the light client, it only supports REST calls.
|
||||||
|
private DiscordClient _client;
|
||||||
|
static void Main(string[] args) => new Program().Start().GetAwaiter().GetResult();
|
||||||
|
|
||||||
|
public async Task Start()
|
||||||
|
{
|
||||||
|
_client = new DiscordClient(new DiscordConfig() {
|
||||||
|
LogLevel = LogSeverity.Info
|
||||||
|
});
|
||||||
|
|
||||||
|
_client.Log += (message) => Console.WriteLine($"{message.ToString()}");
|
||||||
|
|
||||||
|
await _client.LoginAsync(TokenType.Bot, "bot token");
|
||||||
|
}
|
||||||
|
}
|
||||||
20
docs/guides/terminology.md
Normal file
20
docs/guides/terminology.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Terminology
|
||||||
|
|
||||||
|
## Preface
|
||||||
|
|
||||||
|
Most terms for objects remain the same between 0.9 and 1.0. The major difference is that the ``Server`` is now called ``Guild``, to stay in line with Discord internally
|
||||||
|
|
||||||
|
## Introduction to Interfaces
|
||||||
|
|
||||||
|
Discord.Net 1.0 is built strictly around Interfaces. There are no methods that return a concrete object, only an interface.
|
||||||
|
|
||||||
|
Many of the interfaces in Discord.Net are linked through inheritance. For example, @Discord.IChannel represents any channel in Discord. @Discord.IGuildChannel inherits from IChannel, and represents all channels belonging to a Guild. As a result, @Discord.IChannel can sometimes be cast to @Discord.IGuildChannel, and you may find yourself doing this frequently in order to properly utilize the library.
|
||||||
|
|
||||||
|
### The Inheritance Tree
|
||||||
|
|
||||||
|
You may want to familiarize yourself with the inheritance in Discord.Net. An inheritance tree is provided below.
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
|
||||||
- name: Getting Started
|
- name: Getting Started
|
||||||
href: intro.md
|
href: intro.md
|
||||||
|
- name: Terminology
|
||||||
|
href: terminology.md
|
||||||
|
- name: Logging
|
||||||
|
href: logging.md
|
||||||
Reference in New Issue
Block a user