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)
|
await super()._on_new_message_raw(message, whitelist_callbacks, blacklist_callbacks)
|
||||||
|
|
||||||
async def _on_ready(self):
|
async def _on_ready(self):
|
||||||
await super()._on_ready()
|
if not self._is_initialized:
|
||||||
if self._is_initialized:
|
|
||||||
return
|
|
||||||
|
|
||||||
flanautils.do_every(multibot_constants.CHECK_OLD_DATABASE_MESSAGES_EVERY_SECONDS, self.check_old_database_actions)
|
flanautils.do_every(multibot_constants.CHECK_OLD_DATABASE_MESSAGES_EVERY_SECONDS, self.check_old_database_actions)
|
||||||
for chat in Chat.find({
|
for chat in Chat.find({
|
||||||
'platform': self.platform.value,
|
'platform': self.platform.value,
|
||||||
@@ -444,6 +441,8 @@ class FlanaBot(Connect4Bot, PenaltyBot, PollBot, ScraperBot, UberEatsBot, Weathe
|
|||||||
else:
|
else:
|
||||||
await self.start_ubereats(chat)
|
await self.start_ubereats(chat)
|
||||||
|
|
||||||
|
await super()._on_ready()
|
||||||
|
|
||||||
@inline(False)
|
@inline(False)
|
||||||
async def _on_recover_message(self, message: Message):
|
async def _on_recover_message(self, message: Message):
|
||||||
if message.replied_message and message.replied_message.author.id == self.id:
|
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)
|
await super()._on_new_message_raw(message, whitelist_callbacks, blacklist_callbacks)
|
||||||
|
|
||||||
async def _on_ready(self):
|
async def _on_ready(self):
|
||||||
await super()._on_ready()
|
|
||||||
if not self._is_initialized:
|
if not self._is_initialized:
|
||||||
await self._update_whitelist()
|
await self._update_whitelist()
|
||||||
|
|
||||||
|
await super()._on_ready()
|
||||||
|
|
||||||
# -------------------------------------------------------- #
|
# -------------------------------------------------------- #
|
||||||
# -------------------- PUBLIC METHODS -------------------- #
|
# -------------------- 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)
|
await self.punish(user, message, flanautils.text_to_time(await self.filter_mention_ids(message.text, message)), message)
|
||||||
|
|
||||||
async def _on_ready(self):
|
async def _on_ready(self):
|
||||||
await super()._on_ready()
|
|
||||||
if not self._is_initialized:
|
if not self._is_initialized:
|
||||||
flanautils.do_every(constants.CHECK_PUNISHMENTS_EVERY_SECONDS, self.check_old_punishments)
|
flanautils.do_every(constants.CHECK_PUNISHMENTS_EVERY_SECONDS, self.check_old_punishments)
|
||||||
|
|
||||||
|
await super()._on_ready()
|
||||||
|
|
||||||
@bot_mentioned
|
@bot_mentioned
|
||||||
@group
|
@group
|
||||||
@admin(send_negative=True)
|
@admin(send_negative=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user