Python 3.x 如何通过it解决用户问题';电报机器人的名字是什么?

Python 3.x 如何通过it解决用户问题';电报机器人的名字是什么?,python-3.x,telegram,py-telegram-bot-api,Python 3.x,Telegram,Py Telegram Bot Api,我正在使用pyTelegramBotApi(telebot) 我需要的是在用户按下/启动后使用其名字欢迎用户 @bot.message_handler(commands=['start']) def start_command(message): bot.send_message( message.chat.id, 'Welcome!') 这只是发送消息欢迎,但我需要它看起来像欢迎,%first\u name%消息对象包含许多关于用户的信息; 要获得第一个_名称,请使用

我正在使用pyTelegramBotApi(telebot)

我需要的是在用户按下/启动后使用其名字欢迎用户

@bot.message_handler(commands=['start'])
def start_command(message):
    bot.send_message(
        message.chat.id, 'Welcome!')

这只是发送消息
欢迎,但我需要它看起来像
欢迎,%first\u name%

消息
对象包含许多关于用户的信息; 要获得第一个_名称,请使用<代码>消息。来自用户。名字

import telebot

bot = telebot.TeleBot("TOKEN")

@bot.message_handler(commands=['start'])
def send_welcome(message):

    bot.reply_to(message, "Hi " + message.from_user.first_name + "!")

bot.polling()
如果您对所有选项都感兴趣,最简单的方法是
print()
对象

def send_welcome(message):
    print(message.from_user)