yeref 0.24.25__tar.gz → 0.24.26__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.24.25
3
+ Version: 0.24.26
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.24.25',
5
+ version='0.24.26',
6
6
  description='desc-f',
7
7
  author='john smith',
8
8
  packages=['yeref'],
@@ -211,7 +211,7 @@ BOT_CADMIN_ = '☐☑'
211
211
  BOT_VARS_ = '{"BOT_PROMO": "#911", "BOT_CHANNEL": 0, "BOT_CHANNELTID": 0, "BOT_GROUP": 0, "BOT_GROUPTID": 0, "BOT_CHATGPT": "", "BOT_GEO": 0, "BOT_TZ": "+00:00", "BOT_DT": "", "BOT_LZ": "en", "BOT_LC": "en", "BOT_ISSTARTED": 0, "BOT_ISMENTIONED": 0}'
212
212
  BOT_LSTS_ = '{"BOT_ADMINS": [], "BOT_COMMANDS": ["/start"]}'
213
213
  USER_VARS_ = '{"USER_TEXT": "", "USER_REACTION": "", "USER_PUSH": "", "USER_EMAIL": "", "USER_PROMO": "", "USER_CONTACT": "", "USER_GEO": "", "USER_UTM": "", "USER_ID": 0, "USER_DT": "", "USER_TZ": "+00:00", "USER_LC": "en", "USER_LZ": "en", "USER_ISADMIN": 0, "USER_ISBLOG": 0, "USER_ISPREMIUM": 0, "USER_BALL": 0, "USER_RAND": 0, "USER_QUIZ": 0, "USER_DICE": 0, "MSGID_PAID": 0, "DATE_TIME": 0}'
214
- USER_LSTS_ = '{"USER_UTMREF": [], "USER_PAYMENTS": [], "USER_TXS": []}'
214
+ USER_LSTS_ = '{"USER_UTMREF": [], "USER_PAYMENTS": [], "USER_TXS": [], "USER_DAU": [], "USER_MAU": []}'
215
215
 
216
216
  UB_CONFIG_ = '☑☑☑☐☐☑☑☐☐☐☐☐☐'
217
217
  UB_CMONITOR_ = '☐'
