Browse Source

Fix file readability

pull/988/head
Hsu Still 7 years ago
parent
commit
85bbb2a08d
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
6 changed files with 42 additions and 42 deletions
  1. +8
    -10
      docs/faq/basics/client-basics.md
  2. +10
    -8
      docs/faq/commands/Commands.md
  3. +2
    -4
      docs/guides/getting_started/first-bot.md
  4. +3
    -3
      docs/guides/getting_started/installing.md
  5. +14
    -14
      docs/guides/getting_started/terminology.md
  6. +5
    -3
      docs/guides/introduction/intro.md

+ 8
- 10
docs/faq/basics/client-basics.md View File

@@ -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

+ 10
- 8
docs/faq/commands/Commands.md View File

@@ -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.



+ 2
- 4
docs/guides/getting_started/first-bot.md View File

@@ -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=<CLIENT ID>&scope=bot`
`https://discordapp.com/oauth2/authorize?client_id=<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).

+ 3
- 3
docs/guides/getting_started/installing.md View File

@@ -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)



+ 14
- 14
docs/guides/getting_started/terminology.md View File

@@ -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`).

+ 5
- 3
docs/guides/introduction/intro.md View File

@@ -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/


Loading…
Cancel
Save