async def pmpermit_cq(_, cq): user_id = cq.from_user.id data, victim = ( cq.data.split(None, 2)[1], cq.data.split(None, 2)[2], ) if data == "approve": if user_id != USERBOT_ID: return await cq.answer("This Button Is Not For You") await approve_pmpermit(int(victim)) return await app.edit_inline_text( cq.inline_message_id, "User Has Been Approved To PM." ) if data == "block": if user_id != USERBOT_ID: return await cq.answer("This Button Is Not For You") await cq.answer() await app.edit_inline_text( cq.inline_message_id, "Successfully blocked the user." ) await app2.block_user(int(victim)) return await app2.send( DeleteHistory( peer=(await app2.resolve_peer(victim)), max_id=0, revoke=False, ) ) if user_id == USERBOT_ID: return await cq.answer("It's For The Other Person.") if data == "to_scam_you": async for m in app2.iter_history(user_id, limit=6): if m.reply_markup: await m.delete() await app2.send_message( user_id, "Blocked, Go scam someone else." ) await app2.block_user(user_id) await cq.answer() elif data == "approve_me": await cq.answer() if str(user_id) in flood2: flood2[str(user_id)] += 1 else: flood2[str(user_id)] = 1 if flood2[str(user_id)] > 5: await app2.send_message( user_id, "SPAM DETECTED, USER BLOCKED." ) return await app2.block_user(user_id) await app2.send_message( user_id, "I'm busy right now, will approve you shortly, DO NOT SPAM.", )
async def clear_chat(self) -> None: """ Deletes all messages in the conversation with the assigned `peer`. !!! warning Be careful as this will completely drop your mutual message history. """ await self._ensure_preconditions() await self.client.send( DeleteHistory(peer=self._input_peer, max_id=0, just_clear=False) )
async def clear_chat(self) -> None: await self.client.send(DeleteHistory(peer=self.peer, max_id=0, just_clear=False))