@@ -15511,124 +15511,141 @@ async def get_vars_web_main(chat_id, username, full_name, lc, is_premium, utm_we
15511
15511
  return is_paid, till_paid, lz
15512
15512
 
15513
15513
 
15514
- # endregion
15514
+ async def upd_user_data_main(data, web_app_init_data, BASE_P, BOT_TOKEN_E18B, req_url=''):
15515
+ chat_id = int(web_app_init_data.get('user', {}).get('id'))
15516
+ username = web_app_init_data.get('user', {}).get('username', None)
15517
+ first_name = web_app_init_data.get('user', {}).get('first_name', '')
15518
+ last_name = web_app_init_data.get('user', {}).get('last_name', '')
15519
+ full_name = f"{first_name} {last_name}".strip()
15520
+ lc = web_app_init_data.get('user', {}).get('language_code', 'en')
15521
+ is_premium = web_app_init_data.get('user', {}).get('is_premium', None)
15522
+ usr_sig = web_app_init_data.get('signature', '')
15515
15523
 
15524
+ page = data.get('page', '')
15525
+ connectedAddress = data.get('connectedAddress', '')
15526
+ USER_TID = chat_id
15527
+ USER_VARS = json.loads(USER_VARS_)
15528
+ USER_LSTS = json.loads(USER_LSTS_)
15529
+ USER_GAMES = {}
15530
+ balls = 1
15531
+ is_paid = False
15532
+ till_paid = ''
15516
15533
 
15517
- # region notes
15518
- # sys.path.append('../hub')
15519
- # print("In module products sys.path[0], __package__ ==", sys.path[-1], __package__)
15520
- # from .. .hub import xtra
15521
- # dp.register_chosen_inline_handler(chosen_inline_handler_fun, lambda chosen_inline_result: True)
15522
- # dp.register_inline_handler(inline_handler_main, lambda inline_handler_main_: True)
15523
- # channel_post_handler
15524
- # edited_channel_post_handler
15525
- # poll_handler - а это получается реакция на размещение опроса
15526
- # poll_answer_handler - реакция на голосование
15527
- # chat_join_request_handler
15528
- # errors_handler
15529
- # current_state
15534
+ print(f"upd_user_data_main: {USER_LSTS=}")
15535
+ try:
15536
+ sql = f"SELECT USER_TID, USER_GAMES, USER_VARS, USER_LSTS FROM \"USER\" WHERE USER_TID=$1"
15537
+ data_user = await db_select_pg(sql, (chat_id,), BASE_P)
15530
15538
 
15531
- # apt install redis -y
15532
- # nano /etc/redis/redis.conf
15533
- # systemctl restart redis.service
15534
- # systemctl status redis
15535
- # redis-cli
15536
- # netstat -lnp | grep redis
15539
+ if len(data_user):
15540
+ USER_TID, USER_GAMES, USER_VARS, USER_LSTS = data_user[0]
15541
+ USER_GAMES = json.loads(USER_GAMES)
15542
+ USER_VARS = json.loads(USER_VARS)
15543
+ USER_LSTS = json.loads(USER_LSTS)
15544
+ if page in ['msg', 'pst']: USER_GAMES = await ch_games(USER_GAMES, 'web', True, balls)
15537
15545
 
15538
- # apt update && apt upgrade -y
15539
- # curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
15540
- # apt install -y nodejs build-essential nginx yarn
15541
- # npm install -g npm pm2@latest -g
15542
- # ufw allow 'Nginx Full'
15543
- # curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null
15544
- # echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | tee /etc/apt/sources.list.d/yarn.list
15545
- # node -v
15546
- # nginx -v
15547
- # yarn -v
15546
+ # region lz
15547
+ if lc:
15548
+ USER_VARS['USER_LC'] = lc
15549
+ lz = 'en'
15550
+ if lc in ['zh', 'zh-chs', 'zh-cht', 'ja', 'ko', 'zh-CN', 'zh-TW', 'th', 'vi', 'tw', 'sg']:
15551
+ lz = 'zh'
15552
+ # arabic # ir, af
15553
+ elif lc in ['ar-XA', 'ar', 'tr', 'ur', 'fa', 'tj', 'dz', 'eg', 'iq', 'sy', 'ae', 'sa', 'tn', 'ir', 'af']:
15554
+ lz = 'ar'
15555
+ # spanish # portugal: 'pt', 'br', 'ao', 'mz'
15556
+ elif lc in ['es', 'ar', 'cl', 'co', 'cu', 've', 'bo', 'pe', 'ec', 'pt', 'br', 'ao', 'mz']:
15557
+ lz = 'es'
15558
+ # french
15559
+ elif lc in ['fr', 'ch', 'be', 'ca']:
15560
+ lz = 'fr'
15561
+ # europe
15562
+ elif lc in ['ru', 'kz', 'kg', 'uz', 'tm', 'md', 'am', 'uk-UA', 'uk', 'kk', 'tk', 'ky']:
15563
+ lz = 'ru'
15564
+ USER_VARS['USER_LZ'] = lz
15565
+ # endregion
15566
+ print(f"{USER_VARS=}, {lc=}")
15548
15567
 
15549
- # systemctl restart nginx
15550
- # systemctl reload nginx
15551
- # snap install core; snap refresh core
15552
- # apt remove python3-certbot-nginx certbot -y
15553
- # rm -rf /etc/letsencrypt/renewal/
15554
- # rm -rf /etc/letsencrypt/archive/
15555
- # rm -rf /etc/letsencrypt/live/
15556
- # rm -rf /opt/letsencrypt
15557
- # rm -rf /etc/letsencrypt
15558
- # snap install --classic certbot
15559
- # ln -s /snap/bin/certbot /usr/bin/certbot
15560
- # endregion
15568
+ # region tx
15569
+ if connectedAddress:
15570
+ print(f"{connectedAddress=}, {USER_VARS=}")
15571
+ USER_VARS['USER_WALLET'] = connectedAddress
15572
+ print(f"after {req_url=}, {USER_VARS=}")
15573
+ print(f"after {data.get('amount', None)=}, {data=}")
15561
15574
 
15575
+ if req_url and data.get('amount', None):
15576
+ amount = data.get('amount', None)
15577
+ address = data.get('address', '')
15578
+ DT_START = datetime.now(timezone.utc).strftime('%d-%m-%Y_%H-%M-%S')
15579
+ USER_TXS = USER_LSTS.get("USER_TXS", [])
15562
15580
 
15563
- # region pst
15564
- async def ch_games(USER_GAMES, game, condition, balls=-1):
15565
- try:
15566
- dt = datetime.now(timezone.utc)
15567
- dt_ = dt.strftime('%d-%m-%Y_%H-%M-%S')
15581
+ USER_TXS.append({
15582
+ 'TYPE': req_url,
15583
+ 'AMOUNT': amount,
15584
+ 'ADDRESS': address,
15585
+ 'DT_START': DT_START,
15586
+ })
15587
+ USER_LSTS["USER_TXS"] = USER_TXS
15588
+ print(f"{USER_TXS=}, {USER_LSTS=}")
15589
+ # endregion
15568
15590
 
15569
- print(f"Текущее время: {dt_}")
15570
- print(f"Игровые данные: {USER_GAMES}")
15571
- print(f"Игра: {game}, Условие: {condition}, Баллы: {balls}")
15591
+ # region pay
15592
+ pays = USER_LSTS.get('USER_PAYMENTS', [])
15593
+ print(f"{pays=}")
15594
+ for pay in pays:
15595
+ try:
15596
+ if not (pay.get('TYPE', '') == 'SUB' and pay.get('DT_END', '')): continue
15597
+ DT_END = datetime.strptime(pay.get('DT_END'), '%d-%m-%Y_%H-%M-%S').replace(tzinfo=timezone.utc)
15598
+ print(f"{DT_END=}")
15599
+ if datetime.now(timezone.utc) <= DT_END:
15600
+ is_paid = True
15601
+ till_paid = DT_END.strftime('%d.%m.%Y')
15602
+ except Exception as e:
15603
+ logger.info(log_ % str(e))
15604
+ pass
15572
15605
 
15573
- if condition:
15574
- # if game not in USER_GAMES:
15575
- # USER_GAMES[game] = {'date': datetime.now(timezone.utc)}
15576
- # dt_game = USER_GAMES[game].get('date')
15577
- # print(f"Дата игры: {dt_game}")
15606
+ if not is_paid:
15607
+ extra_bot = None
15608
+ try:
15609
+ lib_id = channel_library_ru if lz == 'ru' else channel_library_en
15610
+ print(f"{channel_library_ru=}, {channel_library_en=}")
15611
+ extra_bot = Bot(token=BOT_TOKEN_E18B)
15612
+ member_ = await extra_bot.get_chat_member(chat_id=lib_id, user_id=chat_id)
15613
+ if member_.status in ['member', 'administrator', 'creator']: is_paid = True
15614
+ print(f"get_vars_web_main -> get_chat_member {is_paid=}")
15615
+ except Exception as e:
15616
+ logger.info(log_ % str(e))
15617
+ finally:
15618
+ if extra_bot: await extra_bot.session.close()
15619
+ # endregion
15578
15620
 
15579
- if game not in USER_GAMES or not USER_GAMES[game].get('date', None):
15580
- print("Нет даты, устанавливаем новую")
15581
- USER_GAMES[game] = {'date': dt_, 'balls': balls}
15582
- print(f"Добавлена новая игра: {USER_GAMES[game]}")
15583
- else:
15584
- dt_game = USER_GAMES[game].get('date')
15585
- dt_game = datetime.strptime(dt_game, "%d-%m-%Y_%H-%M-%S").replace(tzinfo=timezone.utc)
15586
- print(f"Дата игры в datetime: {dt_game}")
15621
+ now = datetime.now(timezone.utc)
15622
+ USER_LSTS["USER_DAU"] = list(set(USER_LSTS.get("USER_DAU", []) + [now.strftime('%Y-%m-%d')]))
15623
+ USER_LSTS["USER_MAU"] = list(set(USER_LSTS.get("USER_MAU", []) + [now.strftime('%Y-%m')]))
15624
+ USER_VARS['USER_SIG'] = usr_sig
15625
+ USER_VARS['USER_ISPREMIUM'] = is_premium
15587
15626
 
15588
- if (dt - dt_game).days >= 1 or balls == -1:
15589
- print("Прошел день, обновляем данные")
15590
- USER_GAMES[game]['date'] = dt_
15591
- USER_GAMES[game]['balls'] = balls
15592
- else:
15593
- print("День не прошел, данные не меняем")
15594
- else:
15595
- print("Условие не выполнено, обнуляем баллы")
15596
- if isinstance(USER_GAMES.get(game), dict):
15597
- USER_GAMES[game]['balls'] = 0
15598
- else:
15599
- USER_GAMES[game] = {'date': dt_, 'balls': 0}
15627
+ sql = f"""
15628
+ INSERT INTO \"USER\" (
15629
+ USER_TID, USER_USERNAME, USER_FULLNAME, USER_GAMES, USER_VARS, USER_LSTS
15630
+ )
15631
+ VALUES ($1, $2, $3, $4, $5, $6)
15632
+ ON CONFLICT (USER_TID) DO UPDATE
15633
+ SET
15634
+ USER_USERNAME = EXCLUDED.USER_USERNAME,
15635
+ USER_FULLNAME = EXCLUDED.USER_FULLNAME,
15636
+ USER_GAMES = EXCLUDED.USER_GAMES,
15637
+ USER_VARS = EXCLUDED.USER_VARS,
15638
+ USER_LSTS = EXCLUDED.USER_LSTS
15639
+ """
15640
+ await db_change_pg(sql, (USER_TID, username, full_name,
15641
+ json.dumps(USER_GAMES, ensure_ascii=False),
15642
+ json.dumps(USER_VARS, ensure_ascii=False),
15643
+ json.dumps(USER_LSTS, ensure_ascii=False),), BASE_P)
15600
15644
  except Exception as e:
15601
15645
  logger.info(log_ % str(e))
15602
- print(f"Ошибка: {e}")
15603
15646
  await asyncio.sleep(round(random.uniform(0, 1), 2))
15604
15647
  finally:
15605
- print(f"Финальные данные: {USER_GAMES}")
15606
- return USER_GAMES
15607
-
15608
-
15609
- # async def ch_games(USER_GAMES, game, condition, balls=1):
15610
- # try:
15611
- # dt = datetime.now(timezone.utc)
15612
- # dt_ = dt.strftime('%d-%m-%Y_%H-%M-%S')
15613
- #
15614
- # if condition:
15615
- # dt_game = USER_GAMES[game].get('date')
15616
- #
15617
- # if not dt_game:
15618
- # USER_GAMES[game]['date'] = dt_
15619
- # USER_GAMES[game]['balls'] = balls
15620
- # else:
15621
- # dt_game = datetime.strptime(dt_game, "%d-%m-%Y_%H-%M-%S").replace(tzinfo=timezone.utc)
15622
- # if (dt - dt_game).days >= 1:
15623
- # USER_GAMES[game]['date'] = dt_
15624
- # USER_GAMES[game]['balls'] = balls
15625
- # else:
15626
- # USER_GAMES[game]['balls'] = 0
15627
- # except Exception as e:
15628
- # logger.info(log_ % str(e))
15629
- # await asyncio.sleep(round(random.uniform(0, 1), 2))
15630
- # finally:
15631
- # return USER_GAMES
15648
+ return USER_TID, username, full_name, USER_GAMES, USER_VARS, USER_LSTS, is_paid, till_paid
15632
15649
 
15633
15650
 
15634
15651
  async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE_P, req_url=''):
