diff --git a/misc_beta_bot.py b/misc_beta_bot.py index 9b5f90d..10cd166 100644 --- a/misc_beta_bot.py +++ b/misc_beta_bot.py @@ -291,6 +291,40 @@ async def cmd_myzh (message: types.Message): print(f"localhost SELECT:{Err}") await message.answer(msg, parse_mode=types.ParseMode.HTML) +@dp.message_handler(commands=['ends']) +async def cmd_ends (message: types.Message): + msg="🤷" + user_id = int(message.from_user.id) + user_fn = message.from_user.first_name or '' + lng_code = message.from_user.language_code or '' + when_int = int(datetime.timestamp(message.date)) + rd=int(await reg_user(message))#create or date + if db_pymysql: + try: + #зберігалка: https://github.com/S1S13AF7/ub4tg (адреса може змінитись) + dbc.execute(f"SELECT user_id,bio_str,expr_str FROM `tg_iris_zarazy` WHERE who_id = {user_id} AND expr_int < {when_int} ORDER BY `bio_int` DESC LIMIT 10;")# % int(user_id),int(when_int)); + bz_info = dbc.fetchmany(10)#получить + all_sicknes=[]#інфа + count=len(bz_info) + who=f"🦠 {user_fn}:" + for row in bz_info: + print(row) + id_user=row["user_id"] + bio_str=row["bio_str"] + u_link =f'tg://openmessage?user_id={id_user}' #fix для любителів мінять його + expr_str=re.sub(r'.20', r'.',row["expr_str"]) #.2024->.24 + a_href = f'@{id_user}' + all_sicknes.append(f"➕{bio_str} {a_href}#{expr_str}\n") + if len(all_sicknes)!=0: + all_sicknes=f'{who}\n{"".join(all_sicknes)}' + else: + all_sicknes='🤷 інфа нема.' + msg=all_sicknes + except Exception as Err: + msg = Err + print(f"localhost SELECT:{Err}") + await message.answer(msg, parse_mode=types.ParseMode.HTML) + @dp.message_handler(commands=['help']) async def process_help_command(message: types.Message): #await message.answer(emoji="🤷")