电报机器人API:用户回答民意调查后,如何停止在Webhook中获取消息?
我已经通过机器人在私人聊天中发送了民意调查。民意调查看起来不错。但是当我回答时 - 电报服务器重复将消息发送到Web挂钩:
{“ Update_id”:199522750, “ poll”:{“ id”:“ 5276163750276104310”,“问题”:“问题?”,“选项”:[{“ text”:“ test1”,“ pofter_count”:0},{“ text”,“ text”:“ test2 “,” pofter_count“:1},{“ text”:“ test3”,“ pofter_count”:0}],“ total_voter_count”:1,“ is_closed”:is_closed“:false”:false,“ IS_ANOMNONDOUS”:iS_ANTOMNONDOUS“:true,true,type” type“ type”:“常规“,”允许_multiple_answers”:false}}
webhook每分钟收到它。我已经用民意调查删除了消息。如何停止此消息?我猜一些对服务器的“确认”答案。
我需要收到一次结果,然后停止民意调查。这是与Bot的私人聊天,没有其他人会回答民意调查。
I have send poll by my bot in private chat with a bot. Poll appeared fine. But when I answer it - telegram server repeat sending message to web hook:
{"update_id":199522750,
"poll":{"id":"5276163750276104310","question":"Question?","options":[{"text":"test1","voter_count":0},{"text":"test2","voter_count":1},{"text":"test3","voter_count":0}],"total_voter_count":1,"is_closed":false,"is_anonymous":true,"type":"regular","allows_multiple_answers":false}}
Webhook receives it every minute. I have deleted message with poll. How to stop this messages? Some "confirm" answer to server needed I guess.
I need to receive result once, and stop a poll. This is private chat with bot, nobody else will answer a poll.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
需要存储来自SendPoll返回数据的轮询ID,消息ID,聊天ID的聊天ID。
然后在Webhook呼叫中stoppoll并处理答案,使用轮询ID作为还原其他参数的键
It`s needed to store poll id, message id, chat id from sendPoll return data.
Then in webhook call stopPoll and process an answer, using poll id as a key to restore other parameters(a db table with primary key pollId)