mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Check if field is None
A slight change, still not very good though. Something like `{!s}{!s}{!s}.format(....)` seems a better aproach
This commit is contained in:
parent
4526c4f8a7
commit
b1e659da28
@ -42,10 +42,10 @@ def on_user_joins(message):
|
|||||||
return
|
return
|
||||||
|
|
||||||
name = message.new_chat_participant.first_name
|
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)
|
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)
|
name += u" (@{})".format(message.new_chat_participant.username)
|
||||||
|
|
||||||
bot.reply_to(message, text_messages['welcome'].format(name=name))
|
bot.reply_to(message, text_messages['welcome'].format(name=name))
|
||||||
|
Loading…
Reference in New Issue
Block a user