@bot.command()
async def status(ctx):
base.execute("CREATE TABLE IF NOT EXISTS {}(userid INT, count INT)".format(ctx.message.guild.name))
base.combit()
waring = cur.execute('SELECT * FROM {} WHERE userid == ?'.format(ctx.message.guild.name)\
,(ctx.message.author.id,)).fetchone()
if waring == None:
await ctx.send(f'{ctx.message.author.mention}, у Вас нет предупреждений!')
else:
await ctx.send(f'{ctx.message.author.mention}, у Вас {waring[1]} предупреждений!')
#==============================================================================================
@bot.event
async def on_message(message):
if {i.lower().translate(str.maketrans('','', string.punctuation)) for i in message.content.split(' ')}.\
intersection(set(json.load(open('cens.json')))) != set():
await message.channel.send(f'{message.author.mention}, тебе по губам надовать?')
await message.delete()
name = message.guild.name
base.execute('CREATE TABLE IF NOT EXISTS {}(userid INT, count INT)'.format(name))
base.combit()
waring = cur.execute('SELECT * FROM {} WHERE userid == ?'.format(name),(message.author.id,)).fetchone()
if waring == NONE:
cur.execute('INSERT INTO {} VALUES(?, ?)'.format(name),(message.author.id,1))
base.combit()
await message.channel.send(f'{message.author.mention}, это первое предупреждение, за 3 - мут на 3 часа!')
elif waring[1] == 1:
cur.execute('UPDATE {} SET count == ? WHERE userid == ?'.format(name),(2,message.author.id))
base.combit()
await message.channel.send(f'{message.author.mention}, это второе предупреждение, за 3 - мут на 3 часа!')
elif waring[2] == 2:
cur.execute('UPDATE {} SET count == ? WHERE userid == ?'.format(name),(3,message.author.id))
base.combit()
await message.channel.send(f'{message.author.mention}, ТЫ ЗАМУЧЕН НА 3 ЧАСА! В СЛЕДУЮЩИЙ РАС СТАРАЙСЯ НЕ МАТЕРИТЬСЯ')
await message.author.add_roles(rolemute)
вот ошибка: File "C:\Users\ЯРИК\Desktop\discordbot\bot.py", line 126, in status
base.execute("CREATE TABLE IF NOT EXISTS {}(userid INT, count INT)".format(ctx.message.guild.name))
sqlite3.OperationalError: near "БОТА": syntax error