Browse Source

Fix minor typos

pull/988/head
Hsu Still 7 years ago
parent
commit
3e5679d8b8
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
3 changed files with 13 additions and 7 deletions
  1. +1
    -1
      docs/faq/basics/basic-operations.md
  2. +2
    -1
      docs/faq/misc/Glossary.md
  3. +10
    -5
      docs/guides/commands/preconditions.md

+ 1
- 1
docs/faq/basics/basic-operations.md View File

@@ -89,7 +89,7 @@ returned by a Discord response.
## Why am I getting so many preemptive rate limits when I try to add more than one reactions? ## Why am I getting so many preemptive rate limits when I try to add more than one reactions?


This is due to how HTML header works, mistreating This is due to how HTML header works, mistreating
0.25sec/action to 1sec. This casues the lib to throw preemptive rate
0.25sec/action to 1sec. This causes the lib to throw preemptive rate
limit more frequently than it should for methods such as adding limit more frequently than it should for methods such as adding
reactions. reactions.




+ 2
- 1
docs/faq/misc/Glossary.md View File

@@ -10,8 +10,9 @@ title: Common Terminologies / Glossary
* A **Guild** ([IGuild]) is an isolated collection of users and * A **Guild** ([IGuild]) is an isolated collection of users and
channels, and are often referred to as "servers". channels, and are often referred to as "servers".
- Example: [Discord API](https://discord.gg/jkrBmQR) - Example: [Discord API](https://discord.gg/jkrBmQR)
* A **Channel** ([IChannel]) represents either a voice or text channel.
* A **Channel** ([IChannel]) represents a generic channel.
- Example: #dotnet_discord-net - Example: #dotnet_discord-net
- See [Channel Types](#channel-types)
[IGuild]: xref:Discord.IGuild [IGuild]: xref:Discord.IGuild
[IChannel]: xref:Discord.IChannel [IChannel]: xref:Discord.IChannel


+ 10
- 5
docs/guides/commands/preconditions.md View File

@@ -5,7 +5,7 @@ title: Preconditions


# Preconditions # Preconditions


Precondition serve as a permissions system for your Commands. Keep in
Preconditions serve as a permissions system for your Commands. Keep in
mind, however, that they are not limited to _just_ permissions and can mind, however, that they are not limited to _just_ permissions and can
be as complex as you want them to be. be as complex as you want them to be.


@@ -21,8 +21,8 @@ You may visit their respective API documentation to find out more.


## Bundled Preconditions ## Bundled Preconditions


@Discord.Commands ship with several bundled Preconditions; you may
view their usages on their respective API pages.
@Discord.Commands ships with several bundled Preconditions for you
to use.


* @Discord.Commands.RequireContextAttribute * @Discord.Commands.RequireContextAttribute
* @Discord.Commands.RequireOwnerAttribute * @Discord.Commands.RequireOwnerAttribute
@@ -39,13 +39,18 @@ depending on your use.
In order for your Precondition to function, you will need to override In order for your Precondition to function, you will need to override
the [CheckPermissionsAsync] method. the [CheckPermissionsAsync] method.


Your IDE should provide an option to fill this in for you.

If the context meets the required parameters, return If the context meets the required parameters, return
[PreconditionResult.FromSuccess], otherwise return [PreconditionResult.FromSuccess], otherwise return
[PreconditionResult.FromError] and include an error message if [PreconditionResult.FromError] and include an error message if
necessary. necessary.


> [!NOTE]
> Visual Studio can help you implement missing members
> from the abstract class by using the "Implement Abstract Class"
> IntelliSense hint.

### Example - Creating a Custom Precondition

[!code-csharp[Custom Precondition](samples/require_owner.cs)] [!code-csharp[Custom Precondition](samples/require_owner.cs)]


[CheckPermissionsAsync]: xref:Discord.Commands.PreconditionAttribute.CheckPermissionsAsync* [CheckPermissionsAsync]: xref:Discord.Commands.PreconditionAttribute.CheckPermissionsAsync*


Loading…
Cancel
Save