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 discord.ext import commands
|
||||||
from dislash import InteractionClient, Option, OptionType
|
from dislash import InteractionClient, Option, OptionType
|
||||||
from discord import app_commands
|
|
||||||
|
|
||||||
|
|
||||||
def insert_varible_into_table(name, userid, isbot, nick, guild):
|
def insert_varible_into_table(name, userid, isbot, nick, guild):
|
||||||
@@ -50,7 +49,8 @@ def _read_db(guildid, user):
|
|||||||
try:
|
try:
|
||||||
sql_con = sqlite3.connect("user.db")
|
sql_con = sqlite3.connect("user.db")
|
||||||
cursor = sql_con.cursor()
|
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)
|
cursor.execute(sql_read)
|
||||||
record = cursor.fetchone()
|
record = cursor.fetchone()
|
||||||
if record[4] is None:
|
if record[4] is None:
|
||||||
@@ -111,10 +111,8 @@ async def test(ctx, user):
|
|||||||
Option("user", "Specify any user", OptionType.USER),
|
Option("user", "Specify any user", OptionType.USER),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
async def hello(ctx, user, interaction: discord.Interaction):
|
async def hello(ctx, user):
|
||||||
await interaction.deferReply()
|
await ctx.send(_read_db(ctx.guild.id, user.id))
|
||||||
result = await _read_db(ctx.guild.id, user)
|
|
||||||
await ctx.send(result)
|
|
||||||
|
|
||||||
# await ctx.send(_read_db(ctx.guild.id, user))
|
# await ctx.send(_read_db(ctx.guild.id, user))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user