1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Merge pull request #67 from Kondra007/patch-1

Check if field is None
This commit is contained in:
Pieter 2015-09-03 17:40:34 +02:00
commit f2f556ed12

View File

@ -42,10 +42,10 @@ def on_user_joins(message):
return
name = message.new_chat_participant.first_name
if hasattr(message.new_chat_participant, 'last_name'):
if hasattr(message.new_chat_participant, 'last_name') and message.new_chat_participant.last_name is not None:
name += u" {}".format(message.new_chat_participant.last_name)
if hasattr(message.new_chat_participant, 'username'):
if hasattr(message.new_chat_participant, 'username') and message.new_chat_participant.username is not None:
name += u" (@{})".format(message.new_chat_participant.username)
bot.reply_to(message, text_messages['welcome'].format(name=name))