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.ViewWithUserAndRoleCheck
for a view that implements basic checks.- Parameters:
style (
ButtonStyle
) – The style of the button, set toButtonStyle.secondary
if 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 the original invoker and moderators 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 (
Optional
[float
]) – Timeout in seconds from last interaction with the UI before no longer accepting input. IfNone
then there is no timeout.message (
Optional
[Message
]) – The message to remove the view from on timeout. This can also be set withview.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: