From f21ca0fe92d29974072221f03adbd79302ab6f76 Mon Sep 17 00:00:00 2001 From: Pin Lin Date: Sun, 6 May 2018 16:21:35 +0800 Subject: [PATCH] edit debug messages --- bot.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/bot.py b/bot.py index 8d5686f..75b5b93 100644 --- a/bot.py +++ b/bot.py @@ -318,14 +318,6 @@ def on_chat(msg): content_type, chat_type, chat_id = telepot.glance(msg) from_id = msg['from']['id'] - # debug message - pprint(msg) - print('content_type:', content_type) - print('chat_type:', chat_type) - print('chat_id:', chat_id) - print('from_id:', from_id) - print() - # create a user object user = Kuser(from_id) if str(from_id) in users: @@ -333,8 +325,19 @@ def on_chat(msg): else: users[str(from_id)] = user - # just want to know - print('student_id:', user._username) + # debug message + # ========================================================== + pprint(msg) + # name + if 'last_name' in msg['from']: + last_name = msg['from']['last_name'] + else: + last_name = '' + print("😊 student_name:", msg['from']['first_name'], last_name, "😊") + # id + print("😯 student_id:", user._username, "😯") + print() + # ========================================================== if content_type == 'text': # pre-treat the command