tickets-bot/commands/panel.py
Neil Revin 00d90dea36
feat: initial
Signed-off-by: ItsNeil17 <neil@willofsteel.me>
2025-11-29 20:44:22 +05:30

42 lines
1.5 KiB
Python

import discord
from discord.ext import commands
from discord import app_commands
from database import set_config
class PanelView(discord.ui.View):
def __init__(self):
super().__init__(timeout=None)
@discord.ui.button(label="Create Ticket", style=discord.ButtonStyle.green, custom_id="create_ticket", emoji="🎫")
async def create_ticket(self, interaction: discord.Interaction, button: discord.ui.Button):
from ticket_handler import handle_ticket_create
await handle_ticket_create(interaction)
class PanelCommands(commands.Cog):
def __init__(self, bot):
self.bot = bot
bot.add_view(PanelView())
@app_commands.command(name="panel", description="Send the ticket creation panel")
@app_commands.default_permissions(administrator=True)
async def panel(self, interaction: discord.Interaction):
embed = discord.Embed(
title="🎫 Support Tickets",
description="Click the button below to create a support ticket.\nOur team will assist you shortly.",
color=discord.Color.blue()
)
embed.set_footer(text="Ticket System")
view = PanelView()
msg = await interaction.channel.send(embed=embed, view=view)
await set_config(
interaction.guild_id,
panel_channel_id=interaction.channel_id,
panel_message_id=msg.id
)
await interaction.response.send_message("✅ Panel sent!", ephemeral=True)
async def setup(bot):
await bot.add_cog(PanelCommands(bot))