1212logger = logging .getLogger ('bot' )
1313
1414
15- def start (bot , update ):
15+ def command_start (bot , update ):
1616 logger .info ('Received command /start' )
1717 bot .send_message (chat_id = update .message .chat_id , text = config .BOT_GREETING )
1818
1919
20- def help (bot , update ):
20+ def command_help (bot , update ):
2121 logger .info ('Received command /help' )
2222 bot .send_message (
2323 chat_id = update .message .chat_id ,
@@ -28,6 +28,14 @@ def help(bot, update):
2828 )
2929
3030
31+ def command_status (bot , update ):
32+ logger .info ('bot asked to execute /status commamd' )
33+ bot .send_message (
34+ chat_id = update .message .chat_id ,
35+ text = f'Status is OK, running since { utils .since ()} ' ,
36+ )
37+
38+
3139def welcome (bot : Bot , update : Update ):
3240 logger .info ('Received new user event' )
3341 new_member = update .message .new_chat_members [0 ]
@@ -69,14 +77,6 @@ def reply(bot, update):
6977 )
7078
7179
72- def status (bot , update ):
73- logger .info ('bot asked to execute /status commamd' )
74- bot .send_message (
75- chat_id = update .message .chat_id ,
76- text = f'Status is OK, running since { utils .since ()} ' ,
77- )
78-
79-
8080def main ():
8181 logging .basicConfig (
8282 level = config .LOG_LEVEL ,
@@ -88,9 +88,9 @@ def main():
8888 updater = Updater (config .TELEGRAM_BOT_TOKEN )
8989 dp = updater .dispatcher
9090
91- dp .add_handler (CommandHandler ('start' , start ))
92- dp .add_handler (CommandHandler ('help' , help ))
93- dp .add_handler (CommandHandler ('status' , status ))
91+ dp .add_handler (CommandHandler ('start' , command_start ))
92+ dp .add_handler (CommandHandler ('help' , command_help ))
93+ dp .add_handler (CommandHandler ('status' , command_status ))
9494 dp .add_handler (MessageHandler (Filters .status_update .new_chat_members , welcome ))
9595 dp .add_handler (MessageHandler (Filters .group , reply ))
9696
0 commit comments