Skip to content

Python code snippet – How to get chat first name in telebot?

@bot.message_handler(func=lambda message: True)
def send_message(message:str):

user_first_name = str(message.chat.first_name)
bot.reply_to(message, 'Hi ' + user_frist_name)

# Result: Hi Saeed
See also  How to check current version of library in Python?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.