Ignoring exception in command __balance:
Traceback (most recent call last):
File "/home/runner/bot/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "main.py", line 47, in __balance
description = f"""Баланс пользователя **{ctx.author}** составляет **{cursor.execute(f"SELECT cash FROM users WHERE id = {member}").format(ctx.author.id).fetchone()[0]} :leaves:**"""
sqlite3.OperationalError: no such table: users
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/runner/bot/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/bot/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/runner/bot/venv/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: no such table: users
from webserver import keep_alive
import discord
from discord.ext import commands
import sqlite3
client = discord.Client()
import os
bot = commands.Bot(command_prefix="=")
connection = sqlite3.connect('server.db')
cursor = connection.cursor()
@bot.event
async def on_ready():
while True:
await bot.change_presence(status=discord.Status.online, activity=discord.Game("=command"))
print(f"{bot.user} is connected!")
cursor.execute("""CREATE TABLE IF NOT EXISTS users (
name TEXT,
id INT,
cash BIGINT,
rep Int,
lvl INT""")
for guild in bot.guilds:
for member in guild.members:
if cursor.execute(f"SELECT id FROM users WHERE id = {member.id}").fetchone() is None:
cursor.execute(f"INSERT INTO users VALUES ('{member}', {member.id}, 0, 0, 1)")
connection.commit()
else:
pass
connection.commit()
print('Bot connected')
@bot.event
async def on_member_join(member):
if cursor.execute(f"SELECT id FROM users WHERE id = {member.id}").fetchone() is None:
cursor.execute(f"INSERT INTO users VALUES ('{member}', {member.id}, 0, 0, 1)")
connection.commit()
else:
pass
@bot.command(aliases = ['balance', 'cash'])
async def __balance(ctx, member: discord.Member = None):
if member is None:
await ctx.send(embed = discord.Embed(
description = f"""Баланс пользователя **{ctx.author}** составляет **{cursor.execute(f"SELECT cash FROM users WHERE id = {member}").format(ctx.author.id).fetchone()[0]} :leaves:**"""
))
bot.run('секрет')
@bot.event
async def on_ready():
while True:
await bot.change_presence(status=discord.Status.online, activity=discord.Game("=command"))
print(f"{bot.user} is connected!")
cursor.execute("""CREATE TABLE IF NOT EXISTS users (
name TEXT,
id INT,
cash BIGINT,
rep Int,
lvl INT""")