diff --git a/docs/faq/Commands.md b/docs/faq/Commands.md index 27e00d43a..fdb5d8f79 100644 --- a/docs/faq/Commands.md +++ b/docs/faq/Commands.md @@ -114,7 +114,7 @@ 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 introduce race condition. + 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 diff --git a/docs/faq/Glossary.md b/docs/faq/Glossary.md index 4390edf99..3a5198bb1 100644 --- a/docs/faq/Glossary.md +++ b/docs/faq/Glossary.md @@ -24,10 +24,13 @@ Group. * A **Message channel** ([IMessageChannel]) can be any of the above. ### 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 **Category channel** ([ICategoryChannel]) (2.0+) is a category that holds one or more sub-channels. +[IGuildChannel]: xref:Discord.IGuildChannel [IMessageChannel]: xref:Discord.IMessageChannel [ITextChannel]: xref:Discord.ITextChannel [IGroupChannel]: xref:Discord.IGroupChannel diff --git a/docs/faq/basic-operations.md b/docs/faq/basic-operations.md index 13d482779..289ebc22d 100644 --- a/docs/faq/basic-operations.md +++ b/docs/faq/basic-operations.md @@ -20,6 +20,12 @@ A good and safe casting example: ## 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] method. You can get the channel via [GetChannel] under the client. 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, 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. ## 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? -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 limit more frequently than it should for methods such as adding reactions. @@ -77,6 +83,7 @@ reactions. Unfortunately, not at the moment. See [#401](https://github.com/RogueException/Discord.Net/issues/401). +[IGuildChannel]: xref:Discord.IGuildChannel [ITextChannel]: xref:Discord.ITextChannel [IGuild]: xref:Discord.IGuild [IVoiceChannel]: xref:Discord.IVoiceChannel diff --git a/docs/faq/getting-started.md b/docs/faq/getting-started.md index 9a1060ae8..cd44a8c63 100644 --- a/docs/faq/getting-started.md +++ b/docs/faq/getting-started.md @@ -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, however, you should have some decent understanding of the language 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. 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. 1. Enable Discord's developer mode. With developer mode enabled, 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) 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 diff --git a/docs/faq/samples/commands/Remainder.cs b/docs/faq/samples/commands/Remainder.cs index 9a4ac4d78..728c7438c 100644 --- a/docs/faq/samples/commands/Remainder.cs +++ b/docs/faq/samples/commands/Remainder.cs @@ -11,8 +11,9 @@ public Task EchoRemainderAsync([Remainder]string text) => ReplyAsync(text); [Command("echo-hassle")] 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 // single String. // e.g. diff --git a/docs/guides/commands/commands.md b/docs/guides/commands/commands.md index 821a1bfa7..8eaaa3818 100644 --- a/docs/guides/commands/commands.md +++ b/docs/guides/commands/commands.md @@ -159,7 +159,7 @@ install them. To manually load a module, invoke [CommandService.AddModuleAsync] by 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_ @@ -167,8 +167,12 @@ dependency map. Modules are constructed using Dependency Injection. Any parameters 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 diff --git a/src/Discord.Net.Commands/CommandError.cs b/src/Discord.Net.Commands/CommandError.cs index 9a78dcc8c..2ef4c7496 100644 --- a/src/Discord.Net.Commands/CommandError.cs +++ b/src/Discord.Net.Commands/CommandError.cs @@ -14,7 +14,7 @@ namespace Discord.Commands /// ParseFailed, /// - /// Thrown when the input text has too few parameters. + /// Thrown when the input text has too few or too many arguments. /// BadArgCount,