up db test
This commit is contained in:
10
test.py
10
test.py
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user