You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/extensions/tasks/tasks.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ doing very useful stuff.
35
35
doing very useful stuff.
36
36
```
37
37
38
-
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):
38
+
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):
39
39
40
40
```py
41
41
from discord.ext import tasks, commands
@@ -64,13 +64,13 @@ As you'd expect this will increment a number and print it out every 5 seconds li
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!
72
72
73
-
### [Creating a task](https://docs.pycord.dev/en/master/ext/tasks/index.html#discord.ext.tasks.loop)
73
+
### [Creating a task](https://docs.pycord.dev/en/stable/ext/tasks/index.html#discord.ext.tasks.loop)
74
74
75
75
A look at `discord.ext.tasks.loop`'s definition in the documentation reveals that:
76
76
1. As you've seen before it expects the time between each execution, that however doesn't have to be in seconds as
@@ -83,7 +83,7 @@ to make it run forever which is also the default.
83
83
4. The loop function ***must*** be a coroutine.
84
84
85
85
These are all really useful, and they aren't the only parameters so if you want to know more about them check out the
Copy file name to clipboardExpand all lines: docs/getting-started/more-features.mdx
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ First, you need to ask Discord to send you events. This is done via "Intents". R
27
27
28
28
Once you understand what intents are, you can enable the events you need, or just use the default ones with `discord.Intents.all()`.
29
29
30
-
Now that that's done, let's add an event handler for when a user joins the server. We will use the [`on_member_join` event](https://docs.pycord.dev/en/master/api.html#discord.on_member_join). We will send a private message to the user welcoming them to the server.
30
+
Now that that's done, let's add an event handler for when a user joins the server. We will use the [`on_member_join` event](https://docs.pycord.dev/en/stable/api.html#discord.on_member_join). We will send a private message to the user welcoming them to the server.
We use the [`discord.Bot.event` decorator](https://docs.pycord.dev/en/master/api.html#discord.Bot.event) to add the event handler.
40
+
We use the [`discord.Bot.event` decorator](https://docs.pycord.dev/en/stable/api.html#discord.Bot.event) to add the event handler.
41
41
42
-
The `on_member_join` event is called when a user joins the server. The `member` parameter is the user that joined. Different events have different names and parameters. You can find all of them [here](https://docs.pycord.dev/en/master/api.html#discord.Intents).
42
+
The `on_member_join` event is called when a user joins the server. The `member` parameter is the user that joined. Different events have different names and parameters. You can find all of them [here](https://docs.pycord.dev/en/stable/api.html#discord.Intents).
43
43
44
44
So, that's how you add event handlers!
45
45
46
46
### Waiting for User Response
47
47
48
-
Let's say you want to create a Guess-the-Number game (where the user has to guess a number between 1-10). You need to send a message to a user and wait for them to respond. You can do this with the [`wait_for`](https://docs.pycord.dev/en/master/api.html#discord.Bot.wait_for) method.
48
+
Let's say you want to create a Guess-the-Number game (where the user has to guess a number between 1-10). You need to send a message to a user and wait for them to respond. You can do this with the [`wait_for`](https://docs.pycord.dev/en/stable/api.html#discord.Bot.wait_for) method.
49
49
50
50
```python
51
51
@bot.command()
@@ -114,7 +114,7 @@ enabling your bot to lay out messages with a lot of text into neat fields.
114
114
115
115
<br/>
116
116
117
-
Creating embeds is simple! Just create an instance of [`discord.Embed`](https://docs.pycord.dev/en/master/api.html#discord.Embed) and edit it to your liking. Once you're done, send it!
117
+
Creating embeds is simple! Just create an instance of [`discord.Embed`](https://docs.pycord.dev/en/stable/api.html#discord.Embed) and edit it to your liking. Once you're done, send it!
118
118
119
119
```python
120
120
import discord
@@ -187,10 +187,10 @@ embed = discord.Embed(
187
187
)
188
188
```
189
189
190
-
This command creates an embed. We use the [`Embed`](https://docs.pycord.dev/en/master/api.html#discord.Embed)
190
+
This command creates an embed. We use the [`Embed`](https://docs.pycord.dev/en/stable/api.html#discord.Embed)
191
191
class to create an embed object with the title "My Amazing Embed", the description "Embeds are super easy, barely an inconvenience.", and the color `blurple`, Discord's main theme color.
192
192
193
-
[discord.Colour](https://docs.pycord.dev/en/master/api.html#colour) is a class full of [classmethods](https://docs.python.org/3/library/functions.html#classmethod)
193
+
[discord.Colour](https://docs.pycord.dev/en/stable/api.html#colour) is a class full of [classmethods](https://docs.python.org/3/library/functions.html#classmethod)
194
194
that return color values. While the official, documented name of this is `discord.Colour`, `discord.Color`
195
195
works as well.
196
196
@@ -201,8 +201,8 @@ embed.add_field(title="Inline Field 2", value="Inline Field 2", inline=True)
201
201
embed.add_field(title="Inline Field 3", value="Inline Field 3", inline=True)
202
202
```
203
203
204
-
This small section shows off embed fields. You can add fields to embeds with the [`add_field` method](https://docs.pycord.dev/en/master/api.html#discord.Embed.add_field)
205
-
of the [`discord.Embed`](https://docs.pycord.dev/en/master/api.html#embed) class. These consist of three
204
+
This small section shows off embed fields. You can add fields to embeds with the [`add_field` method](https://docs.pycord.dev/en/stable/api.html#discord.Embed.add_field)
205
+
of the [`discord.Embed`](https://docs.pycord.dev/en/stable/api.html#embed) class. These consist of three
206
206
keyword arguments: `title`, `value`, and `inline`. `title` and `value` are both required arguments, which inline defaults to `False` if it's not defined. The `inline` argument specifies whether space will be divided among the inline fields. There could be a mix of fields where inline has different values too.
In this section, we're adding unique items to the embed. These items are:
216
-
- Footer - With the [`set_footer()`](https://docs.pycord.dev/en/master/api.html#discord.Embed.set_footer)
216
+
- Footer - With the [`set_footer()`](https://docs.pycord.dev/en/stable/api.html#discord.Embed.set_footer)
217
217
method, you can set a small footer that holds a message. This has `text` and `icon_url` kwargs.
218
-
- Author - With the [`set_author`](https://docs.pycord.dev/en/master/api.html#discord.Embed.set_author)
218
+
- Author - With the [`set_author`](https://docs.pycord.dev/en/stable/api.html#discord.Embed.set_author)
219
219
method, you can set an author for the embed. This is a small text field at the top of the embed. This
220
220
includes `name`, `url` and `icon_url` kwargs.
221
-
- Thumbnail - With the [`set_thumbnail`](https://docs.pycord.dev/en/master/api.html#discord.Embed.set_thumbnail)
221
+
- Thumbnail - With the [`set_thumbnail`](https://docs.pycord.dev/en/stable/api.html#discord.Embed.set_thumbnail)
222
222
method, you can set a small image to reside at the top-right of the embed. This has a single `url` kwarg.
223
-
- Image - With the [`set_image`](https://docs.pycord.dev/en/master/api.html#discord.Embed.set_image)
223
+
- Image - With the [`set_image`](https://docs.pycord.dev/en/stable/api.html#discord.Embed.set_image)
224
224
method, you can set an image to sit at the bottom of an embed. This has a single `url` kwarg.
225
225
226
226
There are a lot more methods and attributes you can use to configure embeds. Here, we just covered the basics. Also, remember that all of these values are not necessary in an embed. An embed may only contain a few of these. For example, only a description, a title and a description, and so on.
Copy file name to clipboardExpand all lines: docs/interactions/application-commands/slash-commands.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,11 +62,11 @@ Let's go through the code.
62
62
63
63
First, we import Pycord's `discord` package.
64
64
65
-
Next, we create a [`discord.Bot`](https://docs.pycord.dev/en/master/api.html#discord.Bot) object and assign it to a variable `bot`.
65
+
Next, we create a [`discord.Bot`](https://docs.pycord.dev/en/stable/api.html#discord.Bot) object and assign it to a variable `bot`.
66
66
67
-
We then go ahead and use the [`@bot.command`](https://docs.pycord.dev/en/master/api.html#discord.Bot.command) decorator, which registers a new Slash Command. We pass a `description` parameter to give a description to the Slash Command. We can also pass a `name` parameter to change the Slash Command's name. By default, the name of the Slash Command will be the name of the function, in this case, `/ping`.
67
+
We then go ahead and use the [`@bot.command`](https://docs.pycord.dev/en/stable/api.html#discord.Bot.command) decorator, which registers a new Slash Command. We pass a `description` parameter to give a description to the Slash Command. We can also pass a `name` parameter to change the Slash Command's name. By default, the name of the Slash Command will be the name of the function, in this case, `/ping`.
68
68
69
-
We create an async function called `ping` with parameters `ctx`, which, when called, sends the bot's ping/latency using [`ctx.respond`](https://docs.pycord.dev/en/master/api.html#discord.ApplicationContext.respond).
69
+
We create an async function called `ping` with parameters `ctx`, which, when called, sends the bot's ping/latency using [`ctx.respond`](https://docs.pycord.dev/en/stable/api.html#discord.ApplicationContext.respond).
70
70
71
71
## Subcommand Groups
72
72
@@ -179,7 +179,7 @@ bot.run("TOKEN")
179
179
</TabItem>
180
180
<TabItemvalue="1"label="Using the SlashCommandOptionType enum">
181
181
182
-
You could also explicitly declare the type using the [`SlashCommandOptionType`](https://docs.pycord.dev/en/master/api.html#discord.SlashCommandOptionType) enum.
182
+
You could also explicitly declare the type using the [`SlashCommandOptionType`](https://docs.pycord.dev/en/stable/api.html#discord.SlashCommandOptionType) enum.
0 commit comments