Add telegram restart
This commit is contained in:
@@ -423,10 +423,7 @@ class FlanaBot(Connect4Bot, PenaltyBot, PollBot, ScraperBot, UberEatsBot, Weathe
|
||||
await super()._on_new_message_raw(message, whitelist_callbacks, blacklist_callbacks)
|
||||
|
||||
async def _on_ready(self):
|
||||
await super()._on_ready()
|
||||
if self._is_initialized:
|
||||
return
|
||||
|
||||
if not self._is_initialized:
|
||||
flanautils.do_every(multibot_constants.CHECK_OLD_DATABASE_MESSAGES_EVERY_SECONDS, self.check_old_database_actions)
|
||||
for chat in Chat.find({
|
||||
'platform': self.platform.value,
|
||||
@@ -444,6 +441,8 @@ class FlanaBot(Connect4Bot, PenaltyBot, PollBot, ScraperBot, UberEatsBot, Weathe
|
||||
else:
|
||||
await self.start_ubereats(chat)
|
||||
|
||||
await super()._on_ready()
|
||||
|
||||
@inline(False)
|
||||
async def _on_recover_message(self, message: Message):
|
||||
if message.replied_message and message.replied_message.author.id == self.id:
|
||||
|
||||
@@ -83,10 +83,11 @@ class FlanaTeleBot(TelegramBot, FlanaBot):
|
||||
await super()._on_new_message_raw(message, whitelist_callbacks, blacklist_callbacks)
|
||||
|
||||
async def _on_ready(self):
|
||||
await super()._on_ready()
|
||||
if not self._is_initialized:
|
||||
await self._update_whitelist()
|
||||
|
||||
await super()._on_ready()
|
||||
|
||||
# -------------------------------------------------------- #
|
||||
# -------------------- PUBLIC METHODS -------------------- #
|
||||
# -------------------------------------------------------- #
|
||||
|
||||
@@ -122,10 +122,11 @@ class PenaltyBot(MultiBot, ABC):
|
||||
await self.punish(user, message, flanautils.text_to_time(await self.filter_mention_ids(message.text, message)), message)
|
||||
|
||||
async def _on_ready(self):
|
||||
await super()._on_ready()
|
||||
if not self._is_initialized:
|
||||
flanautils.do_every(constants.CHECK_PUNISHMENTS_EVERY_SECONDS, self.check_old_punishments)
|
||||
|
||||
await super()._on_ready()
|
||||
|
||||
@bot_mentioned
|
||||
@group
|
||||
@admin(send_negative=True)
|
||||
|
||||
Reference in New Issue
Block a user