Telegeram Bot中的msg.chat.id和msg.from.id有什么区别? [英] What is Difference between `msg.chat.id` and `msg.from.id` in Telegeram Bot?

查看:319
本文介绍了Telegeram Bot中的msg.chat.id和msg.from.id有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Telegeram Bot中的msg.chat.idmsg.from.id有什么区别? 显然,两者相同,并且返回用户ID.

What is Difference between msg.chat.id and msg.from.id in Telegeram Bot? Apparently, both are the same and Return user id.

bot.sendMessage(msg.chat.id, 'Hi', opts)

bot.sendMessage(msg.from.id, 'Hi', opts)

推荐答案

chatId 是聊天的唯一标识符,可以是privategroupsupergroupchannel,而 userId 是仅用于用户或漫游器的唯一标识符.

a chatId is a unique identifier for a chat, that can be either private, group, supergroup or channel whereas userId is a unique identifier for a user or bot only.

唯一可以相同的值是在私人聊天中.

The only time the values can be the same is in a private chat.

此处了解更多有关电报类型的信息.

Read more about Telegram types here.

这篇关于Telegeram Bot中的msg.chat.id和msg.from.id有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