async def get_note_with_command(message, note_name): note_d = sql.get_note(message.chat.id, note_name) if not note_d: return note_message_id = note_d.d_message_id note_message = await message._client.get_messages( chat_id=TG_URI, message_ids=note_message_id, replies=0) n_m = message if message.reply_to_message: n_m = message.reply_to_message # 🥺 check two conditions 🤔🤔 if note_message.media: _, file_id = get_file_id(note_message) caption = note_message.caption if caption: caption = caption.html await n_m.reply_cached_media(file_id=file_id, caption=caption, parse_mode="html", reply_markup=note_message.reply_markup) else: caption = note_message.text if caption: caption = caption.html disable_web_page_preview = True if "gra.ph" in caption or "youtu" in caption: disable_web_page_preview = False await n_m.reply_text(text=caption, disable_web_page_preview=disable_web_page_preview, parse_mode="html", reply_markup=note_message.reply_markup)
async def get_note_with_command(message, note_name): note_d = sql.get_note(message.chat.id, note_name) note_message_id = note_d.d_message_id note_message = await message._client.get_messages( chat_id=TG_URI, message_ids=note_message_id, replies=0 ) n_m = message if message.reply_to_message: n_m = message.reply_to_message # 🥺 check two conditions 🤔🤔 if note_message.media: _, file_id = get_file_id(note_message) await n_m.reply_cached_media( file_id=file_id, caption=note_message.caption.html, parse_mode="html", reply_markup=note_message.reply_markup ) else: disable_web_page_preview = True await n_m.reply_text( text=note_message.text.html, disable_web_page_preview=disable_web_page_preview, parse_mode="html", reply_markup=note_message.reply_markup )
async def watch_all_messages(client: PyroBot, message: Message): to_match = message.text or message.caption or "" flt_list = client.filterstore.get(str(message.chat.id), []) for flt in flt_list: pattern = r"( |^|[^\w])" + re.escape(flt) + r"( |$|[^\w])" if re.search(pattern, to_match, flags=re.IGNORECASE): flt_message = await client.get_messages(chat_id=TG_URI, message_ids=flt_list[flt], replies=0) n_m = message if message.reply_to_message: n_m = message.reply_to_message # 🥺 check two conditions 🤔🤔 if flt_message.media: _, file_id = get_file_id(flt_message) caption = flt_message.caption if caption: caption = caption.html if not caption: caption = "" await n_m.reply_cached_media( file_id=file_id, caption=caption, parse_mode="html", reply_markup=flt_message.reply_markup, ) else: caption = flt_message.text if caption: caption = caption.html if not caption: caption = "" disable_web_page_preview = True if "gra.ph" in caption or "youtu" in caption: disable_web_page_preview = False await n_m.reply_text( text=caption, disable_web_page_preview=disable_web_page_preview, parse_mode="html", reply_markup=flt_message.reply_markup, ) break
async def get_note_with_command(message): note_d = sql.get_current_welcome_settings(message.chat.id) if not note_d: return # note_message_id = int(note_d.f_mesg_id) note_message = await message._client.get_messages( chat_id=TG_URI, message_ids=note_message_id, replies=0) n_m = message # 🥺 check two conditions 🤔🤔 for c_m in message.new_chat_members: if note_d.should_clean_welcome: await delete_prev_welcome(message, int(note_d.previous_welcome)) if note_message.media: _, file_id = get_file_id(note_message) caption = note_message.caption if caption: caption = format_welcome_caption(caption.html, c_m) n_m = await n_m.reply_cached_media( file_id=file_id, caption=caption, parse_mode="html", reply_markup=note_message.reply_markup, ) else: caption = note_message.text if caption: caption = format_welcome_caption(caption.html, c_m) disable_web_page_preview = True if "gra.ph" in caption or "youtu" in caption: disable_web_page_preview = False n_m = await n_m.reply_text( text=caption, disable_web_page_preview=disable_web_page_preview, parse_mode="html", reply_markup=note_message.reply_markup, ) # sql.update_previous_welcome(message.chat.id, n_m.message_id)