Оновити ubot.py

This commit is contained in:
S1S13AF7 2024-12-14 18:32:12 +02:00
parent 300250b308
commit 1381d66147

View file

@ -12,7 +12,6 @@ import os
import json import json
import re import re
import random import random
# import pytz
import time import time
import pymysql import pymysql
@ -165,8 +164,7 @@ async def main():
if is_termux: if is_termux:
conn = sqlite3.connect(f"{default_directory}/{my_id}.sqlite") conn = sqlite3.connect(f"{default_directory}/{my_id}.sqlite")
else: else:
conn = sqlite3.connect(f"{my_id}.sqlite") # покласти базу рядом? conn = sqlite3.connect(f"{my_id}.sqlite") # покласти базу рядом
# conn = sqlite3.connect(f"D:\\Misc\\projects\\Python\\ub4tg_db\\{my_id}.sqlite")#Або повністю
c = conn.cursor() c = conn.cursor()
c.execute('''CREATE TABLE IF NOT EXISTS zarazy ( c.execute('''CREATE TABLE IF NOT EXISTS zarazy (
user_id INTEGER NOT NULL DEFAULT 0 UNIQUE, user_id INTEGER NOT NULL DEFAULT 0 UNIQUE,
@ -208,13 +206,12 @@ async def main():
"SELECT * FROM `tg_users_url` WHERE `u_link` = '%s' ORDER BY `when_int` DESC" % str(url)) "SELECT * FROM `tg_users_url` WHERE `u_link` = '%s' ORDER BY `when_int` DESC" % str(url))
user = d.fetchone() user = d.fetchone()
if user is None: if user is None:
# print(f'не знайшли {url} у `tg_users_url`')
pass pass
else: else:
user_id = int(user['user_id']) user_id = int(user['user_id'])
print(f'{url} in db: @{user_id}') print(f'{url} in db: @{user_id}')
except Exception as Err: except:
print(f'E:{Err}/S {url} у `tg_users_url`') pass
if user_id == 0: if user_id == 0:
try: try:
user_entity = await client.get_entity(url) user_entity = await client.get_entity(url)