update
This commit is contained in:
1 parent
947e0161a3
commit
b71e17086d
9 files changed
+553
-2
No files matched your search
@@ -0,0 +1,24 @@
|
||||
from typing import Optional
|
||||
|
||||
import discord
|
||||
from utils.base import BasicView
|
||||
|
||||
|
||||
class DeleteButton(BasicView):
|
||||
def __init__(self, timeout: Optional[float] = 60.0):
|
||||
super().__init__(timeout=timeout, clear=True)
|
||||
|
||||
async def interaction_check(self, i: discord.Interaction):
|
||||
if i.message.channel.permissions_for(i.user).manage_messages:
|
||||
return True
|
||||
return await super().interaction_check(i)
|
||||
|
||||
async def on_timeout(self):
|
||||
await super().on_timeout()
|
||||
|
||||
@discord.ui.button(
|
||||
emoji="<:trash:1066023933662466080>", style=discord.ButtonStyle.red
|
||||
)
|
||||
async def delete(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||
"""delete a message"""
|
||||
await interaction.message.delete()
|
||||
Reference in new issue
Block a user