added chat id to .doreboot file
This commit is contained in:
+2
-6
@@ -76,15 +76,11 @@ class TelegramHelper:
|
|||||||
logging.info("Received reboot command. Exiting process...")
|
logging.info("Received reboot command. Exiting process...")
|
||||||
reboot_file_path = "./.doreboot"
|
reboot_file_path = "./.doreboot"
|
||||||
if not os.path.exists(reboot_file_path):
|
if not os.path.exists(reboot_file_path):
|
||||||
open(reboot_file_path, 'w').close()
|
with open(reboot_file_path, 'w') as f:
|
||||||
|
f.write(str(update.effective_chat.id))
|
||||||
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))
|
||||||
|
|||||||
Reference in New Issue
Block a user