Add check for .doreboot file to send reboot complete message and delete the file.

This commit is contained in:
2024-08-20 13:12:54 -05:00
parent 5c594c2223
commit a27e73dd89
+5 -1
View File
@@ -80,6 +80,11 @@ class TelegramHelper:
sys.exit(0) sys.exit(0)
def run(self): def run(self):
if os.path.exists("./.doreboot"):
# Assuming `send_message_to_user` is a method or function available in the bot context.
await self.bot.send_message_to_user("Reboot Complete")
os.remove("./.doreboot")
application = Application.builder().token(self.telegram_bot_token).build() application = Application.builder().token(self.telegram_bot_token).build()
application.add_handler(CommandHandler("start", self.start)) application.add_handler(CommandHandler("start", self.start))
@@ -92,4 +97,3 @@ class TelegramHelper:
logging.info("Bot is running...") logging.info("Bot is running...")
application.run_polling() application.run_polling()