yeref 0.29.27__tar.gz → 0.29.29__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yeref
3
- Version: 0.29.27
3
+ Version: 0.29.29
4
4
  Summary: desc-f
5
5
  Author: john smith
6
6
  Dynamic: author
@@ -2,7 +2,7 @@ from setuptools import setup
2
2
 
3
3
  setup(
4
4
  name='yeref',
5
- version='0.29.27',
5
+ version='0.29.29',
6
6
  description='desc-f',
7
7
  author='john smith',
8
8
  packages=['yeref'],
@@ -7753,13 +7753,14 @@ async def upd_user_data_main(data, web_app_init_data, BASE_P, BOT_TOKEN_E18B, re
7753
7753
  page = data.get('page', '')
7754
7754
  connectedAddress = data.get('connectedAddress', '')
7755
7755
  USER_TID = chat_id
7756
- USER_HID = USER_LZ = None
7756
+ USER_HID = USER_LZ = USER_DT = None
7757
7757
  USER_VARS = json.loads(USER_VARS_)
7758
7758
  USER_LSTS = json.loads(USER_LSTS_)
7759
7759
  USER_GAMES = {}
7760
7760
  balls = 1
7761
7761
  is_paid = False
7762
7762
  till_paid = ''
7763
+ now_ = datetime.now(timezone.utc)
7763
7764
 
7764
7765
  print(f"upd_user_data_main: {lc=}, {USER_LSTS=}")
7765
7766
  try:
@@ -7793,14 +7794,14 @@ async def upd_user_data_main(data, web_app_init_data, BASE_P, BOT_TOKEN_E18B, re
7793
7794
  elif lc in ['ru', 'kz', 'kg', 'uz', 'tm', 'md', 'am', 'uk-UA', 'uk', 'kk', 'tk', 'ky']:
7794
7795
  lz = 'ru'
7795
7796
  USER_LZ = lz
7796
- if not USER_VARS.get('USER_DT', None):
7797
+ if not USER_DT:
7798
+ USER_DT = now_
7797
7799
  USER_VARS['USER_DT'] = USER_DT.strftime("%d-%m-%Y_%H-%M-%S")
7798
7800
  USER_HID = hashlib.blake2b(f"{'tid'}-{chat_id}".encode('utf-8'), digest_size=4).hexdigest()
7799
7801
  if utm: USER_VARS['USER_UTM'] = utm
7800
7802
 
7801
- now = datetime.now(timezone.utc)
7802
- USER_LSTS["USER_DAU"] = list(set(USER_LSTS.get("USER_DAU", []) + [now.strftime('%Y-%m-%d')]))
7803
- USER_LSTS["USER_MAU"] = list(set(USER_LSTS.get("USER_MAU", []) + [now.strftime('%Y-%m')]))
7803
+ USER_LSTS["USER_DAU"] = list(set(USER_LSTS.get("USER_DAU", []) + [now_.strftime('%Y-%m-%d')]))
7804
+ USER_LSTS["USER_MAU"] = list(set(USER_LSTS.get("USER_MAU", []) + [now_.strftime('%Y-%m')]))
7804
7805
  USER_VARS['USER_SIG'] = usr_sig
7805
7806
  USER_VARS['USER_ISPREMIUM'] = is_premium
7806
7807
  USER_VARS['USER_LZ'] = USER_LZ
@@ -7862,9 +7863,9 @@ async def upd_user_data_main(data, web_app_init_data, BASE_P, BOT_TOKEN_E18B, re
7862
7863
  sql = f"""
7863
7864
  INSERT INTO \"USER\" (
7864
7865
  USER_TID, USER_HID, USER_USERNAME, USER_FULLNAME, USER_ISPREMIUM,
7865
- USER_LZ, USER_GAMES, USER_VARS, USER_LSTS
7866
+ USER_LZ, USER_DT, USER_GAMES, USER_VARS, USER_LSTS
7866
7867
  )
7867
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
7868
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
7868
7869
  ON CONFLICT (USER_TID) DO UPDATE
7869
7870
  SET
7870
7871
  USER_HID = EXCLUDED.USER_HID,
@@ -7877,7 +7878,7 @@ async def upd_user_data_main(data, web_app_init_data, BASE_P, BOT_TOKEN_E18B, re
7877
7878
  USER_VARS = EXCLUDED.USER_VARS,
7878
7879
  USER_LSTS = EXCLUDED.USER_LSTS
7879
7880
  """
7880
- await db_change_pg(sql, (USER_TID, USER_HID, username, full_name, is_premium, USER_LZ,
7881
+ await db_change_pg(sql, (USER_TID, USER_HID, username, full_name, is_premium, USER_LZ, USER_DT,
7881
7882
  json.dumps(USER_GAMES, ensure_ascii=False),
7882
7883
  json.dumps(USER_VARS, ensure_ascii=False),
7883
7884
  json.dumps(USER_LSTS, ensure_ascii=False),), BASE_P)
@@ -7901,11 +7902,12 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
7901
7902
  page = data.get('page', '')
7902
7903
  connectedAddress = data.get('connectedAddress', '')
7903
7904
  USER_TID = chat_id
7904
- USER_HID = USER_LZ = None
7905
+ USER_HID = USER_LZ = USER_DT = None
7905
7906
  USER_VARS = json.loads(USER_VARS_)
7906
7907
  USER_LSTS = json.loads(USER_LSTS_)
7907
7908
  USER_GAMES = {}
7908
7909
  balls = 1
7910
+ now_ = datetime.now(timezone.utc)
7909
7911
 
7910
7912
  print(f"upd_user_data: {USER_LSTS=}")
7911
7913
  try:
@@ -7950,13 +7952,15 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
7950
7952
  elif lc in ['ru', 'kz', 'kg', 'uz', 'tm', 'md', 'am', 'uk-UA', 'uk', 'kk', 'tk', 'ky']:
7951
7953
  lz = 'ru'
7952
7954
  USER_LZ = lz
7953
- if not USER_VARS.get('USER_DT', None):
7955
+ if not USER_DT:
7956
+ USER_DT = now_
7954
7957
  USER_VARS['USER_DT'] = USER_DT.strftime("%d-%m-%Y_%H-%M-%S")
7958
+ USER_HID = hashlib.blake2b(f"{'tid'}-{chat_id}".encode('utf-8'), digest_size=4).hexdigest()
7959
+ if req_url: USER_VARS['USER_UTM'] = req_url
7955
7960
  if not USER_HID: USER_HID = hashlib.blake2b(f"{tid}-{chat_id}".encode('utf-8'), digest_size=4).hexdigest()
7956
7961
 
7957
- now = datetime.now(timezone.utc)
7958
- USER_LSTS["USER_DAU"] = list(set(USER_LSTS.get("USER_DAU", []) + [now.strftime('%Y-%m-%d')]))
7959
- USER_LSTS["USER_MAU"] = list(set(USER_LSTS.get("USER_MAU", []) + [now.strftime('%Y-%m')]))
7962
+ USER_LSTS["USER_DAU"] = list(set(USER_LSTS.get("USER_DAU", []) + [now_.strftime('%Y-%m-%d')]))
7963
+ USER_LSTS["USER_MAU"] = list(set(USER_LSTS.get("USER_MAU", []) + [now_.strftime('%Y-%m')]))
7960
7964
  USER_VARS['USER_SIG'] = usr_sig
7961
7965
  USER_VARS['USER_ISPREMIUM'] = is_premium
7962
7966
  USER_VARS['USER_LZ'] = USER_LZ
@@ -7988,9 +7992,9 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
7988
7992
  sql = f"""
7989
7993
  INSERT INTO {schema_name}_{tid}.USER (
7990
7994
  USER_TID, USER_HID, USER_USERNAME, USER_FULLNAME, USER_ISPREMIUM,
7991
- USER_LZ, USER_GAMES, USER_VARS, USER_LSTS
7995
+ USER_LZ, USER_DT, USER_GAMES, USER_VARS, USER_LSTS
7992
7996
  )
7993
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
7997
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
7994
7998
  ON CONFLICT (USER_TID) DO UPDATE
7995
7999
  SET
7996
8000
  USER_HID = EXCLUDED.USER_HID,
@@ -8003,7 +8007,7 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
8003
8007
  USER_VARS = EXCLUDED.USER_VARS,
8004
8008
  USER_LSTS = EXCLUDED.USER_LSTS
8005
8009
  """
8006
- await db_change_pg(sql, (USER_TID, USER_HID, username, full_name, is_premium, USER_LZ,
8010
+ await db_change_pg(sql, (USER_TID, USER_HID, username, full_name, is_premium, USER_LZ, USER_DT,
8007
8011
  json.dumps(USER_GAMES, ensure_ascii=False),
8008
8012
  json.dumps(USER_VARS, ensure_ascii=False),
8009
8013
  json.dumps(USER_LSTS, ensure_ascii=False),), BASE_P)
@@ -8086,53 +8090,6 @@ async def is_subscription_expired(USER_VARS, USER_LSTS):
8086
8090
 
8087
8091
 
8088
8092
  # 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
8093
  async def convert_domain_to_currency(domain):
8137
8094
  result = 'EUR'
8138
8095
  try:
@@ -8368,61 +8325,6 @@ async def create_invoice_link_my(BOT_TID, BOT_LC, msg_text, msg_btns, POST_LNK,
8368
8325
  return result
8369
8326
 
8370
8327
 
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
8328
  async def pay_handler_for_all(bot, message, ideas_en, ideas_ru, PROJECT_USERNAME, EXTRA_D, BASE_P):
8427
8329
  try:
8428
8330
  successful_payment_data = {k: v for k, v in message.successful_payment.model_dump().items() if v is not None}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yeref
3
- Version: 0.29.27
3
+ Version: 0.29.29
4
4
  Summary: desc-f
5
5
  Author: john smith
6
6
  Dynamic: author
File without changes
File without changes
File without changes
File without changes
File without changes