Fix bot used to delete some messages

This commit is contained in:
AlberLC
2022-07-14 20:08:50 +02:00
parent db9ccbf81a
commit 4ecf847686

View File

@@ -453,6 +453,14 @@ class FlanaBot(MultiBot, ABC):
( (
message.author.id != self.owner_id message.author.id != self.owner_id
and and
(
not message.replied_message
or
message.replied_message.author.id != self.id
or
not message.replied_message.contents.get('media')
)
and
( (
self.is_bot_mentioned(message) self.is_bot_mentioned(message)
or or
@@ -674,6 +682,15 @@ class FlanaBot(MultiBot, ABC):
@bot_mentioned @bot_mentioned
@admin(send_negative=True) @admin(send_negative=True)
async def _on_unpunish(self, message: Message): async def _on_unpunish(self, message: Message):
if (
message.replied_message
and
message.replied_message.author.id == self.id
and
message.replied_message.contents.get('media')
):
return
for user in await self._find_users_to_punish(message): for user in await self._find_users_to_punish(message):
await self.unpunish(user, message, message) await self.unpunish(user, message, message)