feat(bot): Everything.

This commit is contained in:
Nyeki.py
2024-10-16 13:21:04 -03:00
parent 3059ec8446
commit 5011ab5f90
34 changed files with 3444 additions and 39 deletions
+47
View File
@@ -0,0 +1,47 @@
import discord
from payphone import bot
from payphone.db import models
from payphone.cogs.mods import modals
class BanNotificationView(discord.ui.View):
"""View sent with the ban notification embed.
This view contains a button that sends a modal to appeal the ban.
"""
def __init__(self, bot: bot.Payphone, ban: models.Ban) -> None:
"""Initializes the view.
Args:
bot (bot.Payphone): The bot.
ban (models.Ban): The ban to appeal.
"""
super().__init__()
self.bot = bot
if ban.status != models.BanStatus.VALID:
self.disable_all_items()
self.children[0].label = "Appealed"
self.add_item(
discord.ui.Button(
label=f"Status: {ban.status.name.replace("_", " ").lower().title()}",
disabled=True,
)
)
@discord.ui.button(
label="Appeal Ban",
custom_id="ban-notification:appeal-ban",
style=discord.ButtonStyle.blurple,
)
async def callback(
self, _button: discord.ui.Button, interaction: discord.Interaction
) -> None:
"""Sends the ban appeal modal."""
await interaction.response.send_modal(modals.BanNotificationModal(self.bot))