up db test

This commit is contained in:
2022-06-18 11:18:02 +03:00
parent 21fa290bf8
commit 8563b50aa3
2 changed files with 4 additions and 6 deletions

10
test.py
View File

@@ -6,7 +6,6 @@ import sqlite3
from discord.ext import commands
from dislash import InteractionClient, Option, OptionType
from discord import app_commands
def insert_varible_into_table(name, userid, isbot, nick, guild):
@@ -50,7 +49,8 @@ def _read_db(guildid, user):
try:
sql_con = sqlite3.connect("user.db")
cursor = sql_con.cursor()
sql_read = f"""SELECT * FROM "{guildid}" where userid = {user.removesuffix('>').removeprefix('<@')}"""
print(user)
sql_read = f"""SELECT * FROM "{guildid}" where userid = {user}"""
cursor.execute(sql_read)
record = cursor.fetchone()
if record[4] is None:
@@ -111,10 +111,8 @@ async def test(ctx, user):
Option("user", "Specify any user", OptionType.USER),
]
)
async def hello(ctx, user, interaction: discord.Interaction):
await interaction.deferReply()
result = await _read_db(ctx.guild.id, user)
await ctx.send(result)
async def hello(ctx, user):
await ctx.send(_read_db(ctx.guild.id, user.id))
# await ctx.send(_read_db(ctx.guild.id, user))