Ask coding questions

← Back to all posts
Error when using command in Discord bot
Minionguyjpro (0)

I get an error when i try to use an command:

Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "main.py", line 31, in setup_suggestion_channel
    await mn.update_suggestion_channel(ctx.guild.id, channel.id)
  File "/home/runner/Minionguyjbot/sql_work.py", line 18, in update_suggestion_channel
    self.cursor.execute("INSERT INTO CHANNELS_SETUP (guildid,suggestion_chnl) VALUES (" + str(guildid) + ", " + str(channelid) + ") ON CONFLICT(guildid) DO UPDATE SET suggestion_chnl = " + str(channelid))
sqlite3.OperationalError: near "ON": syntax error

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

Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: near "ON": syntax error```
How to fix this?
Comments
hotnewtop
Saml2020 (66)

Did you make this bot? If so it seems like an error with sqlite.

Minionguyjpro (0)

Any other one made if for me, but i now host it myself