@@ -31,11 +31,11 @@ async def buttons(ctx: commands.Context):
31
31
an_embed = discord .Embed (title = 'Here are some Button\' s' , description = 'Choose an option' , color = discord .Color .random ())
32
32
msg = await ctx .send (embed = an_embed , components = components )
33
33
34
- def _check (i : discord .RawInteractionCreateEvent ):
35
- return i .message == msg and i .member == ctx .author
34
+ def _check (i : discord .Interaction , b : discord . ButtonClick ):
35
+ return i .message == msg and i .author ctx .author
36
36
37
- interaction : discord . RawInteractionCreateEvent = await client .wait_for ('interaction_create ' , check = _check )
38
- button_id = interaction . button .custom_id
37
+ interaction , button = await client .wait_for ('button_click ' , check = _check )
38
+ button_id = button .custom_id
39
39
40
40
# This sends the Discord-API that the interaction has been received and is being "processed"
41
41
await interaction .defer () # if this is not used and you also do not edit the message within 3 seconds as described below, Discord will indicate that the interaction has failed.
@@ -136,12 +136,12 @@ async def start_game(ctx: commands.Context):
136
136
137
137
138
138
@client .event
139
- async def on_raw_interaction_create (interaction : discord .RawInteractionCreateEvent ):
139
+ async def on_raw_button_click (interaction : discord .Interaction , button : discord . ButtonClick ):
140
140
await interaction .defer ()
141
141
pointer : Pointer = get_pointer (interaction .guild )
142
142
if not (message := interaction .message ):
143
143
message : discord .Message = await interaction .channel .fetch_message (interaction .message_id )
144
- if interaction . button .custom_id == "up" :
144
+ if button .custom_id == "up" :
145
145
pointer .set_y (1 )
146
146
await message .edit (embed = discord .Embed (title = "Little Game" ,
147
147
description = display (x = pointer .possition_x , y = pointer .possition_y )),
@@ -150,7 +150,7 @@ async def on_raw_interaction_create(interaction: discord.RawInteractionCreateEve
150
150
arrow_button ().set_label ('↓' ).set_custom_id ('down' ),
151
151
arrow_button ().set_label ('→' ).set_custom_id ('right' ).disable_if (pointer .possition_x >= 9 ))]
152
152
)
153
- elif interaction . button .custom_id == "down" :
153
+ elif button .custom_id == "down" :
154
154
pointer .set_y (- 1 )
155
155
await message .edit (embed = discord .Embed (title = "Little Game" ,
156
156
description = display (x = pointer .possition_x , y = pointer .possition_y )),
@@ -159,7 +159,7 @@ async def on_raw_interaction_create(interaction: discord.RawInteractionCreateEve
159
159
arrow_button ().set_label ('↓' ).set_custom_id ('down' ).disable_if (pointer .possition_y <= 0 ),
160
160
arrow_button ().set_label ('→' ).set_custom_id ('right' ).disable_if (pointer .possition_x >= 9 ))]
161
161
)
162
- elif interaction . button .custom_id == "right" :
162
+ elif button .custom_id == "right" :
163
163
pointer .set_x (1 )
164
164
await message .edit (embed = discord .Embed (title = "Little Game" ,
165
165
description = display (x = pointer .possition_x , y = pointer .possition_y )),
@@ -168,7 +168,7 @@ async def on_raw_interaction_create(interaction: discord.RawInteractionCreateEve
168
168
arrow_button ().set_label ('↓' ).set_custom_id ('down' ),
169
169
arrow_button ().set_label ('→' ).set_custom_id ('right' ).disable_if (pointer .possition_x >= 9 ))]
170
170
)
171
- elif interaction . button .custom_id == "left" :
171
+ elif button .custom_id == "left" :
172
172
pointer .set_x (- 1 )
173
173
await message .edit (embed = discord .Embed (title = "Little Game" ,
174
174
description = display (x = pointer .possition_x , y = pointer .possition_y )),
0 commit comments