import discord import aiosqlite import asyncio from discord.ext import commands from discord.commands import SlashCommandGroup from utils.config import * from datetime import datetime file_banner = discord.File("img/Banner.png", filename="Banner.png") file_logo = discord.File("img/FalconSystem.png", filename="Logo.png") file_imageline = discord.File("img/Imagelinie.png", filename="Line.png") class TicketApplySetup(commands.Cog): def __init__(self, bot: discord.Bot): self.bot = bot @commands.Cog.listener() async def on_ready(self): async with aiosqlite.connect("data/apply.db") as db: await db.execute( """ CREATE TABLE IF NOT EXISTS apply ( guild_id INTEGER PRIMARY KEY, requirements_channel INTEGER, apply_channel INTEGER, apply_select_name TEXT, apply_select_emoji TEXT, apply_role INTEGER, apply_log_channel INTEGER ) """ ) await db.commit() setupapply = SlashCommandGroup( name="setup", description="Setup the Application System for your server!", ) @setupapply.command( name="apply", description="Setup the Application System for your server!", ) @commands.has_permissions(administrator=True) async def setup_apply(self, ctx, member): em = discord.Embed(color=MainColor) em.set_image(url="attachment://Banner.png") em0 = discord.Embed( title="Select Menu Name", description="What would you like the name of the select menu to be?", color=MainColor, timestamp=datetime.now() ) em0.set_footer(text=ctx.guild.name, icon_url="attachment://Logo.png") em0.set_image(url="attachment://Line.png") await ctx.respond(embeds=[em, em0], files=[file_banner, file_logo, file_imageline]) def check(m): return m.author == ctx.author try: name = await self.bot.wait_for("message", check=check, timeout=10) select_name = name.content async with aiosqlite.connect("data/apply.db") as db: await db.execute( """ INSERT INTO apply (guild_id, apply_select_name) VALUES (?, ?) """, (ctx.guild.id, select_name) ) await db.commit() except: em1 = discord.Embed(color=MainColor) em1.set_image(url="attachment://Banner.png") em2 = discord.Embed( title="Select Menu Name", description="Please enter the name of the select menu!", color=MainColor, timestamp=datetime.now() ) em2.set_footer(text=ctx.guild.name, icon_url="attachment://Logo.png") em2.set_image(url="attachment://Line.png") await ctx.send(embeds=[em1, em2], files=[file_banner, file_logo, file_imageline]) return def setup(bot: discord.Bot): bot.add_cog(TicketApplySetup(bot))