import datetime
import time
import sqlite3
db = sqlite3.connect("bot.db") # или :memory: чтобы сохранить в RAM
sql = db.cursor()
while True:
for value in sql.execute(f"SELECT timemute FROM users WHERE ban = {1}"):
t = value[0]
offset = datetime.timezone(datetime.timedelta(hours=3))
d = datetime.datetime.now(offset)
t3 = d.strftime("%d %H %M")
if t == t3:
sql.execute(f"UPDATE users SET ban = {0} WHERE timemute = '{t}'")
db.commit()
sql.execute(f"UPDATE users SET timemute = '{0}' WHERE timemute = '{t}'")
db.commit()
time.sleep(35)
db = sqlite3.connect("bot.db") # или :memory: чтобы сохранить в RAM
sql = db.cursor() # подключение к бд
#кусок кода с бд
elif textchat[0] == "!op" and event.object.from_id == 270126576:
#в коде все TAB'ы расставлены правильно
try:
idv = event.object.reply_message["from_id"]
sql.execute(f"UPDATE users SET admin = {1} WHERE id = '{idv}'")
db.commit()
for value in sql.execute(f"SELECT * FROM users WHERE id = '{idv}'"):
print(value)
except:
idv = textchat[1]
sql.execute(f"UPDATE users SET admin = {1} WHERE id = '{idv}'")
db.commit()
elif eventtext == '!t' and value == 1:
msg_history = vk.method("messages.getHistory", {"peer_id": event.object.peer_id})
print(msg_history)