Бот должен добавлять эмодзив БД, по команде но выдает ошибку.
import discord
from discord.ext import commands
import sqlite3
from config import settings
import random
client = commands.Bot(command_prefix = settings['PREFIX'], intents = discord.Intents.all())
client.remove_command('help')
connection = sqlite3.connect('server.db')
cursor = connection.cursor()
@client.event
async def on_ready():
cursor.execute("""CREATE TABLE IF NOT EXISTS emo (
emoji TEXT,
id INT
)""")
connection.commit()
print("Bot started.")
await client.change_presence(status = discord.Status.dnd)
@client.command(aliases = ['addemoji'])
@commands.has_permissions(administrator = True)
async def __addshopа(ctx, emoji: str = None):
if emoji is None:
await ctx.send("Укажите эмодзи какой хотите добавить.")
else:
cursor.execute("INSERT INTO emo VALUES ({})".format(emoji))
connection.commit()
await ctx.reply(embed = discord.Embed(
description = f'Эмодзи успешно добавлен.'
))
Ошибка:
Bot started.
Ignoring exception in command __addshopа:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\User\Desktop\GTAMine\gtamine.py", line 280, in __addshopа
cursor.execute("INSERT INTO emo VALUES ({})".format(emoji))
sqlite3.OperationalError: no such column:
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\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: no such column: