Php 如果用户发送命令,则电报机器人回复chatid
我想制作一个电报机器人,如果我的用户发送命令/myid,它可以回复/返回chatid。我该怎么办Php 如果用户发送命令,则电报机器人回复chatid,php,telegram,telegram-bot,Php,Telegram,Telegram Bot,我想制作一个电报机器人,如果我的用户发送命令/myid,它可以回复/返回chatid。我该怎么办 提前谢谢 创建一个命令处理程序,从负载中获取聊天室id,并将其作为响应发送回 dp.add_handler(CommandHandler("myid", myid_command_handler)) def myid_command_handler(update, context): """Send back the chat_id"&
提前谢谢 创建一个命令处理程序,从负载中获取聊天室id,并将其作为响应发送回
dp.add_handler(CommandHandler("myid", myid_command_handler))
def myid_command_handler(update, context):
"""Send back the chat_id"""
chat_id = update.message.chat.id
update.message.reply_text('Here it is: ' + str(chat_id))