async def monito_p_m_s(event): sender = await event.get_sender() current_message_text = event.message.message.lower() if current_message_text == BAALAJI_TG_USER_BOT or \ current_message_text == TG_COMPANION_USER_BOT or \ current_message_text == UNIBORG_USER_BOT_NO_WARN: # userbot's should not reply to other userbot's # https://core.telegram.org/bots/faq#why-doesn-39t-my-bot-see-messages-from-other-bots return False if Config.NO_P_M_SPAM and not sender.bot: chat = await event.get_chat() if not is_approved(chat.id) and chat.id != borg.uid: logger.info(chat.stringify()) logger.info(borg.storage.PM_WARNS) if chat.id in SUDO_USERS: await event.edit("Oh wait, that looks like my master!") await event.edit("Approving..") approve(chat.id, "SUDO_USER") if chat.id not in borg.storage.PM_WARNS: borg.storage.PM_WARNS.update({chat.id: 0}) if borg.storage.PM_WARNS[chat.id] == Config.MAX_FLOOD_IN_P_M_s: r = await event.reply(UNIBORG_USER_BOT_WARN_ZERO) await asyncio.sleep(3) await borg(functions.contacts.BlockRequest(chat.id)) if chat.id in borg.storage.PREV_REPLY_MESSAGE: await borg.storage.PREV_REPLY_MESSAGE[chat.id].delete() borg.storage.PREV_REPLY_MESSAGE[chat.id] = r return r = await event.reply(UNIBORG_USER_BOT_NO_WARN) borg.storage.PM_WARNS[chat.id] += 1 if chat.id in borg.storage.PREV_REPLY_MESSAGE: await borg.storage.PREV_REPLY_MESSAGE[chat.id].delete() borg.storage.PREV_REPLY_MESSAGE[chat.id] = r
async def monito_p_m_s(event): sender = await event.get_sender() current_message_text = event.message.message.lower() PREVIOUS_MSG = current_message_text if Config.NO_P_M_SPAM and not sender.bot: chat = await event.get_chat() if not is_approved(chat.id) and chat.id != borg.uid: logger.info(chat.stringify()) logger.info(borg.storage.PM_WARNS) if chat.id in SUDO_USERS: print("Welcome Master.") approve(chat.id, "SUDO USER") return if chat.id not in borg.storage.PM_WARNS: borg.storage.PM_WARNS.update({chat.id: 0}) if borg.storage.PM_WARNS[chat.id] == Config.MAX_FLOOD_IN_P_M_s: r = await event.reply(UNIBORG_USER_BOT_WARN_ZERO) await asyncio.sleep(3) await borg(functions.contacts.BlockRequest(chat.id)) if chat.id in borg.storage.PREV_REPLY_MESSAGE: await borg.storage.PREV_REPLY_MESSAGE[chat.id].delete() borg.storage.PREV_REPLY_MESSAGE[chat.id] = r return if borg.storage.PM_WARNS[chat.id] < 2: r = await event.reply(UNIBORG_USER_BOT_NO_WARN) if chat.id in borg.storage.PREV_REPLY_MESSAGE: await borg.storage.PREV_REPLY_MESSAGE[chat.id].delete() borg.storage.PREV_REPLY_MESSAGE[chat.id] = r borg.storage.PM_WARNS[chat.id] += 1
async def approve_p_m(event): if event.fwd_from: return reason = event.pattern_match.group(1) chat = await event.get_chat() if Config.NO_P_M_SPAM: if event.is_private: if not is_approved(chat.id): if chat.id in borg.storage.PM_WARNS: del borg.storage.PM_WARNS[chat.id] approve(chat.id, reason) await event.edit("Private Message Accepted") await asyncio.sleep(3) await event.delete()
async def approve_p_m(event): if event.fwd_from: return reason = event.pattern_match.group(1) chat = await event.get_chat() if Config.NO_P_M_SPAM: if event.is_private: if not is_approved(chat.id): if chat.id in borg.storage.PM_WARNS: del borg.storage.PM_WARNS[chat.id] if chat.id in borg.storage.PREV_REPLY_MESSAGE: await borg.storage.PREV_REPLY_MESSAGE[chat.id].delete() del borg.storage.PREV_REPLY_MESSAGE[chat.id] approve(chat.id, reason) await event.edit( f"I have allowed [you](tg://user?id={chat.id}) to PM me.")
async def approve_p_m(event): if event.fwd_from: return reason = event.pattern_match.group(1) chat = await event.get_chat() if Config.NO_P_M_SPAM: if event.is_private: if not is_approved(chat.id): if chat.id in borg.storage.PM_WARNS: del borg.storage.PM_WARNS[chat.id] if chat.id in borg.storage.PREV_REPLY_MESSAGE: await borg.storage.PREV_REPLY_MESSAGE[chat.id].delete() del borg.storage.PREV_REPLY_MESSAGE[chat.id] approve(chat.id, reason) await event.edit("[──███▅▄▄▄▄▄▄▄▄▄\n─██▐████████████\n▐█▀████████████▌▌\n▐─▀▀▀▐█▌▀▀███▀█─▌\n▐▄───▄█───▄█▌▄█](t.me/iamomkarofficial) \n\n My Master Has Approved You To PM Me...") await asyncio.sleep(3) await event.delete()
async def approve_p_m(event): if event.fwd_from: return reason = event.pattern_match.group(1) chat = await event.get_chat() if Config.PM_LOGGR_BOT_API_ID is not None: if event.is_private: if not pmpermit_sql.is_approved(chat.id): if chat.id in PM_WARNS: del PM_WARNS[chat.id] if chat.id in PREV_REPLY_MESSAGE: await PREV_REPLY_MESSAGE[chat.id].delete() del PREV_REPLY_MESSAGE[chat.id] pmpermit_sql.approve(chat.id, reason) await event.edit("Private Message Accepted") await asyncio.sleep(3) await event.delete()
async def approve_p_m(event): if event.fwd_from: return reason = event.pattern_match.group(1) chat = await event.get_chat() if Config.PM_LOGGR_BOT_API_ID is not None: if event.is_private: if not pmpermit_sql.is_approved(chat.id): if chat.id in PM_WARNS: del PM_WARNS[chat.id] if chat.id in PREV_REPLY_MESSAGE: await PREV_REPLY_MESSAGE[chat.id].delete() del PREV_REPLY_MESSAGE[chat.id] pmpermit_sql.approve(chat.id, reason) await event.edit( "[──███▅▄▄▄▄▄▄▄▄▄\n─██▐████████████\n▐█▀████████████▌▌\n▐─▀▀▀▐█▌▀▀███▀█─▌\n▐▄───▄█───▄█▌▄█](t.me/AyushChatterjee) \n\n My Master Has Approved You To PM him..." )
async def approve_p_m(event): if event.fwd_from: return reason = event.pattern_match.group(1) chat = await event.get_chat() if Config.NO_P_M_SPAM: if event.is_private: if not is_approved(chat.id): if chat.id in borg.storage.PM_WARNS: del borg.storage.PM_WARNS[chat.id] if chat.id in borg.storage.PREV_REPLY_MESSAGE: await borg.storage.PREV_REPLY_MESSAGE[chat.id].delete() del borg.storage.PREV_REPLY_MESSAGE[chat.id] approve(chat.id, reason) await event.reply("Haye, I'm **αℓℓυкα Zᴏʟᴅʏᴄᴋ™** 👨🏻💻\nTo get more info about me `.info` and for help `.help`") await asyncio.sleep(3) await event.delete()
async def approve_p_m(event): if event.fwd_from: return reason = event.pattern_match.group(1) chat = await event.get_chat() if Config.NO_P_M_SPAM: if event.is_private: if not is_approved(chat.id): if chat.id in borg.storage.PM_WARNS: del borg.storage.PM_WARNS[chat.id] if chat.id in borg.storage.PREV_REPLY_MESSAGE: await borg.storage.PREV_REPLY_MESSAGE[chat.id].delete() del borg.storage.PREV_REPLY_MESSAGE[chat.id] approve(chat.id, reason) await event.edit("`This bitch can msg you Now!`") await asyncio.sleep(3) await event.delete()
async def approve_p_m(event): if event.fwd_from: return reason = event.pattern_match.group(1) chat = await event.get_chat() if Config.NO_P_M_SPAM: if event.is_private: if not is_approved(chat.id): if chat.id in borg.storage.PM_WARNS: del borg.storage.PM_WARNS[chat.id] if chat.id in borg.storage.PREV_REPLY_MESSAGE: await borg.storage.PREV_REPLY_MESSAGE[chat.id].delete() del borg.storage.PREV_REPLY_MESSAGE[chat.id] approve(chat.id, reason) await event.edit("Private Message Accepted Don’t Show Me Attitude 😒") await asyncio.sleep(3) await event.delete()
async def approve_p_m(event): if event.fwd_from: return global PM_WARNS global PREV_REPLY_MESSAGE reason = event.pattern_match.group(1) chat = await event.get_chat() if Config.NO_P_M_SPAM: if event.is_private: if not is_approved(chat.id): if chat.id in PM_WARNS: del PM_WARNS[chat.id] if chat.id in PREV_REPLY_MESSAGE: await PREV_REPLY_MESSAGE[chat.id].delete() del PREV_REPLY_MESSAGE[chat.id] approve(chat.id, reason) await event.edit("Private Message Accepted") await asyncio.sleep(3) await event.delete()
async def approve_p_m(event): if event.fwd_from: return reason = event.pattern_match.group(1) chat = await event.get_chat() if Config.NO_P_M_SPAM: if event.is_private: if not is_approved(chat.id): if chat.id in borg.storage.PM_WARNS: del borg.storage.PM_WARNS[chat.id] if chat.id in borg.storage.PREV_REPLY_MESSAGE: await borg.storage.PREV_REPLY_MESSAGE[chat.id].delete() del borg.storage.PREV_REPLY_MESSAGE[chat.id] approve(chat.id, reason) await event.edit( "IT: Bene. Hai ricevuto il permesso di messaggiare con il mio Capo!\n\nEN: Well. You have received permission to send messages with my Leader!" ) await asyncio.sleep(3) await event.delete()
async def approve_p_m(event): if event.fwd_from: return reason = event.pattern_match.group(1) chat = await event.get_chat() if Config.NO_P_M_SPAM: if event.is_private: if not is_approved(chat.id): if chat.id in borg.storage.PM_WARNS: del borg.storage.PM_WARNS[chat.id] if chat.id in borg.storage.PREV_REPLY_MESSAGE: await borg.storage.PREV_REPLY_MESSAGE[chat.id].delete() del borg.storage.PREV_REPLY_MESSAGE[chat.id] approve(chat.id, reason) await event.edit( "Private Message Accepted Now You can Talk to me ... #Dil bda hai na mera" ) await asyncio.sleep(10) await event.delete()
async def approve_p_m(event): if event.fwd_from: return global replied_user replied_user = await event.client(GetFullUserRequest(event.chat_id)) firstname = replied_user.user.first_name reason = event.pattern_match.group(1) chat = await event.get_chat() if Config.PM_LOGGR_BOT_API_ID is not None: if event.is_private: if not pmpermit_sql.is_approved(chat.id): if chat.id in PM_WARNS: del PM_WARNS[chat.id] if chat.id in PREV_REPLY_MESSAGE: await PREV_REPLY_MESSAGE[chat.id].delete() del PREV_REPLY_MESSAGE[chat.id] pmpermit_sql.approve(chat.id, reason) await event.edit("Approved User [{}](tg://user?id={})".format( firstname, chat.id))
async def approve_p_m(event): if event.fwd_from: return reason = event.pattern_match.group(1) chat = await event.get_chat() if Config.NO_P_M_SPAM: if event.is_private: if not is_approved(chat.id): if chat.id in borg.storage.PM_WARNS: del borg.storage.PM_WARNS[chat.id] if chat.id in borg.storage.PREV_REPLY_MESSAGE: await borg.storage.PREV_REPLY_MESSAGE[chat.id].delete() del borg.storage.PREV_REPLY_MESSAGE[chat.id] approve(chat.id, reason) await event.edit("Private Message Accepted") await asyncio.sleep(3) await event.delete() else: print("Can not use pmpermit in GROUP") else: print("NO_P_M__SPAM not configured")