Skip to content
Merged

stuff #249

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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Pycord Guide
[![Netlify Status](https://api.netlify.com/api/v1/badges/c6976714-2c3d-4ff5-a30f-cf784045062a/deploy-status)](https://app.netlify.com/sites/pycord/deploys)

The official Guide for Pycord, explaining Pycord's features and how to use them.

Expand All @@ -18,7 +17,7 @@ The Guide is built using [Docusaurus 2](https://docusaurus.io/), a modern static

[`/src`](./src) contains styling (`.scss`) and the index (`.tsx`/`jsx`).

[`/docs`](./docs) contains the pages for the guide. The Guide Pages are writtern in the `mdx` file format, a combination of Markdown syntax and JSX/React.
[`/docs`](./docs) contains the pages for the guide. The Guide Pages are written in the `mdx` file format, a combination of Markdown syntax and JSX/React.

## Local Development

Expand Down
6 changes: 3 additions & 3 deletions docs/extensions/commands/help-command.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ of making one with Pycord. Making a help command with subclassing and OOP will s

There are two types of built-in help commands:

- [`DefaultHelpCommand`](https://docs.pycord.dev/en/master/api.html#discord.ext.commands.DefaultHelpCommand)
- [`MinimalHelpCommand`](https://docs.pycord.dev/en/master/api.html#discord.ext.commands.MinimalHelpCommand)
- [`DefaultHelpCommand`](https://docs.pycord.dev/en/stable/api.html#discord.ext.commands.DefaultHelpCommand)
- [`MinimalHelpCommand`](https://docs.pycord.dev/en/stable/api.html#discord.ext.commands.MinimalHelpCommand)

`DefaultHelpCommand` is the command enabled by default. It isn't the best looking, but `MinimalHelpCommand` can help make it look a bit better.

Expand Down Expand Up @@ -359,7 +359,7 @@ class MyHelp(commands.HelpCommand):
await self.get_destination().send(embed=embed)
```

Add all of these methods together and you have a fully functioning help command!
Add all of these methods together, and you have a fully functioning help command!

<details>
<summary>Click to see the final code for this section</summary>
Expand Down
16 changes: 8 additions & 8 deletions docs/extensions/pages/paginator-basics.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Paginator Basics

# Paginator Basics

## [Page](https://docs.pycord.dev/en/master/ext/pages/index.html#page)
## [Page](https://docs.pycord.dev/en/stable/ext/pages/index.html#page)
This class contains two attributes: `content` and `embeds`, which correspond to the attributes of the same name on the
`discord.Message` class.
To create a new Page, use the following syntax:
Expand All @@ -13,11 +13,11 @@ import discord
page = Page(content="My Page Content", embeds=[discord.Embed(title="My First Embed Title")])
```

## [PageGroup](https://docs.pycord.dev/en/master/ext/pages/index.html#pagegroup)
## [PageGroup](https://docs.pycord.dev/en/stable/ext/pages/index.html#pagegroup)
This class represents a group of pages. It uses most of the same parameters as `Paginator`, which allows each
`PageGroup` to effectively have its own settings and behaviours.

## [Paginator](https://docs.pycord.dev/en/master/ext/pages/index.html#paginator)
## [Paginator](https://docs.pycord.dev/en/stable/ext/pages/index.html#paginator)
This is the main class for `ext.pages`, and is used to control most of the functionality of the extension.

In its most basic form, with no arguments provided (default values listed below), a paginator can be created like so:
Expand Down Expand Up @@ -54,8 +54,8 @@ The only required parameter for `Paginator` is the `pages` parameter, which is u
You can also pass in a list of `PageGroup` objects, a list of strings, a list of embeds, or a list of lists of embeds.

Once the `Paginator` instance is created, you can call either
[`Paginator.send()`](https://docs.pycord.dev/en/master/ext/pages/index.html#discord.ext.pages.Paginator.send)
or [`Paginator.respond()`](https://docs.pycord.dev/en/master/ext/pages/index.html#discord.ext.pages.Paginator.respond)
[`Paginator.send()`](https://docs.pycord.dev/en/stable/ext/pages/index.html#discord.ext.pages.Paginator.send)
or [`Paginator.respond()`](https://docs.pycord.dev/en/stable/ext/pages/index.html#discord.ext.pages.Paginator.respond)
to send a message or response with the paginator's contents.

#### Depending on what's being passed to the `pages` parameter, the behaviour of the paginator may differ:
Expand Down Expand Up @@ -89,11 +89,11 @@ child list. This type of page cannot have any message content.
- When using the default buttons, shows a middle 5th button with the current/total page numbers.

**For other parameters that can be set on initialization, please check the
[API Reference](https://docs.pycord.dev/en/master/ext/pages/index.html#paginator)**
[API Reference](https://docs.pycord.dev/en/stable/ext/pages/index.html#paginator)**



## [PaginatorButton](https://docs.pycord.dev/en/master/ext/pages/index.html#paginatorbutton)
## [PaginatorButton](https://docs.pycord.dev/en/stable/ext/pages/index.html#paginatorbutton)
This class represents a button used to navigate between the pages of a paginator. It's also used to create the page
indicator.

Expand Down Expand Up @@ -143,7 +143,7 @@ paginator.remove_button("last")
```


## [PaginatorMenu](https://docs.pycord.dev/en/master/ext/pages/index.html#paginatormenu)
## [PaginatorMenu](https://docs.pycord.dev/en/stable/ext/pages/index.html#paginatormenu)
This class represents the `discord.Select` menu used to navigate between `PageGroup` instances. In most situations, you
will not need to interact with this class directly.

Expand Down
26 changes: 13 additions & 13 deletions docs/extensions/tasks/tasks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ doing very useful stuff.
doing very useful stuff.
```

For a more useful example here's a task in a cog context ripped straight from the [docs](https://docs.pycord.dev/en/master/ext/tasks/index.html#recepies):
For a more useful example here's a task in a cog context ripped straight from the [docs](https://docs.pycord.dev/en/stable/ext/tasks/index.html#recepies):

```py
from discord.ext import tasks, commands
Expand Down Expand Up @@ -64,13 +64,13 @@ As you'd expect this will increment a number and print it out every 5 seconds li
# ...
```

## [Tasks](https://docs.pycord.dev/en/master/ext/tasks/index.html)
## [Tasks](https://docs.pycord.dev/en/stable/ext/tasks/index.html)

Now let's get into the nitty-gritty of tasks.

As you've seen tasks can work in both outer scope and class contexts and the handle is roughly the same, you define a task using the `tasks.loop` decorator and use the `start` method to start it, the difference is you add the `self` argument when in a class context so since most people have all their bot's code in Cogs all the following code blocks will be in a Cog context to make it easy to copy it then apply whatever modifications you might need!

### [Creating a task](https://docs.pycord.dev/en/master/ext/tasks/index.html#discord.ext.tasks.loop)
### [Creating a task](https://docs.pycord.dev/en/stable/ext/tasks/index.html#discord.ext.tasks.loop)

A look at `discord.ext.tasks.loop`'s definition in the documentation reveals that:
1. As you've seen before it expects the time between each execution, that however doesn't have to be in seconds as
Expand All @@ -82,8 +82,8 @@ at the specified time(s).
to make it run forever which is also the default.
4. The loop function ***must*** be a coroutine.

These are all really useful and they aren't the only parameters so if you wanna know more about them check out the
[docs](https://docs.pycord.dev/en/master/ext/tasks/index.html#discord.ext.tasks.loop)!
These are all really useful, and they aren't the only parameters so if you want to know more about them check out the
[docs](https://docs.pycord.dev/en/stable/ext/tasks/index.html#discord.ext.tasks.loop)!

### Attributes

Expand All @@ -103,7 +103,7 @@ Now let's create a cog that handles a leaderboard we have in our bot using Tasks
also provide a refresher of how slash commands groups work in cogs.

For the sake of this example let's pretend that we have a leaderboard module that does all the leaderboard handling for
us and that computing the leaderboard is very expensive computationally wise so we want to store one version of it that
us and that computing the leaderboard is very expensive computationally wise, so we want to store one version of it that
gets regularly updated instead of generating it every time someone calls the `/leaderboard view` command.
```py
from discord.ext import tasks, commands
Expand Down Expand Up @@ -183,30 +183,30 @@ Now to explain what's going on:
First things first we create a cog and in its `__init__` function we start the `update_leaderboard` task and generate
the first instance of our leaderboard's embed.

After that, we define the `update_leaderboard` task using the `loop` decorator and we make it run every ten minutes by
After that, we define the `update_leaderboard` task using the `loop` decorator, and we make it run every ten minutes by
passing 10 to the `minutes` parameter.

Then that we define the `before_update_leaderboard` task using the `before_loop` decorator and we make it wait until the
Then that we define the `before_update_leaderboard` task using the `before_loop` decorator, and we make it wait until the
bot is ready before starting the task.

Next up we define the `after_update_leaderboard` task using the `after_loop` decorator and we make it clean up the
Next up we define the `after_update_leaderboard` task using the `after_loop` decorator, and we make it clean up the
leaderboard when the loop finally stops running.

Then we define the `update_leaderboard_error` task using the `error` decorator and we make it print any errors that may
Then we define the `update_leaderboard_error` task using the `error` decorator, and we make it print any errors that may
occur while we update our leaderboard to the console.

Then we get into the fun stuff, we create a slash command group using the `SlashCommandGroup` class and name it
`leaderboard`, we then create the `view` sub-command which sends the embed generated when the leaderboard is updated and
`update_info` which shows a lot of data about the task using some of the attributes and functions available to us.
`update_info` which shows a lot of data about the task using some attributes and functions available to us.

We also create a slash command group called `leaderboard_config` which is only available to the owner of the bot.

Then we create the `set_time_between_updates` sub-command which takes in the time in minutes and changes the time
between updates of the leaderboard using the `change_interval` method, the `stop` sub-command which stops the task using
the `stop` method and `restart` which restarts the task using the `restart` method.

Finally, we add the `LeaderboardCog` cog to the bot and we're done!
Finally, we add the `LeaderboardCog` cog to the bot, and we're done!

I'd highly recommend you check the tasks extension
[documentation](https://docs.pycord.dev/en/master/ext/tasks/index.html) for more info on how to use them and what other
[documentation](https://docs.pycord.dev/en/stable/ext/tasks/index.html) for more info on how to use them and what other
functions they have.
8 changes: 4 additions & 4 deletions docs/getting-started/creating-your-first-bot.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Next, we load the env file with `load_dotenv()`.
bot = discord.Bot()
```

In this line, we create a new instance of [`discord.Bot`](https://docs.pycord.dev/en/master/api.html#discord.Bot).
In this line, we create a new instance of [`discord.Bot`](https://docs.pycord.dev/en/stable/api.html#discord.Bot).
In this object, we can pass various parameters for configuration purposes, such as `owner_ids`
and [`intents`](https://docs.pycord.dev/en/stable/api.html?highlight=get_message#discord.Intents).

Expand All @@ -185,8 +185,8 @@ async def on_ready():
print(f"{bot.user} is ready and online!")
```

We use the [`event`](https://docs.pycord.dev/en/master/api.html#discord.Bot.event) decorator to override
the [`on_ready`](https://docs.pycord.dev/en/master/api.html#discord.on_ready) function to define an
We use the [`event`](https://docs.pycord.dev/en/stable/api.html#discord.Bot.event) decorator to override
the [`on_ready`](https://docs.pycord.dev/en/stable/api.html#discord.on_ready) function to define an
event that is automatically called when the bot is ready to use.

```py
Expand All @@ -195,7 +195,7 @@ async def say_hello(ctx):
await ctx.respond("Hey!")
```

Here, we use the [`slash_command`](https://docs.pycord.dev/en/master/api.html#discord.Bot.slash_command)
Here, we use the [`slash_command`](https://docs.pycord.dev/en/stable/api.html#discord.Bot.slash_command)
decorator to define a slash command. We specify the `name` and `description` arguments. If not
specified, the name of the slash command would be the function name and the command description would
be empty.
Expand Down
Loading