Add delay to FlanaBot._on_delete
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
__all__ = ['FlanaBot']
|
__all__ = ['FlanaBot']
|
||||||
|
|
||||||
|
import asyncio
|
||||||
import datetime
|
import datetime
|
||||||
import random
|
import random
|
||||||
from abc import ABC
|
from abc import ABC
|
||||||
@@ -170,10 +171,15 @@ class FlanaBot(Connect4Bot, PenaltyBot, PollBot, ScraperBot, WeatherBot, MultiBo
|
|||||||
@inline(False)
|
@inline(False)
|
||||||
async def _on_delete(self, message: Message):
|
async def _on_delete(self, message: Message):
|
||||||
if message.replied_message:
|
if message.replied_message:
|
||||||
if message.replied_message.author.id == self.id:
|
if (
|
||||||
await self.delete_message(message.replied_message)
|
self.is_bot_mentioned(message)
|
||||||
|
and
|
||||||
|
(message.author.is_admin or message.replied_message.author.id == self.id)
|
||||||
|
):
|
||||||
if message.chat.is_group:
|
if message.chat.is_group:
|
||||||
await self.delete_message(message)
|
await self.delete_message(message)
|
||||||
|
await asyncio.sleep(flanautils.text_to_time(message.text).total_seconds())
|
||||||
|
await self.delete_message(message.replied_message)
|
||||||
elif message.chat.is_group and self.is_bot_mentioned(message):
|
elif message.chat.is_group and self.is_bot_mentioned(message):
|
||||||
await self.send_negative(message)
|
await self.send_negative(message)
|
||||||
elif (
|
elif (
|
||||||
|
|||||||
Reference in New Issue
Block a user