Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
OoLunar committed May 1, 2024
1 parent 946ae75 commit 60c986b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/articles/commands/custom_context_checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A context check contains two important pieces:
- The attribute that will be applied to the command. This contains parameters that will be passed to the executing check.
- The check itself. This is the method that determines if the command can be executed.

# Implementing a Context Check Attribute
## Implementing a Context Check Attribute
To create a context check, you will need to create a new attribute that inherits from `CheckBaseAttribute`. This attribute will be applied to the command method and will contain the parameters that will be passed to the check method.

```cs
Expand All @@ -23,7 +23,7 @@ public class DirectMessageUsageAttribute : ContextCheckAttribute

This is the attribute that you will apply to the command method.

# Implementing the Check Method
## Implementing the Check Method
Now we're going to implement the logic which checks if the command is allowed to be executed. The `IContextCheck<T>` interface is used to define the check method. The `T` is the attribute/parameters that's associated with the command. In this case, it's the `DirectMessageUsageAttribute`.

```cs
Expand Down
7 changes: 7 additions & 0 deletions docs/articles/commands/processors/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
uid: articles.commands.command_processors.introduction
title: Command Processors Introduction
---

# Command Processors
Each processor has features specific to it. For example, the `SlashCommand` processor has support for choice providers and auto-complete, while the `TextCommand` processor has support for command aliases. Each section will be named after their own processor, explaining which features are available and how to use them.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The user can type in any text they type. As they type in the text, Discord will
> [!WARNING]
> The user **is not required** to choose from the the suggestions provided. They can send any value they want, and it's up to your bot to handle the value.
# Which one should I use?
## Which one should I use?
If you have a small, fixed list of options, use a choice provider. If you have a large list of options or the list of options can change at runtime, use auto-complete.

Some valid use-cases for choice providers include:
Expand Down
2 changes: 2 additions & 0 deletions docs/articles/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
topicUid: articles.commands.custom_error_handler
- name: Command Processors
items:
- name: Introduction
topicUid: articles.commands.command_processors.introduction
- name: Slash Commands
items:
- name: Choice Providers vs AutoComplete
Expand Down

0 comments on commit 60c986b

Please sign in to comment.