From 85bbb2a08de302448771eb0afe83366990623e80 Mon Sep 17 00:00:00 2001 From: Hsu Still <341464@gmail.com> Date: Fri, 6 Apr 2018 23:53:11 +0800 Subject: [PATCH] Fix file readability --- docs/faq/basics/client-basics.md | 18 +++++++------- docs/faq/commands/Commands.md | 18 +++++++------- docs/guides/getting_started/first-bot.md | 6 ++--- docs/guides/getting_started/installing.md | 6 ++--- docs/guides/getting_started/terminology.md | 28 +++++++++++----------- docs/guides/introduction/intro.md | 8 ++++--- 6 files changed, 42 insertions(+), 42 deletions(-) diff --git a/docs/faq/basics/client-basics.md b/docs/faq/basics/client-basics.md index 9f088e8a7..376667ca0 100644 --- a/docs/faq/basics/client-basics.md +++ b/docs/faq/basics/client-basics.md @@ -15,14 +15,12 @@ title: Basic Questions about Client > termination! There are few possible reasons why this may occur. - 1. You are not using the appropriate [TokenType]. - If you are using a bot account created from the Discord Developer - portal, you should be using `TokenType.Bot`. - 2. You are not using the correct login credentials. - Please keep in mind that tokens start with `Mj*`. - If it starts with any other characters, chances are, you might be - using the *client secret*, which has nothing to do with the login - token. + +1. You are not using the appropriate [TokenType]. If you are using a + bot account created from the Discord Developer portal, you should + be using `TokenType.Bot`. +2. You are not using the correct login credentials. Please keep in + mind that tokens is different from a *client secret*. [TokenType]: xref:Discord.TokenType @@ -51,9 +49,9 @@ use the cached message entity. Read more about it [here](xref:Guides.Concepts.Ev 1. Message Cache must be enabled. 2. Hook the MessageUpdated event. This event provides a *before* and -*after* object. + *after* object. 3. Only messages received *after* the bot comes online will be -available in the cache. + available in the cache. [MessageCacheSize]: xref:Discord.WebSocket.DiscordSocketConfig.MessageCacheSize [DiscordSocketConfig]: xref:Discord.WebSocket.DiscordSocketConfig diff --git a/docs/faq/commands/Commands.md b/docs/faq/commands/Commands.md index 374372d6d..1dfaab569 100644 --- a/docs/faq/commands/Commands.md +++ b/docs/faq/commands/Commands.md @@ -79,8 +79,9 @@ persists for **more than 3 seconds**. To resolve this, the library has designed a flag called [RunMode]. There are 2 main `RunMode`s. - 1. `RunMode.Sync` (default) - 2. `RunMode.Async` + +1. `RunMode.Sync` (default) +2. `RunMode.Async` You can set the `RunMode` either by specifying it individually via the `CommandAttribute`, or by setting the global default with @@ -120,12 +121,13 @@ different thread. This means that [ExecuteAsync] will be forced to return a successful [ExecuteResult] regardless of the execution. The following are the known caveats with `RunMode.Async`, - 1. You can potentially introduce race condition. - 2. Unnecessary overhead caused by [async state machine]. - 3. [ExecuteAsync] will immediately return [ExecuteResult] instead of - other result types (this is particularly important for those who wish - to utilize [RuntimeResult] in 2.0). - 4. Exceptions are swallowed. + +1. You can potentially introduce race condition. +2. Unnecessary overhead caused by [async state machine]. +3. [ExecuteAsync] will immediately return [ExecuteResult] instead of + other result types (this is particularly important for those who wish + to utilize [RuntimeResult] in 2.0). +4. Exceptions are swallowed. However, there are ways to remedy some of these. diff --git a/docs/guides/getting_started/first-bot.md b/docs/guides/getting_started/first-bot.md index 6b30ca9aa..87ddaf6b8 100644 --- a/docs/guides/getting_started/first-bot.md +++ b/docs/guides/getting_started/first-bot.md @@ -42,7 +42,7 @@ through the OAuth2 flow. ![Step 2](images/intro-client-id.png) 3. Create an OAuth2 authorization URL -`https://discordapp.com/oauth2/authorize?client_id=&scope=bot` + `https://discordapp.com/oauth2/authorize?client_id=&scope=bot` 4. Open the authorization URL in your browser. 5. Select a server. 6. Click on authorize. @@ -230,6 +230,4 @@ For reference, view an [annotated example] of this structure. It is important to know that the recommended design pattern of bots should be to separate the program (initialization and command handler), the modules (handle commands), and the services (persistent storage, -pure functions, data manipulation). - -**todo:** diagram of bot structure +pure functions, data manipulation). \ No newline at end of file diff --git a/docs/guides/getting_started/installing.md b/docs/guides/getting_started/installing.md index 1e22f0199..7a039f35f 100644 --- a/docs/guides/getting_started/installing.md +++ b/docs/guides/getting_started/installing.md @@ -51,12 +51,12 @@ Not sure how to add a direct feed? See how [with Visual Studio] or 1. Create a solution for your bot. 2. In Solution Explorer, find the "Dependencies" element under your -bot's project. + bot's project. 3. Right click on "Dependencies", and select "Manage NuGet packages." -![Step 3](images/install-vs-deps.png) + ![Step 3](images/install-vs-deps.png) 4. In the "Browse" tab, search for `Discord.Net`. 5. Install the `Discord.Net` package. -![Step 5](images/install-vs-nuget.png) + ![Step 5](images/install-vs-nuget.png) ## [Using JetBrains Rider](#tab/rider-install) diff --git a/docs/guides/getting_started/terminology.md b/docs/guides/getting_started/terminology.md index 7bbec23b4..a03dc8fbf 100644 --- a/docs/guides/getting_started/terminology.md +++ b/docs/guides/getting_started/terminology.md @@ -8,33 +8,33 @@ title: Terminology ## Preface Most terms for objects remain the same between 0.9 and 1.0 and above. -The major difference is that the ``Server`` is now called ``Guild`` +The major difference is that the ``Server`` is now called ``Guild`` to stay in line with Discord internally. ## Implementation Specific Entities -Discord.Net is split into a core library and three different -implementations - `Discord.Net.Core`, `Discord.Net.Rest`, +Discord.Net is split into a core library and three different +implementations - `Discord.Net.Core`, `Discord.Net.Rest`, `Discord.Net.Rpc`, and `Discord.Net.WebSockets`. -As a bot developer, you will only need to use `Discord.Net.WebSockets`, +As a bot developer, you will only need to use `Discord.Net.WebSockets`, but you should be aware of the differences between them. -`Discord.Net.Core` provides a set of interfaces that models Discord's -API. These interfaces are consistent throughout all implementations of -Discord.Net, and if you are writing an implementation-agnostic library -or addon, you can rely on the core interfaces to ensure that your +`Discord.Net.Core` provides a set of interfaces that models Discord's +API. These interfaces are consistent throughout all implementations of +Discord.Net, and if you are writing an implementation-agnostic library +or addon, you can rely on the core interfaces to ensure that your addon will run on all platforms. -`Discord.Net.Rest` provides a set of concrete classes to be used -**strictly** with the REST portion of Discord's API. Entities in this +`Discord.Net.Rest` provides a set of concrete classes to be used +**strictly** with the REST portion of Discord's API. Entities in this implementation are prefixed with `Rest` (e.g. `RestChannel`). -`Discord.Net.Rpc` provides a set of concrete classes that are used -with Discord's RPC API. Entities in this implementation are prefixed +`Discord.Net.Rpc` provides a set of concrete classes that are used +with Discord's RPC API. Entities in this implementation are prefixed with `Rpc` (e.g. `RpcChannel`). -`Discord.Net.WebSocket` provides a set of concrete classes that are +`Discord.Net.WebSocket` provides a set of concrete classes that are used primarily with Discord's WebSocket API or entities that are kept -in cache. When developing bots, you will be using this implementation. +in cache. When developing bots, you will be using this implementation. All entities are prefixed with `Socket` (e.g. `SocketChannel`). \ No newline at end of file diff --git a/docs/guides/introduction/intro.md b/docs/guides/introduction/intro.md index 9350872ee..166348ede 100644 --- a/docs/guides/introduction/intro.md +++ b/docs/guides/introduction/intro.md @@ -17,14 +17,16 @@ understand these topics to some extent before proceeding. Here are some examples: -1. [Official quick start guide](https://github.com/RogueException/Discord.Net/blob/dev/docs/guides/getting_started/samples/intro/structure.cs) -2. [Official template](https://github.com/foxbot/DiscordBotBase/tree/csharp/src/DiscordBot) +1. [Official quick start guide] +2. [Official template] -> [!TIP] +> [!NOTE] > Please note that you should *not* try to blindly copy paste > the code. The examples are meant to be a template or a guide. > It is not meant to be something that will work out of the box. +[Official template]: https://github.com/foxbot/DiscordBotBase/tree/csharp/src/DiscordBot +[Official quick start guide]: https://github.com/RogueException/Discord.Net/blob/dev/docs/guides/getting_started/samples/intro/structure.cs [Task-based Asynchronous Pattern]: https://docs.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/task-based-asynchronous-pattern-tap [polymorphism]: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/polymorphism [interface]: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/interfaces/