yeref 0.29.27__tar.gz → 0.29.28__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {yeref-0.29.27 → yeref-0.29.28}/PKG-INFO +1 -1
- {yeref-0.29.27 → yeref-0.29.28}/setup.py +1 -1
- {yeref-0.29.27 → yeref-0.29.28}/yeref/yeref.py +0 -102
- {yeref-0.29.27 → yeref-0.29.28}/yeref.egg-info/PKG-INFO +1 -1
- {yeref-0.29.27 → yeref-0.29.28}/pyproject.toml +0 -0
- {yeref-0.29.27 → yeref-0.29.28}/setup.cfg +0 -0
- {yeref-0.29.27 → yeref-0.29.28}/yeref/__init__.py +0 -0
- {yeref-0.29.27 → yeref-0.29.28}/yeref/l_.py +0 -0
- {yeref-0.29.27 → yeref-0.29.28}/yeref/tonweb.js +0 -0
- {yeref-0.29.27 → yeref-0.29.28}/yeref.egg-info/SOURCES.txt +0 -0
- {yeref-0.29.27 → yeref-0.29.28}/yeref.egg-info/dependency_links.txt +0 -0
- {yeref-0.29.27 → yeref-0.29.28}/yeref.egg-info/top_level.txt +0 -0
@@ -8086,53 +8086,6 @@ async def is_subscription_expired(USER_VARS, USER_LSTS):
|
|
8086
8086
|
|
8087
8087
|
|
8088
8088
|
# region pay
|
8089
|
-
async def update_subscribe(bot, BASE_P, BOT_TOKEN_E18B):
|
8090
|
-
result = []
|
8091
|
-
try:
|
8092
|
-
dt_ = datetime.now(timezone.utc)
|
8093
|
-
if not (dt_.hour % 2 == 0 and dt_.minute % 2 == 0 and dt_.second % 2 == 0): return result
|
8094
|
-
sql = "SELECT USER_TID, USER_LZ, USER_DTPAID, USER_ISPAID FROM USER"
|
8095
|
-
data = await db_select_pg(sql, (), BASE_P)
|
8096
|
-
|
8097
|
-
for item in data:
|
8098
|
-
try:
|
8099
|
-
USER_TID, USER_LZ, USER_DTPAID, USER_ISPAID = item
|
8100
|
-
dtpt_ = datetime.strptime(USER_DTPAID, '%d-%m-%Y_%H-%M-%S').replace(tzinfo=timezone.utc)
|
8101
|
-
|
8102
|
-
if USER_ISPAID == 1 and USER_DTPAID and (dt_ - dtpt_).days > 31:
|
8103
|
-
await asyncio.sleep(round(random.uniform(0, 1), 2))
|
8104
|
-
get_ = await bot.get_chat(chat_id=USER_TID)
|
8105
|
-
chan_private_donate = channel_library_ru if USER_LZ == 'ru' else channel_library_en
|
8106
|
-
extra_bot = Bot(token=BOT_TOKEN_E18B)
|
8107
|
-
get_chat_member_ = await extra_bot.get_chat_member(chat_id=chan_private_donate, user_id=USER_TID)
|
8108
|
-
await extra_bot.session.close()
|
8109
|
-
|
8110
|
-
if get_chat_member_.status in ['member', 'administrator', 'creator']:
|
8111
|
-
USER_DTPAID = datetime.now(timezone.utc).strftime('%d-%m-%Y_%H-%M-%S')
|
8112
|
-
sql = "UPDATE USER SET USER_ISPAID=1, USER_USERNAME=$1, USER_FULLNAME=$2, USER_DTPAID=$3 " \
|
8113
|
-
"WHERE USER_TID=$4"
|
8114
|
-
await db_change_pg(sql, (get_.username, get_.full_name, USER_DTPAID, USER_TID,), BASE_P)
|
8115
|
-
else:
|
8116
|
-
sql = "UPDATE USER SET USER_ISPAID=0, USER_USERNAME=$1, USER_FULLNAME=$2 WHERE USER_TID=$3"
|
8117
|
-
await db_change_pg(sql, (get_.username, get_.full_name, USER_TID,), BASE_P)
|
8118
|
-
elif USER_ISPAID == -1 and USER_DTPAID and (dt_ - dtpt_).days > 31:
|
8119
|
-
result.append(
|
8120
|
-
item) # else: # sql = "UPDATE USER SET USER_USERNAME=$1, USER_FULLNAME=$2 WHERE USER_TID=$3" # await db_change_pg(sql, (get_.username, get_.full_name, USER_TID,), BASE_P)
|
8121
|
-
except TelegramRetryAfter as e:
|
8122
|
-
logger.info(log_ % f"TelegramRetryAfter {e.retry_after}")
|
8123
|
-
await asyncio.sleep(e.retry_after + 1)
|
8124
|
-
except Exception as e:
|
8125
|
-
logger.info(log_ % str(e))
|
8126
|
-
await asyncio.sleep(round(random.uniform(0, 1), 2))
|
8127
|
-
except TelegramRetryAfter as e:
|
8128
|
-
logger.info(log_ % f"TelegramRetryAfter {e.retry_after}")
|
8129
|
-
await asyncio.sleep(e.retry_after + 1)
|
8130
|
-
except Exception as e:
|
8131
|
-
logger.info(log_ % str(e))
|
8132
|
-
await asyncio.sleep(round(random.uniform(0, 1), 2))
|
8133
|
-
return result
|
8134
|
-
|
8135
|
-
|
8136
8089
|
async def convert_domain_to_currency(domain):
|
8137
8090
|
result = 'EUR'
|
8138
8091
|
try:
|
@@ -8368,61 +8321,6 @@ async def create_invoice_link_my(BOT_TID, BOT_LC, msg_text, msg_btns, POST_LNK,
|
|
8368
8321
|
return result
|
8369
8322
|
|
8370
8323
|
|
8371
|
-
async def check_sub_pay(chat_id, lz, BOT_TOKEN_E18B, BASE_P):
|
8372
|
-
is_paid = False
|
8373
|
-
till_paid = ''
|
8374
|
-
try:
|
8375
|
-
USER_ISPAID = 0
|
8376
|
-
USER_DTPAID = ''
|
8377
|
-
dt_now = datetime.now(timezone.utc)
|
8378
|
-
extra_bot = None
|
8379
|
-
try:
|
8380
|
-
lib_id = channel_library_ru if lz == 'ru' else channel_library_en
|
8381
|
-
extra_bot = Bot(token=BOT_TOKEN_E18B)
|
8382
|
-
member_ = await extra_bot.get_chat_member(chat_id=lib_id, user_id=chat_id)
|
8383
|
-
if member_.status in ['member', 'administrator', 'creator']: is_paid = True
|
8384
|
-
print(f"check_sub_pay {is_paid=}")
|
8385
|
-
except Exception as e:
|
8386
|
-
logger.info(log_ % str(e))
|
8387
|
-
finally:
|
8388
|
-
if extra_bot: await extra_bot.session.close()
|
8389
|
-
|
8390
|
-
sql = "SELECT USER_ISPAID, USER_DTPAID, USER_TYPAID, USER_LZ FROM USER WHERE USER_TID=$1"
|
8391
|
-
data_usr = await db_select_pg(sql, (chat_id,), BASE_P)
|
8392
|
-
|
8393
|
-
if not len(data_usr):
|
8394
|
-
sql = "INSERT INTO USER (USER_TID) VALUES ($1, $2) ON CONFLICT DO NOTHING"
|
8395
|
-
await db_change_pg(sql, (chat_id,), BASE_P)
|
8396
|
-
else:
|
8397
|
-
USER_ISPAID, USER_DTPAID, USER_TYPAID, lz = data_usr[0]
|
8398
|
-
|
8399
|
-
if is_paid:
|
8400
|
-
sql = "UPDATE USER SET USER_ISPAID=1, USER_DTPAID='', USER_TYPAID='all' WHERE USER_TID=$1"
|
8401
|
-
await db_change_pg(sql, (chat_id,), BASE_P)
|
8402
|
-
elif USER_ISPAID and USER_DTPAID:
|
8403
|
-
till_paid = dt_now.strptime(USER_DTPAID, "%d-%m-%Y_%H-%M-%S").replace(tzinfo=timezone.utc)
|
8404
|
-
print(f"{till_paid=}")
|
8405
|
-
|
8406
|
-
if dt_now > till_paid:
|
8407
|
-
sql = "UPDATE USER SET USER_ISPAID=0, USER_DTPAID='', USER_TYPAID='' WHERE USER_TID=$1"
|
8408
|
-
await db_change_pg(sql, (chat_id,), BASE_P)
|
8409
|
-
till_paid = ''
|
8410
|
-
else:
|
8411
|
-
is_paid = True
|
8412
|
-
till_paid = till_paid.strftime('%d.%m.%Y')
|
8413
|
-
else:
|
8414
|
-
sql = "UPDATE USER SET USER_ISPAID=0, USER_DTPAID='', USER_TYPAID='' WHERE USER_TID=$1"
|
8415
|
-
await db_change_pg(sql, (chat_id,), BASE_P)
|
8416
|
-
print(f"check_sub_pay {is_paid=}, {till_paid=}")
|
8417
|
-
except TelegramRetryAfter as e:
|
8418
|
-
logger.info(log_ % f"TelegramRetryAfter {e.retry_after}")
|
8419
|
-
await asyncio.sleep(e.retry_after + 1)
|
8420
|
-
except Exception as e:
|
8421
|
-
logger.info(log_ % str(e))
|
8422
|
-
await asyncio.sleep(round(random.uniform(0, 1), 2))
|
8423
|
-
return is_paid, till_paid
|
8424
|
-
|
8425
|
-
|
8426
8324
|
async def pay_handler_for_all(bot, message, ideas_en, ideas_ru, PROJECT_USERNAME, EXTRA_D, BASE_P):
|
8427
8325
|
try:
|
8428
8326
|
successful_payment_data = {k: v for k, v in message.successful_payment.model_dump().items() if v is not None}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|