@@ -15641,18 +15658,18 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
15641
15658
  is_premium = web_app_init_data.get('user', {}).get('is_premium', None)
15642
15659
  usr_sig = web_app_init_data.get('signature', '')
15643
15660
 
15661
+ tid = str(ENT_TID).replace('-', '')
15644
15662
  page = data.get('page', '')
15645
15663
  connectedAddress = data.get('connectedAddress', '')
15646
-
15647
15664
  USER_TID = chat_id
15648
15665
  USER_VARS = json.loads(USER_VARS_)
15649
15666
  USER_LSTS = json.loads(USER_LSTS_)
15650
15667
  USER_GAMES = {}
15651
- print(f"start get usernv a, {USER_LSTS=}")
15668
+ balls = 1
15669
+
15670
+ print(f"upd_user_data: {USER_LSTS=}")
15652
15671
  try:
15653
- tid = str(ENT_TID).replace('-', '')
15654
15672
  schema_name = 'USER'
15655
- balls = 1
15656
15673
  if PROJECT_USERNAME == 'FereyBotBot':
15657
15674
  schema_name = 'BOT'
15658
15675
  balls = -1
@@ -15692,9 +15709,8 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
15692
15709
  USER_VARS['USER_LZ'] = lz
15693
15710
  # endregion
