From 218f70f541ecf74e00ba09739ed73f674a9bca2b Mon Sep 17 00:00:00 2001 From: Rripped Date: Tue, 29 Mar 2022 08:31:58 +0200 Subject: [PATCH] added status function --- telegram_bot/bot.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/telegram_bot/bot.py b/telegram_bot/bot.py index c62083f..5fc363f 100644 --- a/telegram_bot/bot.py +++ b/telegram_bot/bot.py @@ -154,6 +154,21 @@ def send_id(message): bot.reply_to(message, answer) +#function that sends telegram status(running or offline) as message from telegram bot to user +@bot.message_handler(commands=['status']) +def send_status(message): + + """ Sends status to user + :type message: message object bot + :param message: message that was reacted to, if no other command handler gets called + + :raises: none + + :rtype: none + """ + bot.reply_to(message, "bot is running") + + @bot.message_handler(commands=['update']) def send_update(message): @@ -306,9 +321,6 @@ def main_loop(): :rtype: none """ bot.infinity_polling() - while 1: - time.sleep(3) - if __name__ == '__main__': try: