yeref 0.24.25__py3-none-any.whl → 0.24.27__py3-none-any.whl
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/yeref.py +218 -134
- {yeref-0.24.25.dist-info → yeref-0.24.27.dist-info}/METADATA +1 -1
- yeref-0.24.27.dist-info/RECORD +8 -0
- yeref-0.24.25.dist-info/RECORD +0 -8
- {yeref-0.24.25.dist-info → yeref-0.24.27.dist-info}/WHEEL +0 -0
- {yeref-0.24.25.dist-info → yeref-0.24.27.dist-info}/top_level.txt +0 -0
yeref/yeref.py
CHANGED
@@ -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
|
-
|
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
|
-
|
15518
|
-
|
15519
|
-
|
15520
|
-
|
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
|
-
#
|
15532
|
-
|
15533
|
-
|
15534
|
-
|
15535
|
-
|
15536
|
-
|
15539
|
+
# region data
|
15540
|
+
if len(data_user):
|
15541
|
+
USER_TID, USER_GAMES, USER_VARS, USER_LSTS = data_user[0]
|
15542
|
+
USER_GAMES = json.loads(USER_GAMES)
|
15543
|
+
USER_VARS = json.loads(USER_VARS)
|
15544
|
+
USER_LSTS = json.loads(USER_LSTS)
|
15545
|
+
if page in ['msg', 'pst']: USER_GAMES = await ch_games(USER_GAMES, 'web', True, balls)
|
15537
15546
|
|
15538
|
-
|
15539
|
-
|
15540
|
-
|
15541
|
-
|
15542
|
-
|
15543
|
-
#
|
15544
|
-
|
15545
|
-
|
15546
|
-
#
|
15547
|
-
|
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
|
15548
15565
|
|
15549
|
-
|
15550
|
-
|
15551
|
-
|
15552
|
-
|
15553
|
-
|
15554
|
-
|
15555
|
-
#
|
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
|
15566
|
+
now = datetime.now(timezone.utc)
|
15567
|
+
USER_LSTS["USER_DAU"] = list(set(USER_LSTS.get("USER_DAU", []) + [now.strftime('%Y-%m-%d')]))
|
15568
|
+
USER_LSTS["USER_MAU"] = list(set(USER_LSTS.get("USER_MAU", []) + [now.strftime('%Y-%m')]))
|
15569
|
+
USER_VARS['USER_SIG'] = usr_sig
|
15570
|
+
USER_VARS['USER_ISPREMIUM'] = is_premium
|
15571
|
+
lz = USER_VARS.get('USER_LZ', 'en')
|
15572
|
+
# endregion
|
15561
15573
|
|
15574
|
+
# region tx
|
15575
|
+
if connectedAddress:
|
15576
|
+
print(f"{connectedAddress=}, {USER_VARS=}")
|
15577
|
+
USER_VARS['USER_WALLET'] = connectedAddress
|
15578
|
+
print(f"after {req_url=}, {USER_VARS=}")
|
15579
|
+
print(f"after {data.get('amount', None)=}, {data=}")
|
15562
15580
|
|
15563
|
-
|
15564
|
-
|
15565
|
-
|
15566
|
-
|
15567
|
-
|
15581
|
+
if req_url and data.get('amount', None):
|
15582
|
+
amount = data.get('amount', None)
|
15583
|
+
address = data.get('address', '')
|
15584
|
+
DT_START = datetime.now(timezone.utc).strftime('%d-%m-%Y_%H-%M-%S')
|
15585
|
+
USER_TXS = USER_LSTS.get("USER_TXS", [])
|
15568
15586
|
|
15569
|
-
|
15570
|
-
|
15571
|
-
|
15587
|
+
USER_TXS.append({
|
15588
|
+
'TYPE': req_url,
|
15589
|
+
'AMOUNT': amount,
|
15590
|
+
'ADDRESS': address,
|
15591
|
+
'DT_START': DT_START,
|
15592
|
+
})
|
15593
|
+
USER_LSTS["USER_TXS"] = USER_TXS
|
15594
|
+
print(f"{USER_TXS=}, {USER_LSTS=}")
|
15595
|
+
# endregion
|
15572
15596
|
|
15573
|
-
|
15574
|
-
|
15575
|
-
|
15576
|
-
|
15577
|
-
|
15597
|
+
# region pay
|
15598
|
+
pays = USER_LSTS.get('USER_PAYMENTS', [])
|
15599
|
+
print(f"{pays=}")
|
15600
|
+
for pay in pays:
|
15601
|
+
try:
|
15602
|
+
if not (pay.get('TYPE', '') == 'SUB' and pay.get('DT_END', '')): continue
|
15603
|
+
DT_END = datetime.strptime(pay.get('DT_END'), '%d-%m-%Y_%H-%M-%S').replace(tzinfo=timezone.utc)
|
15604
|
+
print(f"{DT_END=}")
|
15605
|
+
if datetime.now(timezone.utc) <= DT_END:
|
15606
|
+
is_paid = True
|
15607
|
+
till_paid = DT_END.strftime('%d.%m.%Y')
|
15608
|
+
except Exception as e:
|
15609
|
+
logger.info(log_ % str(e))
|
15610
|
+
pass
|
15578
15611
|
|
15579
|
-
|
15580
|
-
|
15581
|
-
|
15582
|
-
|
15583
|
-
|
15584
|
-
|
15585
|
-
|
15586
|
-
|
15612
|
+
if not is_paid:
|
15613
|
+
extra_bot = None
|
15614
|
+
try:
|
15615
|
+
lib_id = channel_library_ru if lz == 'ru' else channel_library_en
|
15616
|
+
print(f"{channel_library_ru=}, {channel_library_en=}")
|
15617
|
+
extra_bot = Bot(token=BOT_TOKEN_E18B)
|
15618
|
+
member_ = await extra_bot.get_chat_member(chat_id=lib_id, user_id=chat_id)
|
15619
|
+
if member_.status in ['member', 'administrator', 'creator']: is_paid = True
|
15620
|
+
print(f"get_vars_web_main -> get_chat_member {is_paid=}")
|
15621
|
+
except Exception as e:
|
15622
|
+
logger.info(log_ % str(e))
|
15623
|
+
finally:
|
15624
|
+
if extra_bot: await extra_bot.session.close()
|
15625
|
+
# endregion
|
15587
15626
|
|
15588
|
-
|
15589
|
-
|
15590
|
-
|
15591
|
-
|
15592
|
-
|
15593
|
-
|
15594
|
-
|
15595
|
-
|
15596
|
-
|
15597
|
-
|
15598
|
-
|
15599
|
-
|
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
|
-
|
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
|
-
|
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
|
@@ -15663,7 +15680,8 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
|
|
15663
15680
|
|
15664
15681
|
sql = f"SELECT USER_TID, USER_GAMES, USER_VARS, USER_LSTS FROM {schema_name}_{tid}.USER WHERE USER_TID=$1"
|
15665
15682
|
data_user = await db_select_pg(sql, (chat_id,), BASE_P)
|
15666
|
-
|
15683
|
+
|
15684
|
+
# region data
|
15667
15685
|
if len(data_user):
|
15668
15686
|
USER_TID, USER_GAMES, USER_VARS, USER_LSTS = data_user[0]
|
15669
15687
|
USER_GAMES = json.loads(USER_GAMES)
|
@@ -15671,7 +15689,6 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
|
|
15671
15689
|
USER_LSTS = json.loads(USER_LSTS)
|
15672
15690
|
if page in ['msg', 'pst']: USER_GAMES = await ch_games(USER_GAMES, 'web', True, balls)
|
15673
15691
|
|
15674
|
-
# region lz
|
15675
15692
|
if lc:
|
15676
15693
|
USER_VARS['USER_LC'] = lc
|
15677
15694
|
lz = 'en'
|
@@ -15690,11 +15707,15 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
|
|
15690
15707
|
elif lc in ['ru', 'kz', 'kg', 'uz', 'tm', 'md', 'am', 'uk-UA', 'uk', 'kk', 'tk', 'ky']:
|
15691
15708
|
lz = 'ru'
|
15692
15709
|
USER_VARS['USER_LZ'] = lz
|
15693
|
-
|
15694
|
-
|
15710
|
+
|
15711
|
+
now = datetime.now(timezone.utc)
|
15712
|
+
USER_LSTS["USER_DAU"] = list(set(USER_LSTS.get("USER_DAU", []) + [now.strftime('%Y-%m-%d')]))
|
15713
|
+
USER_LSTS["USER_MAU"] = list(set(USER_LSTS.get("USER_MAU", []) + [now.strftime('%Y-%m')]))
|
15695
15714
|
USER_VARS['USER_SIG'] = usr_sig
|
15696
15715
|
USER_VARS['USER_ISPREMIUM'] = is_premium
|
15716
|
+
# endregion
|
15697
15717
|
|
15718
|
+
# region tx
|
15698
15719
|
if connectedAddress:
|
15699
15720
|
print(f"{connectedAddress=}, {USER_VARS=}")
|
15700
15721
|
USER_VARS['USER_WALLET'] = connectedAddress
|
@@ -15715,6 +15736,7 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
|
|
15715
15736
|
})
|
15716
15737
|
USER_LSTS["USER_TXS"] = USER_TXS
|
15717
15738
|
print(f"{USER_TXS=}, {USER_LSTS=}")
|
15739
|
+
# endregion
|
15718
15740
|
|
15719
15741
|
sql = f"""
|
15720
15742
|
INSERT INTO {schema_name}_{tid}.USER (
|
@@ -15738,37 +15760,99 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
|
|
15738
15760
|
await asyncio.sleep(round(random.uniform(0, 1), 2))
|
15739
15761
|
finally:
|
15740
15762
|
return USER_TID, username, full_name, USER_GAMES, USER_VARS, USER_LSTS
|
15763
|
+
# endregion
|
15741
15764
|
|
15742
15765
|
|
15743
|
-
|
15744
|
-
|
15745
|
-
|
15746
|
-
|
15766
|
+
# region notes
|
15767
|
+
# sys.path.append('../hub')
|
15768
|
+
# print("In module products sys.path[0], __package__ ==", sys.path[-1], __package__)
|
15769
|
+
# from .. .hub import xtra
|
15770
|
+
# dp.register_chosen_inline_handler(chosen_inline_handler_fun, lambda chosen_inline_result: True)
|
15771
|
+
# dp.register_inline_handler(inline_handler_main, lambda inline_handler_main_: True)
|
15772
|
+
# channel_post_handler
|
15773
|
+
# edited_channel_post_handler
|
15774
|
+
# poll_handler - а это получается реакция на размещение опроса
|
15775
|
+
# poll_answer_handler - реакция на голосование
|
15776
|
+
# chat_join_request_handler
|
15777
|
+
# errors_handler
|
15778
|
+
# current_state
|
15779
|
+
|
15780
|
+
# apt install redis -y
|
15781
|
+
# nano /etc/redis/redis.conf
|
15782
|
+
# systemctl restart redis.service
|
15783
|
+
# systemctl status redis
|
15784
|
+
# redis-cli
|
15785
|
+
# netstat -lnp | grep redis
|
15786
|
+
|
15787
|
+
# apt update && apt upgrade -y
|
15788
|
+
# curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
|
15789
|
+
# apt install -y nodejs build-essential nginx yarn
|
15790
|
+
# npm install -g npm pm2@latest -g
|
15791
|
+
# ufw allow 'Nginx Full'
|
15792
|
+
# curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null
|
15793
|
+
# echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | tee /etc/apt/sources.list.d/yarn.list
|
15794
|
+
# node -v
|
15795
|
+
# nginx -v
|
15796
|
+
# yarn -v
|
15797
|
+
|
15798
|
+
# systemctl restart nginx
|
15799
|
+
# systemctl reload nginx
|
15800
|
+
# snap install core; snap refresh core
|
15801
|
+
# apt remove python3-certbot-nginx certbot -y
|
15802
|
+
# rm -rf /etc/letsencrypt/renewal/
|
15803
|
+
# rm -rf /etc/letsencrypt/archive/
|
15804
|
+
# rm -rf /etc/letsencrypt/live/
|
15805
|
+
# rm -rf /opt/letsencrypt
|
15806
|
+
# rm -rf /etc/letsencrypt
|
15807
|
+
# snap install --classic certbot
|
15808
|
+
# ln -s /snap/bin/certbot /usr/bin/certbot
|
15809
|
+
# endregion
|
15810
|
+
|
15811
|
+
|
15812
|
+
# region pst
|
15813
|
+
async def ch_games(USER_GAMES, game, condition, balls=-1):
|
15747
15814
|
try:
|
15748
|
-
|
15749
|
-
|
15750
|
-
schema_name = 'BOT'
|
15751
|
-
elif PROJECT_USERNAME == 'FereyChannelBot':
|
15752
|
-
schema_name = 'CHANNEL'
|
15753
|
-
elif PROJECT_USERNAME == 'FereyGroupBot':
|
15754
|
-
schema_name = 'GROUPP'
|
15815
|
+
dt = datetime.now(timezone.utc)
|
15816
|
+
dt_ = dt.strftime('%d-%m-%Y_%H-%M-%S')
|
15755
15817
|
|
15756
|
-
|
15757
|
-
|
15758
|
-
|
15759
|
-
|
15760
|
-
|
15761
|
-
|
15762
|
-
|
15818
|
+
print(f"Текущее время: {dt_}")
|
15819
|
+
print(f"Игровые данные: {USER_GAMES}")
|
15820
|
+
print(f"Игра: {game}, Условие: {condition}, Баллы: {balls}")
|
15821
|
+
|
15822
|
+
if condition:
|
15823
|
+
# if game not in USER_GAMES:
|
15824
|
+
# USER_GAMES[game] = {'date': datetime.now(timezone.utc)}
|
15825
|
+
# dt_game = USER_GAMES[game].get('date')
|
15826
|
+
# print(f"Дата игры: {dt_game}")
|
15827
|
+
|
15828
|
+
if game not in USER_GAMES or not USER_GAMES[game].get('date', None):
|
15829
|
+
print("Нет даты, устанавливаем новую")
|
15830
|
+
USER_GAMES[game] = {'date': dt_, 'balls': balls}
|
15831
|
+
print(f"Добавлена новая игра: {USER_GAMES[game]}")
|
15832
|
+
else:
|
15833
|
+
dt_game = USER_GAMES[game].get('date')
|
15834
|
+
dt_game = datetime.strptime(dt_game, "%d-%m-%Y_%H-%M-%S").replace(tzinfo=timezone.utc)
|
15835
|
+
print(f"Дата игры в datetime: {dt_game}")
|
15836
|
+
|
15837
|
+
if (dt - dt_game).days >= 1 or balls == -1:
|
15838
|
+
print("Прошел день, обновляем данные")
|
15839
|
+
USER_GAMES[game]['date'] = dt_
|
15840
|
+
USER_GAMES[game]['balls'] = balls
|
15841
|
+
else:
|
15842
|
+
print("День не прошел, данные не меняем")
|
15763
15843
|
else:
|
15764
|
-
|
15765
|
-
USER_GAMES
|
15766
|
-
|
15844
|
+
print("Условие не выполнено, обнуляем баллы")
|
15845
|
+
if isinstance(USER_GAMES.get(game), dict):
|
15846
|
+
USER_GAMES[game]['balls'] = 0
|
15847
|
+
else:
|
15848
|
+
USER_GAMES[game] = {'date': dt_, 'balls': 0}
|
15767
15849
|
except Exception as e:
|
15768
15850
|
logger.info(log_ % str(e))
|
15851
|
+
print(f"Ошибка: {e}")
|
15769
15852
|
await asyncio.sleep(round(random.uniform(0, 1), 2))
|
15770
15853
|
finally:
|
15771
|
-
|
15854
|
+
print(f"Финальные данные: {USER_GAMES}")
|
15855
|
+
return USER_GAMES
|
15772
15856
|
|
15773
15857
|
|
15774
15858
|
async def post_save(bot, data_user, data_web, MEDIA_D, BASE_P, KEYS_JSON, PROJECT_USERNAME, PROJECT_TYPE, is_paid=False):
|
@@ -0,0 +1,8 @@
|
|
1
|
+
yeref/__init__.py,sha256=Qpv3o6Xa78VdLcsSRmctGtpnYE9btpAkCekgGhgJyXM,49
|
2
|
+
yeref/l_.py,sha256=LMX_olmJwq-tgoALJCnhV_fGrL_i_43yBLkLIcEVqGo,1176743
|
3
|
+
yeref/tonweb.js,sha256=Jf6aFOQ1OIY4q7fINYz-m5LsI3seMus124M5SYYZmtE,443659
|
4
|
+
yeref/yeref.py,sha256=ybHiJXKxGof5qMLOiqglh5zzEFHueE0zsw2Sl7CENqk,1019173
|
5
|
+
yeref-0.24.27.dist-info/METADATA,sha256=vkpsB1-YHt_HCkeRVuA_REmaroVosoom9woCHxZT4oI,119
|
6
|
+
yeref-0.24.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
+
yeref-0.24.27.dist-info/top_level.txt,sha256=yCQKchWHbfV-3OuQPYRdi2loypD-nmbDJbtt3OuKKkY,6
|
8
|
+
yeref-0.24.27.dist-info/RECORD,,
|
yeref-0.24.25.dist-info/RECORD
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
yeref/__init__.py,sha256=Qpv3o6Xa78VdLcsSRmctGtpnYE9btpAkCekgGhgJyXM,49
|
2
|
-
yeref/l_.py,sha256=LMX_olmJwq-tgoALJCnhV_fGrL_i_43yBLkLIcEVqGo,1176743
|
3
|
-
yeref/tonweb.js,sha256=Jf6aFOQ1OIY4q7fINYz-m5LsI3seMus124M5SYYZmtE,443659
|
4
|
-
yeref/yeref.py,sha256=UI1C7z9iAGyIDBoHqjeIVWBtwxAM_FePGpas8p36x1Q,1015175
|
5
|
-
yeref-0.24.25.dist-info/METADATA,sha256=vfcQeIxb8qf7ZwIMwoS0t4epoZpBQ2OzOT4STWp1Zj4,119
|
6
|
-
yeref-0.24.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
-
yeref-0.24.25.dist-info/top_level.txt,sha256=yCQKchWHbfV-3OuQPYRdi2loypD-nmbDJbtt3OuKKkY,6
|
8
|
-
yeref-0.24.25.dist-info/RECORD,,
|
File without changes
|
File without changes
|