async def reportcmd(self, message): """Report the user spam. Use only in PM""" old = self._db.get(__name__, "allow", []) try: old.remove(getattr(message.to_id, "user_id", None)) self._db.set(__name__, "allow", old) except ValueError: pass if message.is_reply: # Report the message await message.client(functions.messages.ReportRequest(peer=await message.client .get_input_entity(message.to_id), ids=[message.reply_to_msg_id], reason=types.InputReportReasonSpam())) else: await message.client(functions.account.ReportPeerRequest(peer=await message.client .get_input_entity(message.to_id), reason=types.InputReportReasonSpam())) await message.edit("<code>You just got reported spam!</code>")
async def reportcmd(self, message): """Report the user to spam. Use only in PM.\n """ user = await utils.get_target(message) if not user: await utils.answer(message, self.strings["who_to_report"]) return self._db.set(__name__, "allow", list(set(self._db.get(__name__, "allow", [])).difference({user}))) if message.is_reply and isinstance(message.to_id, types.PeerChannel): await message.client(functions.messages.ReportRequest(peer=message.chat_id, id=[message.reply_to_msg_id], reason=types.InputReportReasonSpam())) else: await message.client(functions.messages.ReportSpamRequest(peer=message.to_id)) await utils.answer(message, self.strings["pm_reported"])
async def reportcmd(self, message): """Сообщить о спаме пользователя. Используйте только в личных сообщениях.""" user = await utils.get_target(message) if not user: await utils.answer(message, self.strings("who_to_report", message)) return self._db.set(__name__, "allow", list(set(self._db.get(__name__, "allow", [])).difference({user}))) if message.is_reply and isinstance(message.to_id, types.PeerChannel): # Report the message await message.client(functions.messages.ReportRequest(peer=message.chat_id, id=[message.reply_to_msg_id], reason=types.InputReportReasonSpam())) else: await message.client(functions.messages.ReportSpamRequest(peer=message.to_id)) await utils.answer(message, self.strings("reported", message))
async def reportcmd(self, message): """Report the user spam. Use only in PM""" user = await utils.get_target(message) if not user: await message.edit(_("<code>Who shall I report?</code>")) return self._db.set("NoPMMod", "allow", list(set(self._db.get("NoPMMod", "allow", [])).difference({user}))) if message.is_reply and isinstance(message.to_id, types.PeerChannel): # Report the message await message.client(functions.messages.ReportRequest(peer=message.chat_id, id=[message.reply_to_msg_id], reason=types.InputReportReasonSpam())) else: await message.client(functions.messages.ReportSpamRequest(peer=message.to_id)) await message.edit("<code>You just got reported spam!</code>")