ValueError: parameters of unsupported type | sqlite3
у меня есть команда /activate_referal_code, когда я ввожу такие параметры как цифры допустим: /activate_referal_code 173733 то выводит ошибку parameters of unsupported type. Я это перехвачиваю с помощью except. Перепробовал всё, выводил тип переменной (показывало int). Через .isdigit была ошибка.
Вот код:
#Where I wrote function print, this is debug mode.
#Function which query on type (SELECT)
def check_exists_ref_code(self, refcode):
with self.connection:
self.cursor.execute('SELECT ReferalCode FROM `Users` WHERE ReferalCode = ?', (int(refcode)))
print(typeof(refcode))
CheckReferalCode = self.cursor.fetchone()[0]
return CheckReferalCode
#Function command (activate_referal_code)
@bot.command(pass_context = True)
async def activate_referal_code(ctx, code = 1000000):
userid = ctx.author.id
if code >= 1000000:
await ctx.send(f'<@{userid}> Реферальный код не найден!')
return
elif code <= -1:
await ctx.send(f'<@{userid}> Реферальный код не найден!')
return
try:
# data = db.get_info(userid)
refcode = db.check_exists_ref_code(code)
if refcode is None:
await ctx.send(f'<@{userid}> Реферальный код не найден!')
else:
await ctx.send(f'<@{userid}> Реферальный код существует!')
except ValueError as e:
print(e)
await ctx.send(f'<@{userid}> Реферальный код должен состоять из целочисленного типа!')