Skip to content

Commit b791dd2

Browse files
committed
docs: context -> ctx
1 parent 2094542 commit b791dd2

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

docs/src/Guides/05 Components.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ These have the downside that, for example, they won't work anymore after restart
136136

137137
Otherwise, you are looking for a persistent callback. For that, you want to define `custom_id` in your component creation.
138138

139-
When responding to a component you need to satisfy discord either by responding to the context with `ctx.send()` or by editing the component with `ctx.edit_origin()`. You get access to the context with `component.context`.
139+
When responding to a component you need to satisfy discord either by responding to the context with `ctx.send()` or by editing the component with `ctx.edit_origin()`. You get access to the context with `component.ctx`.
140140

141141
=== ":one: `bot.wait_for_component()`"
142142
As with discord.py, this supports checks and timeouts.
@@ -154,7 +154,7 @@ When responding to a component you need to satisfy discord either by responding
154154

155155
# define the check
156156
def check(component: Button) -> bool:
157-
return component.context.author.startswith("a")
157+
return component.ctx.author.startswith("a")
158158

159159
try:
160160
# you need to pass the component you want to listen for here
@@ -168,7 +168,7 @@ When responding to a component you need to satisfy discord either by responding
168168
await message.edit(components=components)
169169

170170
else:
171-
await used_component.context.send("Your name starts with 'a'")
171+
await used_component.ctx.send("Your name starts with 'a'")
172172
```
173173

174174
You can also use this to check for a normal message instead of a component interaction.
@@ -191,7 +191,7 @@ When responding to a component you need to satisfy discord either by responding
191191

192192
@listen()
193193
async def on_component(event: Component):
194-
ctx = event.context
194+
ctx = event.ctx
195195

196196
match ctx.custom_id:
197197
case "my_button_id":

docs/src/Guides/20 Extensions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Below is an example of a bot, one with extensions, one without.
5656

5757
@listen()
5858
async def on_component(event: Component):
59-
ctx = event.context
59+
ctx = event.ctx
6060
await ctx.edit_origin("test")
6161

6262

@@ -130,7 +130,7 @@ Below is an example of a bot, one with extensions, one without.
130130

131131
@listen()
132132
async def on_component(event: Component):
133-
ctx = event.context
133+
ctx = event.ctx
134134
await ctx.edit_origin("test")
135135

136136

docs/src/Guides/90 Example.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async def on_message_create(event):
3737

3838
@listen()
3939
async def on_component(event: Component):
40-
ctx = event.context
40+
ctx = event.ctx
4141
await ctx.edit_origin("test")
4242

4343

0 commit comments

Comments
 (0)