Skip to content

Commit

Permalink
reword and reduce comments
Browse files Browse the repository at this point in the history
reword comments in timeout example
remove duplicate comments from second button callback.
  • Loading branch information
dlchamp committed Aug 27, 2023
1 parent f7c17bf commit d0bc2a3
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions guide/docs/interactions/buttons.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -150,31 +150,24 @@ class TimeoutButtonView(disnake.ui.View):

await inter.response.send_message("Contact us at https://discord.gg/disnake!")

# Update the View by disabling the buttons, then editing the original message
# the View was attached to, not the response message sent above.
# You could also do this as part of the interaction.response by using
# `inter.response.edit_message` which would handle the required response
# and editing of the original message.
# Update the View by disabling all buttons, then editing the original message
# containing this View, not the response message sent above.
# Note: This can also be done with `inter.response.edit_message()` instead
# if you did not wish to send a separate response.
self.disable_children()
await inter.message.edit(view=self)
# We still want to explicitly stop the View after a user has interacted
# to ensure it's no longer usable.

# Now, we explicitly stop the View which prevents it from listening for more interactions.
self.stop()

@disnake.ui.button(label="No", style=disnake.ButtonStyle.danger)
async def no(self, button: disnake.ui.Button, inter: disnake.MessageInteraction):

await inter.response.send_message("Got it. Signing off!")

# Update the View by disabling the buttons, then editing the original message
# the View was attached to, not the response message sent above.
# You could also do this as part of the interaction.response by using
# `inter.response.edit_message` which would handle the required response
# and editing of the original message.
self.disable_children()
await inter.message.edit(view=self)
# We still want to explicitly stop the View after a user has interacted
# to ensure it's no longer usable.

self.stop()


Expand Down

0 comments on commit d0bc2a3

Please sign in to comment.