Merge branch 'S1S13AF7-main'
Cosmetic
This commit is contained in:
commit
8118e2ec9c
1 changed files with 3 additions and 6 deletions
9
ubot.py
9
ubot.py
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue