When trying to make a change prefix command when I get this error when trying to change the current prefix:
sqlite3.OperationalError: no such column: e
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:UsersachutAppDataRoamingPythonPython39site-packagesdiscordextcommandsot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "C:UsersachutAppDataRoamingPythonPython39site-packagesdiscordextcommandscore.py", line 859, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:UsersachutAppDataRoamingPythonPython39site-packagesdiscordextcommandscore.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: no such column: e
The code for the command is this:
@client.command()
@commands.has_permissions(manage_guild=True)
async def change_prefix(ctx, newprefix: str):
if len(newprefix) > 5:
await ctx.send("The server prefix cannot be less than 5 characters in length!")
else:
cursor.execute(f"UPDATE guilds SET prefix = {newprefix} WHERE serverid = {ctx.guild.id}")
connection.commit()
await ctx.send(embed = discord.Embed(title = f"Prefix Changed to `{newprefix}`",description = f"The bot's server prefix was just changed to `{newprefix}`!", colour=0x04ff00))
Sorry if this could be an easy fix but I'm really bad at sqlite3. Thanks!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…