diff --git a/tgbot/handlers/command_ask.py b/tgbot/handlers/command_ask.py index d3d28fa..a288d6a 100644 --- a/tgbot/handlers/command_ask.py +++ b/tgbot/handlers/command_ask.py @@ -9,6 +9,9 @@ def handle_command_ask(msg): r = get_member(chat_id, member_id) print(r) m = {} - m['from'] = r['result']['user'] - m['chat'] = { 'id': chat_id } - show_request_msg(m) \ No newline at end of file + if 'result' in r: + m['from'] = r['result']['user'] + m['chat'] = { 'id': str(chat_id) } + show_request_msg(m) + elif 'error_code' in r: + print(r) \ No newline at end of file diff --git a/tgbot/handlers/command_my.py b/tgbot/handlers/command_my.py index 8dc1c17..57a62ea 100644 --- a/tgbot/handlers/command_my.py +++ b/tgbot/handlers/command_my.py @@ -1,5 +1,5 @@ from tgbot.storage import Profile, scan -from tgbot.api import get_member, send_message +from tgbot.api import get_member, send_message, get_chat_administrators from tgbot.utils.mention import userdata_extract diff --git a/tgbot/handlers/send_button.py b/tgbot/handlers/send_button.py index 3866f8d..73b5d41 100644 --- a/tgbot/handlers/send_button.py +++ b/tgbot/handlers/send_button.py @@ -33,7 +33,7 @@ def show_request_msg(msg): ) else: print('show button without photo') - r = send_photo( + r = send_message( chat_id, newcomer_message + mention(msg['from']), reply_to=msg.get('message_id', ''),