@megorka

Регистрация discord.py?

@client.command()
async def reg(ctx, name, *, steamid):
    print(ctx.author.id)
    print(name)
    print(steamid)
    add_players = ("INSERT INTO players "
                   "(id, name, steamid) "
                   "VALUES (%s, %s, %s)")
    data_players = (ctx.author.id, name, steamid)
    db.query(add_players, data_players)
    await ctx.send("Вы зарегистрировались")

И выдает ошибку
2022-12-01 09:24:38 ERROR    discord.ext.commands.bot Ignoring exception in command reg
Traceback (most recent call last):
  File "G:\myaddon\venv\lib\site-packages\discord\ext\commands\core.py", line 229, in wrapped
    ret = await coro(*args, **kwargs)
  File "G:\myaddon\bot.py", line 41, in reg
    db.query(add_employee, data_employee)
TypeError: Connection.query() takes 2 positional arguments but 3 were given

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "G:\myaddon\venv\lib\site-packages\discord\ext\commands\bot.py", line 1349, in invoke
    await ctx.command.invoke(ctx)
  File "G:\myaddon\venv\lib\site-packages\discord\ext\commands\core.py", line 1023, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "G:\myaddon\venv\lib\site-packages\discord\ext\commands\core.py", line 238, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Connection.query() takes 2 positional arguments but 3 were given
  • Вопрос задан
  • 45 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы