Browse Source

Add changes according to comments from PR

pull/988/head
Hsu Still 7 years ago
parent
commit
edb64bde13
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
7 changed files with 28 additions and 12 deletions
  1. +1
    -1
      docs/faq/Commands.md
  2. +3
    -0
      docs/faq/Glossary.md
  3. +9
    -2
      docs/faq/basic-operations.md
  4. +4
    -3
      docs/faq/getting-started.md
  5. +3
    -2
      docs/faq/samples/commands/Remainder.cs
  6. +7
    -3
      docs/guides/commands/commands.md
  7. +1
    -1
      src/Discord.Net.Commands/CommandError.cs

+ 1
- 1
docs/faq/Commands.md View File

@@ -114,7 +114,7 @@ different thread. This means that [ExecuteAsync] will be forced to
return a successful [ExecuteResult] regardless of the execution. return a successful [ExecuteResult] regardless of the execution.


The following are the known caveats with `RunMode.Async`, The following are the known caveats with `RunMode.Async`,
1. You introduce race condition.
1. You can potentially introduce race condition.
2. Unnecessary overhead caused by [async state machine]. 2. Unnecessary overhead caused by [async state machine].
3. [ExecuteAsync] will immediately return [ExecuteResult] instead of 3. [ExecuteAsync] will immediately return [ExecuteResult] instead of
other result types (this is particularly important for those who wish other result types (this is particularly important for those who wish


+ 3
- 0
docs/faq/Glossary.md View File

@@ -24,10 +24,13 @@ Group.
* A **Message channel** ([IMessageChannel]) can be any of the above. * A **Message channel** ([IMessageChannel]) can be any of the above.


### Misc Channels ### Misc Channels
* A **Guild channel** ([IGuildChannel]) is a guild channel in a guild.
- This can be any channels that may exist in a guild.
* A **Voice channel** ([IVoiceChannel]) is a voice channel in a guild. * A **Voice channel** ([IVoiceChannel]) is a voice channel in a guild.
* A **Category channel** ([ICategoryChannel]) (2.0+) is a category that * A **Category channel** ([ICategoryChannel]) (2.0+) is a category that
holds one or more sub-channels. holds one or more sub-channels.


[IGuildChannel]: xref:Discord.IGuildChannel
[IMessageChannel]: xref:Discord.IMessageChannel [IMessageChannel]: xref:Discord.IMessageChannel
[ITextChannel]: xref:Discord.ITextChannel [ITextChannel]: xref:Discord.ITextChannel
[IGroupChannel]: xref:Discord.IGroupChannel [IGroupChannel]: xref:Discord.IGroupChannel


+ 9
- 2
docs/faq/basic-operations.md View File

@@ -20,6 +20,12 @@ A good and safe casting example:


## How do I send a message? ## How do I send a message?


> [!TIP]
> The [GetChannel] method by default returns an [IChannel].
> This means channels such as [IVoiceChannel], [ICategoryChannel]
> can be returned. This is why that you cannot send message
> to channels like those.

Any implementation of [IMessageChannel] has a [SendMessageAsync] Any implementation of [IMessageChannel] has a [SendMessageAsync]
method. You can get the channel via [GetChannel] under the client. method. You can get the channel via [GetChannel] under the client.
Remember, when using Discord.NET, polymorphism is a common recurring Remember, when using Discord.NET, polymorphism is a common recurring
@@ -42,7 +48,7 @@ various types of channels.


There are 2 ways to do this. You can do either of the following, There are 2 ways to do this. You can do either of the following,
1. Cast the user as an [IGuildUser] and use its [IGuild] property. 1. Cast the user as an [IGuildUser] and use its [IGuild] property.
2. Cast the channel as an [ITextChannel]/[IVoiceChannel] and use
2. Cast the channel as an [IGuildChannel] and use
its [IGuild] property. its [IGuild] property.


## How do I add hyperlink text to an embed? ## How do I add hyperlink text to an embed?
@@ -67,7 +73,7 @@ implement [IEmote] and are valid options.
## 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 .NET parses the HTML header, 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 casues 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.
@@ -77,6 +83,7 @@ reactions.
Unfortunately, not at the moment. See [#401](https://github.com/RogueException/Discord.Net/issues/401). Unfortunately, not at the moment. See [#401](https://github.com/RogueException/Discord.Net/issues/401).


[IGuildChannel]: xref:Discord.IGuildChannel
[ITextChannel]: xref:Discord.ITextChannel [ITextChannel]: xref:Discord.ITextChannel
[IGuild]: xref:Discord.IGuild [IGuild]: xref:Discord.IGuild
[IVoiceChannel]: xref:Discord.IVoiceChannel [IVoiceChannel]: xref:Discord.IVoiceChannel


+ 4
- 3
docs/faq/getting-started.md View File

@@ -5,8 +5,8 @@ First of all, welcome! You may visit us on our Discord should you
have any questions. Before you delve into using the library, have any questions. Before you delve into using the library,
however, you should have some decent understanding of the language however, you should have some decent understanding of the language
you are about to use. This library touches on you are about to use. This library touches on
[Task-based Asynchronous Pattern], [polymorphism], [interface] and
many more advanced topics extensively. Please make sure that you
[Task-based Asynchronous Pattern] (TAP), [polymorphism], [interface]
and many more advanced topics extensively. Please make sure that you
understand these topics to some extent before proceeding. understand these topics to some extent before proceeding.
Here are some examples: Here are some examples:
@@ -47,7 +47,8 @@ library require an ID to retrieve the said object.
There are 2 ways to obtain the said ID. There are 2 ways to obtain the said ID.
1. Enable Discord's developer mode. With developer mode enabled, 1. Enable Discord's developer mode. With developer mode enabled,
you can - as an example - right click on a guild and copy the guild you can - as an example - right click on a guild and copy the guild
id (please note that this does not apply to Role IDs, see below).
id (please note that this does not apply to all objects, such as
Role IDs \[see below], or DM channel IDs).
![Developer Mode](images/dev-mode.png) ![Developer Mode](images/dev-mode.png)
2. Escape the object using `\` in front the object. For example, 2. Escape the object using `\` in front the object. For example,
when you do `\@Example#1234` in chat, it will return the user ID of when you do `\@Example#1234` in chat, it will return the user ID of


+ 3
- 2
docs/faq/samples/commands/Remainder.cs View File

@@ -11,8 +11,9 @@ public Task EchoRemainderAsync([Remainder]string text) => ReplyAsync(text);
[Command("echo-hassle")] [Command("echo-hassle")]
public Task EchoAsync(string text) => ReplyAsync(text); public Task EchoAsync(string text) => ReplyAsync(text);


// The message would be seen as having 5 parameters, while the method
// only accepts one. Wrapping the message in quotes solves this.
// The message would be seen as having multiple parameters,
// while the method only accepts one.
// Wrapping the message in quotes solves this.
// This way, the system knows the entire message is to be parsed as a // This way, the system knows the entire message is to be parsed as a
// single String. // single String.
// e.g. // e.g.

+ 7
- 3
docs/guides/commands/commands.md View File

@@ -159,7 +159,7 @@ install them.


To manually load a module, invoke [CommandService.AddModuleAsync] by To manually load a module, invoke [CommandService.AddModuleAsync] by
passing in the generic type of your module and optionally, a passing in the generic type of your module and optionally, a
dependency map.
service provider.


[CommandService.AddModuleAsync]: xref:Discord.Commands.CommandService#Discord_Commands_CommandService_AddModuleAsync__1_System_IServiceProvider_ [CommandService.AddModuleAsync]: xref:Discord.Commands.CommandService#Discord_Commands_CommandService_AddModuleAsync__1_System_IServiceProvider_


@@ -167,8 +167,12 @@ dependency map.


Modules are constructed using Dependency Injection. Any parameters Modules are constructed using Dependency Injection. Any parameters
that are placed in the Module's constructor must be injected into an that are placed in the Module's constructor must be injected into an
@System.IServiceProvider first. Alternatively, you may accept an
`IServiceProvider` as an argument and extract services yourself.
@System.IServiceProvider first.

> [!TIP]
> Alternatively, you may accept an
> `IServiceProvider` as an argument and extract services yourself,
> although this is discouraged.


### Module Properties ### Module Properties




+ 1
- 1
src/Discord.Net.Commands/CommandError.cs View File

@@ -14,7 +14,7 @@ namespace Discord.Commands
/// </summary> /// </summary>
ParseFailed, ParseFailed,
/// <summary> /// <summary>
/// Thrown when the input text has too few parameters.
/// Thrown when the input text has too few or too many arguments.
/// </summary> /// </summary>
BadArgCount, BadArgCount,




Loading…
Cancel
Save