interactions¶
- class DeleteMessageButton(*, style=('secondary', 2), label='Delete', **kwargs)[source]¶
- Bases: - Button- A button that can be added to a view to delete the message containing the view on click. - This button itself carries out no interaction checks, these should be done by the parent view. - See - pydis_core.utils.interactions.ViewWithUserAndRoleCheckfor a view that implements basic checks.- Parameters:
- style ( - ButtonStyle) – The style of the button, set to- ButtonStyle.secondaryif not specified.
- label ( - str) – The label of the button, set to “Delete” if not specified.
 
 
- class ViewWithUserAndRoleCheck(*, allowed_users, allowed_roles, timeout=180.0, message=None)[source]¶
- Bases: - View- A view that allows only allows the specified users, or users with the specified roles, to interact with it. - Parameters:
- allowed_users ( - Sequence[- int]) – A sequence of user’s ids who are allowed to interact with the view.
- allowed_roles ( - Sequence[- int]) – A sequence of role ids that are allowed to interact with the view.
- timeout ( - float|- None) – Timeout in seconds from last interaction with the UI before no longer accepting input. If- Nonethen there is no timeout.
- message ( - Message|- None) – The message to remove the view from on timeout. This can also be set with- view.message = await ctx.send( ... )`, or similar, after the view is instantiated.
 
 - async interaction_check(interaction)[source]¶
- Ensure the user clicking the button is the view invoker, or a moderator. - Parameters:
- interaction ( - Interaction) – The interaction that occurred.
- Return type: