@@ -31,11 +31,11 @@ async def buttons(ctx: commands.Context):
3131 an_embed = discord .Embed (title = 'Here are some Button\' s' , description = 'Choose an option' , color = discord .Color .random ())
3232 msg = await ctx .send (embed = an_embed , components = components )
3333
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
3636
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
3939
4040 # This sends the Discord-API that the interaction has been received and is being "processed"
4141 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):
136136
137137
138138@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 ):
140140 await interaction .defer ()
141141 pointer : Pointer = get_pointer (interaction .guild )
142142 if not (message := interaction .message ):
143143 message : discord .Message = await interaction .channel .fetch_message (interaction .message_id )
144- if interaction . button .custom_id == "up" :
144+ if button .custom_id == "up" :
145145 pointer .set_y (1 )
146146 await message .edit (embed = discord .Embed (title = "Little Game" ,
147147 description = display (x = pointer .possition_x , y = pointer .possition_y )),
@@ -150,7 +150,7 @@ async def on_raw_interaction_create(interaction: discord.RawInteractionCreateEve
150150 arrow_button ().set_label ('↓' ).set_custom_id ('down' ),
151151 arrow_button ().set_label ('→' ).set_custom_id ('right' ).disable_if (pointer .possition_x >= 9 ))]
152152 )
153- elif interaction . button .custom_id == "down" :
153+ elif button .custom_id == "down" :
154154 pointer .set_y (- 1 )
155155 await message .edit (embed = discord .Embed (title = "Little Game" ,
156156 description = display (x = pointer .possition_x , y = pointer .possition_y )),
@@ -159,7 +159,7 @@ async def on_raw_interaction_create(interaction: discord.RawInteractionCreateEve
159159 arrow_button ().set_label ('↓' ).set_custom_id ('down' ).disable_if (pointer .possition_y <= 0 ),
160160 arrow_button ().set_label ('→' ).set_custom_id ('right' ).disable_if (pointer .possition_x >= 9 ))]
161161 )
162- elif interaction . button .custom_id == "right" :
162+ elif button .custom_id == "right" :
163163 pointer .set_x (1 )
164164 await message .edit (embed = discord .Embed (title = "Little Game" ,
165165 description = display (x = pointer .possition_x , y = pointer .possition_y )),
@@ -168,7 +168,7 @@ async def on_raw_interaction_create(interaction: discord.RawInteractionCreateEve
168168 arrow_button ().set_label ('↓' ).set_custom_id ('down' ),
169169 arrow_button ().set_label ('→' ).set_custom_id ('right' ).disable_if (pointer .possition_x >= 9 ))]
170170 )
171- elif interaction . button .custom_id == "left" :
171+ elif button .custom_id == "left" :
172172 pointer .set_x (- 1 )
173173 await message .edit (embed = discord .Embed (title = "Little Game" ,
174174 description = display (x = pointer .possition_x , y = pointer .possition_y )),
0 commit comments