Друг писал код , пол года назад , и забросил его , решил кое что изменить , и тут получаю ошибку
---------------
Ignoring exception in on_ready
Traceback (most recent call last):
File "C:\Users\TANDER\AppData\Roaming\Python\Python39\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\TANDER\Desktop\3\ShiroBot.py", line 56, in on_ready
cursor.execute(f"INSERT INTO users VALUES ('{member}', {member.id}, 52, 0, 0, 0, 0, {member.guild.id})")
sqlite3.OperationalError: near "m": syntax error
---------------
Бот при этом функционирует , и база работает , но на некоторых людей бот не реагирует
Вот кусочек кода:
import discord
from discord import Member
from discord.ext import commands
from discord.ext.commands import has_permissions, MissingPermissions
from discord.utils import get
import youtube_dl
import os
import random
import time
import json
import requests
import asyncio
import sqlite3
import config
from Cybernator import Paginator as pag
import psutil as ps
intents = discord.Intents.default()
intents.members = True
# Настройка бота
client = commands.Bot(command_prefix='ae', intents=intents)
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,
xp INT,
lvl INT,
warns BIGINT,
server_id INT
)""")
cursor.execute("""CREATE TABLE IF NOT EXISTS shop (
role_id INT,
id INT,
cost BIGINT,
des TEXT
)""")
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}, 52, 0, 0, 0, 0, {member.guild.id})")
else:
pass
connection.commit()
print("Бот в сети!")
while True:
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="Вас"))
#await client.change_presence(status=discord.Status.idle, activity=discord.Game('.help'))
#await bot.change_presence(activity=discord.Streaming(name="My Stream", url=my_twitch_url))
# Роль за вход и БД
@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}, 52, 0, 0, 0, 0, {member.guild.id})")
connection.commit()
else:
pass
channel = client.get_channel(452906561841397760) # ID канала
role = discord.utils.get(member.guild.roles, name="test") # ID роли
await member.add_roles(role)
emb = discord.Embed(description=f'Рад приветствовать тебя, {member.mention}! Добро пожаловать на наш сервер!', color=0x39d0d6)
emb.set_image(url='https://images-ext-1.discordapp.net/external/v-cVlr4w5UZw_Ux2c-Mg0QJ_IsvFXZMMxF6vrLWEN90/%3Fwidth%3D1440%26height%3D300/https/media.discordapp.net/attachments/787641066891378688/807032183364911135/momlvl.jpg?width=1433&height=299')
emb.set_footer(text='{}'.format(member.joined_at.strftime('%d.%m.%Y')), icon_url=member.avatar_url)
await channel.send(embed=emb)