15694
15711
  print(f"{USER_VARS=}, {lc=}")
15695
- USER_VARS['USER_SIG'] = usr_sig
15696
- USER_VARS['USER_ISPREMIUM'] = is_premium
15697
15712
 
15713
+ # region tx
15698
15714
  if connectedAddress:
15699
15715
  print(f"{connectedAddress=}, {USER_VARS=}")
15700
15716
  USER_VARS['USER_WALLET'] = connectedAddress
@@ -15715,6 +15731,13 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
15715
15731
  })
15716
15732
  USER_LSTS["USER_TXS"] = USER_TXS
15717
15733
  print(f"{USER_TXS=}, {USER_LSTS=}")
15734
+ # endregion
15735
+
15736
+ now = datetime.now(timezone.utc)
15737
+ USER_LSTS["USER_DAU"] = list(set(USER_LSTS.get("USER_DAU", []) + [now.strftime('%Y-%m-%d')]))
15738
+ USER_LSTS["USER_MAU"] = list(set(USER_LSTS.get("USER_MAU", []) + [now.strftime('%Y-%m')]))
15739
+ USER_VARS['USER_SIG'] = usr_sig
15740
+ USER_VARS['USER_ISPREMIUM'] = is_premium
15718
15741
 
15719
15742
  sql = f"""
15720
15743
  INSERT INTO {schema_name}_{tid}.USER (
@@ -15738,37 +15761,99 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
15738
15761
  await asyncio.sleep(round(random.uniform(0, 1), 2))
15739
15762
  finally:
15740
15763
  return USER_TID, username, full_name, USER_GAMES, USER_VARS, USER_LSTS
15764
+ # endregion
15741
15765
 
15742
15766
 
15743
- async def get_user_vars2(chat_id, ENT_TID, BASE_D, PROJECT_USERNAME):
15744
- USER_GAMES = {}
15745
- USER_VARS = {}
15746
- USER_ISPAID = 0
15767
+ # region notes
15768
+ # sys.path.append('../hub')
15769
+ # print("In module products sys.path[0], __package__ ==", sys.path[-1], __package__)
15770
+ # from .. .hub import xtra
15771
+ # dp.register_chosen_inline_handler(chosen_inline_handler_fun, lambda chosen_inline_result: True)
15772
+ # dp.register_inline_handler(inline_handler_main, lambda inline_handler_main_: True)
15773
+ # channel_post_handler
15774
+ # edited_channel_post_handler
15775
+ # poll_handler - а это получается реакция на размещение опроса
15776
+ # poll_answer_handler - реакция на голосование
15777
+ # chat_join_request_handler
15778
+ # errors_handler
15779
+ # current_state
15780
+
15781
+ # apt install redis -y
15782
+ # nano /etc/redis/redis.conf
15783
+ # systemctl restart redis.service
15784
+ # systemctl status redis
15785
+ # redis-cli
15786
+ # netstat -lnp | grep redis
15787
+
15788
+ # apt update && apt upgrade -y
15789
+ # curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
15790
+ # apt install -y nodejs build-essential nginx yarn
15791
+ # npm install -g npm pm2@latest -g
15792
+ # ufw allow 'Nginx Full'
15793
+ # curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null
15794
+ # echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | tee /etc/apt/sources.list.d/yarn.list
15795
+ # node -v
15796
+ # nginx -v
15797
+ # yarn -v
15798
+
15799
+ # systemctl restart nginx
15800
+ # systemctl reload nginx
15801
+ # snap install core; snap refresh core
15802
+ # apt remove python3-certbot-nginx certbot -y
15803
+ # rm -rf /etc/letsencrypt/renewal/
15804
+ # rm -rf /etc/letsencrypt/archive/
15805
+ # rm -rf /etc/letsencrypt/live/
15806
+ # rm -rf /opt/letsencrypt
15807
+ # rm -rf /etc/letsencrypt
15808
+ # snap install --classic certbot
15809
+ # ln -s /snap/bin/certbot /usr/bin/certbot
15810
+ # endregion
15811
+
15812
+
15813
+ # region pst
15814
+ async def ch_games(USER_GAMES, game, condition, balls=-1):
15747
15815
  try:
15748
- schema_name = 'USER'
15749
- if PROJECT_USERNAME == 'FereyBotBot':
15750
- schema_name = 'BOT'
15751
- elif PROJECT_USERNAME == 'FereyChannelBot':
15752
- schema_name = 'CHANNEL'
15753
- elif PROJECT_USERNAME == 'FereyGroupBot':
15754
- schema_name = 'GROUPP'
15816
+ dt = datetime.now(timezone.utc)
15817
+ dt_ = dt.strftime('%d-%m-%Y_%H-%M-%S')
15755
15818
 
15756
- sql = f"SELECT USER_GAMES, USER_VARS, USER_ISPAID FROM {schema_name}_{str(ENT_TID).replace('-', '')}.USER WHERE USER_TID=$1"
15757
- data_usr = await db_select_pg(sql, (chat_id,), BASE_D)
15758
- if not len(data_usr) or not data_usr[0][0]:
15759
- if not len(data_usr):
15760
- dt_now = datetime.now(timezone.utc).strftime('%d-%m-%Y_%H-%M-%S')
15761
- sql = f"INSERT INTO {schema_name}_{str(ENT_TID).replace('-', '')}.USER (USER_TID, USER_DT) VALUES ($1, $2) ON CONFLICT DO NOTHING"
15762
- await db_change_pg(sql, (chat_id, dt_now,), BASE_D)
15819
+ print(f"Текущее время: {dt_}")
15820
+ print(f"Игровые данные: {USER_GAMES}")
15821
+ print(f"Игра: {game}, Условие: {condition}, Баллы: {balls}")
15822
+
15823
+ if condition:
15824
+ # if game not in USER_GAMES:
15825
+ # USER_GAMES[game] = {'date': datetime.now(timezone.utc)}
15826
+ # dt_game = USER_GAMES[game].get('date')
15827
+ # print(f"Дата игры: {dt_game}")
15828
+
15829
+ if game not in USER_GAMES or not USER_GAMES[game].get('date', None):
15830
+ print("Нет даты, устанавливаем новую")
15831
+ USER_GAMES[game] = {'date': dt_, 'balls': balls}
15832
+ print(f"Добавлена новая игра: {USER_GAMES[game]}")
15833
+ else:
15834
+ dt_game = USER_GAMES[game].get('date')
15835
+ dt_game = datetime.strptime(dt_game, "%d-%m-%Y_%H-%M-%S").replace(tzinfo=timezone.utc)
15836
+ print(f"Дата игры в datetime: {dt_game}")
15837
+
15838
+ if (dt - dt_game).days >= 1 or balls == -1:
15839
+ print("Прошел день, обновляем данные")
15840
+ USER_GAMES[game]['date'] = dt_
15841
+ USER_GAMES[game]['balls'] = balls
15842
+ else:
15843
+ print("День не прошел, данные не меняем")
15763
15844
  else:
15764
- USER_GAMES, USER_VARS, USER_ISPAID = data_usr[0]
15765
- USER_GAMES = json.loads(USER_GAMES) if USER_GAMES else {}
15766
- USER_VARS = json.loads(USER_VARS) if USER_VARS else {}
15845
+ print("Условие не выполнено, обнуляем баллы")
15846
+ if isinstance(USER_GAMES.get(game), dict):
15847
+ USER_GAMES[game]['balls'] = 0
15848
+ else:
15849
+ USER_GAMES[game] = {'date': dt_, 'balls': 0}
15767
15850
  except Exception as e:
15768
15851
  logger.info(log_ % str(e))
15852
+ print(f"Ошибка: {e}")
15769
15853
  await asyncio.sleep(round(random.uniform(0, 1), 2))
15770
15854
  finally:
15771
- return USER_GAMES, USER_VARS, USER_ISPAID
15855
+ print(f"Финальные данные: {USER_GAMES}")
15856
+ return USER_GAMES
15772
15857
 
15773
15858
 
15774
15859
  async def post_save(bot, data_user, data_web, MEDIA_D, BASE_P, KEYS_JSON, PROJECT_USERNAME, PROJECT_TYPE, is_paid=False):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yeref
3
- Version: 0.24.25
3
+ Version: 0.24.26
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