This commit is contained in:
insert 2024-08-09 17:48:13 -04:00
parent 89c28f0e2f
commit e0dd4fce18
Signed by: insert
GPG key ID: A70775C389ACF105

View file

@ -4,6 +4,7 @@ from nextcord import TextInputStyle
from random import randint
import aiosqlite as sqlite3
import aiohttp
import asyncio
from urllib.parse import urlparse
import os
@ -54,10 +55,6 @@ class ApplicationView(nextcord.ui.View):
class ApplicationModal(nextcord.ui.Modal):
def __init__(self,user,bot):
res = await bot.cur.execute("SELECT name FROM sqlite_master WHERE name='userinfo'")
if await res.fetchone() is None:
await bot.cur.execute("CREATE TABLE userinfo(serverid INTEGER, userid INTEGER, imagelink TEXT, chance INTEGER)")
await bot.db.commit()
self.victim = user
self.bot = bot
super().__init__(
@ -114,9 +111,16 @@ class ApplicationModal(nextcord.ui.Modal):
await interaction.send(f"<@{self.victim.id}> {interaction.user.name} proposes the following speech bubble for you:", embed=embed, view=ApplicationView(self.bot))
async def dbcheck(db,cur):
res = await bot.cur.execute("SELECT name FROM sqlite_master WHERE name='userinfo'")
if await res.fetchone() is None:
await cur.execute("CREATE TABLE userinfo(serverid INTEGER, userid INTEGER, imagelink TEXT, chance INTEGER)")
await db.commit()
class speechbubble(commands.Cog):
def __init__(self, bot: commands.Bot):
asyncio.run(dbcheck(bot.db,bot.cur))
self.bot = bot
bot.add_view(ApplicationView(bot))