feat: add multiple discord bot cogs
Adds new cogs including DataManager, Hiring, KofiShop, Logging, ModMail, MORS, ServiceReview, StaffMsg, and Translator to enhance bot functionality for data management, hiring processes, logging events, and more.
This commit is contained in:
28
translator/views.py
Normal file
28
translator/views.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import discord
|
||||
|
||||
class DismissView(discord.ui.View):
|
||||
def __init__(self, author: discord.Member):
|
||||
super().__init__(timeout=1800) # 30 minute timeout
|
||||
self.author = author
|
||||
self.message: discord.Message = None
|
||||
|
||||
async def interaction_check(self, interaction: discord.Interaction) -> bool:
|
||||
if interaction.user.id != self.author.id:
|
||||
await interaction.response.send_message("You are not authorized to dismiss this message.", ephemeral=True)
|
||||
return False
|
||||
return True
|
||||
|
||||
@discord.ui.button(label="Dismiss", style=discord.ButtonStyle.grey, emoji="??")
|
||||
async def dismiss_button(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||
await self.message.delete()
|
||||
self.stop()
|
||||
|
||||
async def on_timeout(self):
|
||||
if self.message:
|
||||
try:
|
||||
await self.message.delete()
|
||||
except (discord.NotFound, discord.Forbidden):
|
||||
pass # Message was already deleted or permissions are missing
|
||||
self.stop()
|
||||
|
||||
Reference in New Issue
Block a user