有没有办法使用Dialogflow从电报机器人获取用户坐标? [英] Is there a way to get user coordinates from telegram bot using Dialogflow?

查看:75
本文介绍了有没有办法使用Dialogflow从电报机器人获取用户坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在使用Dialogflow开发电报机器人。我想获取有关用户的信息,例如当前坐标和用户名,但是我无法从电报中获取JSON。有没有一种方法可以在不使用任何相关的Google助手事件的情况下进行此类操作?

Currently im working on a telegram bot with Dialogflow. I want to get information about the user like current coordinates and user name but im not able to get them in the JSON coming from telegram. Is there a way to do such a thing without using any related google assistant events?

推荐答案

您可以检查收到的更新的结构由bot在文档电报Bot API

You can check the structure of updates received by bot on the documentation Telegram Bot API

update.message.from 包含 User 对象。

update.message.from contains the User object.

update.message.location 包含 位置 对象。

update.message.location contains the Location object.

请注意,只有当用户实际将其位置发送给机器人时,位置才会存在,它不会是每条消息都附带的元数据

Be aware that the location will be present only if the user actually sent his position to the bot, it will not be a metadata coming along with every message.

这篇关于有没有办法使用Dialogflow从电报机器人获取用户坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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