сделал экономического бота
выходит ошибка discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'NoneType' object is not subscriptable
код
import sqlite3
import discord #модуль discord api
from discord.ext import commands #необходимый класс для обработки команд
import random
from tabulate import tabulate #удобный модуль
client = commands.Bot( command_prefix = '.')
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 users(
name TEXT,
id INT,
cash BIGINT,
rep INT,
lvl INT
)""")
for guild in client.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, 1)")
else:
pass
connection.commit()
@client.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
@client.command(pass_prefix = True)
async def cash (ctx,member: discord.Embed = None):
if member is None:
author = ctx.message.author
await ctx.send(embed = discord.Embed(description = f"""Баданс **{author}** состовляет **{cursor.execute("SELECT cash FROM users WHERE id = {}".format(author.id)).fetchone()[0]}**"""))
else:
await ctx.send(embed = discord.Embed(description = f"""Баданс **{member}** состовляет **{cursor.execute("SELECT cash FROM users WHERE id = {}".format(member.id)).fetchone()[0]}**"""))