Update
This commit is contained in:
parent
89c28f0e2f
commit
e0dd4fce18
1 changed files with 8 additions and 4 deletions
|
@ -4,6 +4,7 @@ from nextcord import TextInputStyle
|
||||||
from random import randint
|
from random import randint
|
||||||
import aiosqlite as sqlite3
|
import aiosqlite as sqlite3
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
import asyncio
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -54,10 +55,6 @@ class ApplicationView(nextcord.ui.View):
|
||||||
|
|
||||||
class ApplicationModal(nextcord.ui.Modal):
|
class ApplicationModal(nextcord.ui.Modal):
|
||||||
def __init__(self,user,bot):
|
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.victim = user
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
super().__init__(
|
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))
|
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):
|
class speechbubble(commands.Cog):
|
||||||
|
|
||||||
def __init__(self, bot: commands.Bot):
|
def __init__(self, bot: commands.Bot):
|
||||||
|
asyncio.run(dbcheck(bot.db,bot.cur))
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
bot.add_view(ApplicationView(bot))
|
bot.add_view(ApplicationView(bot))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue