Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format files #85

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions docs/extensions/bridge/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Let's say that you want to make a command that is both a Slash Command and a Pre

This is where the `ext.bridge` module comes in. It allows you to use one callback to make both a Slash Command and a Prefixed Command.


### Example Usage

```python
Expand All @@ -42,6 +41,7 @@ bot.run("TOKEN")
hello
</DiscordInteraction>
</div>

Hello!
</DiscordMessage>

Expand All @@ -55,6 +55,7 @@ bot.run("TOKEN")
!hello
</DiscordInteraction>
</div>

Hello!
</DiscordMessage>
</DiscordComponent>
Expand Down Expand Up @@ -95,6 +96,7 @@ The cog will automatically split the Bridge Command into their Slash Command and
hello
</DiscordInteraction>
</div>

Hello!
</DiscordMessage>

Expand All @@ -108,6 +110,7 @@ The cog will automatically split the Bridge Command into their Slash Command and
!hello
</DiscordInteraction>
</div>

Hello!
</DiscordMessage>

Expand All @@ -117,6 +120,7 @@ The cog will automatically split the Bridge Command into their Slash Command and
bye
</DiscordInteraction>
</div>

Bye!
</DiscordMessage>

Expand All @@ -130,6 +134,7 @@ The cog will automatically split the Bridge Command into their Slash Command and
!bye
</DiscordInteraction>
</div>

Bye!
</DiscordMessage>
</DiscordComponent>
Expand All @@ -138,8 +143,6 @@ The cog will automatically split the Bridge Command into their Slash Command and

You can defer if you want to communicate to the user that your bot is busy processing the command. This is done by using `ctx.defer()`. For the Slash Command implementation, `ctx.defer()` calls the function that gives out a "Bot is thinking" message. For the Prefixed Command implementation, `ctx.defer()` enables the typing indicator.

<!-- TODO: Add example images of deferring at work -->

### Options

Options are pretty straightforward. You just specify them like you do with prefixed commands, and you're all set!
Expand All @@ -164,6 +167,7 @@ bot.run("TOKEN")
sum
</DiscordInteraction>
</div>

4
</DiscordMessage>

Expand All @@ -177,6 +181,7 @@ bot.run("TOKEN")
!sum 2 2
</DiscordInteraction>
</div>

4
</DiscordMessage>
</DiscordComponent>
16 changes: 8 additions & 8 deletions docs/extensions/commands/cogs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ not work on its own. In your main bot file, you must add the following code:
bot.load_extension('cogs.greetings')
```

This loads the file `cogs/greetings.py` and adds it to the bot.
This loads the file `cogs/greetings.py` and adds it to the bot.
The argument of `load_extension` should be your cog's path (eg. cogs/greetings.py) without the file
extension and with the `/` replaced with `.`

Expand All @@ -76,9 +76,9 @@ is because cogs work slightly different than a regular file.

### The `self` variable

The self variable is a variable that represents a class. In the case of cogs, `self` represents
The self variable is a variable that represents a class. In the case of cogs, `self` represents
the cog. In the `__init__` function, you can see that we have `self.bot = bot`. `bot` represents your
`discord.Bot` or `discord.ext.commands.Bot` instance, which is used for some functions.
`discord.Bot` or `discord.ext.commands.Bot` instance, which is used for some functions.

This means that instead of using functions that would usually be accessed via `bot`, you now need
to access them via `self.bot`
Expand All @@ -90,7 +90,7 @@ wouldn't be able to access our bot instance.
### Creating Commands

When creating commands, your decorator would usually be something like `@bot.command()`. If you're using
cogs, this isn't the case. In a cog, you can't access the bot instance outside of functions, so to
cogs, this isn't the case. In a cog, you can't access the bot instance outside of functions, so to
register a function as a command, you must instead use `@commands.command()`.

Also, when creating a command, make sure that it is indented. If we want a command to be actually
Expand All @@ -108,9 +108,9 @@ create a help command [here](./help-command.mdx)

:::info Related Topics

- [Slash commands in Cogs](../../interactions/application-commands/slash-commands.mdx#slash-commands-in-cogs)
- [Creating a Help Command](./help-command.mdx)
- [Rules and Common Practices](../../getting-started/rules-and-common-practices.mdx)
- [Prefixed Commands](./prefixed-commands.mdx)
* [Slash commands in Cogs](../../interactions/application-commands/slash-commands.mdx#slash-commands-in-cogs)
* [Creating a Help Command](./help-command.mdx)
* [Rules and Common Practices](../../getting-started/rules-and-common-practices.mdx)
* [Prefixed Commands](./prefixed-commands.mdx)

:::
6 changes: 2 additions & 4 deletions docs/extensions/commands/groups.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ To create a command group, the command's decorator must be `@bot.group`. Once yo
that decorator, you can use `@function.command()`, such as `@math.command()`. Now, you have subcommand
groups!

<!-- Waiting for slash command groups in Pycord -->

:::info Related Topics

- [Prefixed Commands](./prefixed-commands.mdx)
- [Cogs](./cogs.mdx)
* [Prefixed Commands](./prefixed-commands.mdx)
* [Cogs](./cogs.mdx)

:::
Loading