admin管理员组文章数量:1387289
I'm currently using grammY to create a telegram bot.
I'm able to create a poll using the below code. The poll closes when at pollCloseDate.
I want to send a message when the poll closes. The message should have context of the result of the closed poll. eg. "Option 1 has the most vote!".
How can I do so?
botmand("q", async (ctx) => {
const poll = await ctx.api.sendPoll(
ctx.chat.id,
"Poll question",
[{text: "option 1"}, {text: "option 2"}, {text: "option 3"}],
{ is_anonymous: true, allows_multiple_answers: true, close_date: pollCloseDate}
);
});
Thanks for the help!
I have tried using bot.on("poll" ...), bot.on("poll_answer" ...) but both were not called when the poll is closed using the close_date.
I'm currently using grammY to create a telegram bot.
I'm able to create a poll using the below code. The poll closes when at pollCloseDate.
I want to send a message when the poll closes. The message should have context of the result of the closed poll. eg. "Option 1 has the most vote!".
How can I do so?
botmand("q", async (ctx) => {
const poll = await ctx.api.sendPoll(
ctx.chat.id,
"Poll question",
[{text: "option 1"}, {text: "option 2"}, {text: "option 3"}],
{ is_anonymous: true, allows_multiple_answers: true, close_date: pollCloseDate}
);
});
Thanks for the help!
I have tried using bot.on("poll" ...), bot.on("poll_answer" ...) but both were not called when the poll is closed using the close_date.
Share Improve this question edited Mar 18 at 15:44 Daniel Chua asked Mar 17 at 16:35 Daniel ChuaDaniel Chua 12 bronze badges1 Answer
Reset to default 0you can use schedule message and set date and time same as poll closes
to get poll results after poll coloses you can save message_id of the poll and access the results by message_id
I'm not familiar with this library, but you can search for it or get help from ChatGPT to write the code.
本文标签: javascriptRetrieving telegram poll results when the poll is closedStack Overflow
版权声明:本文标题:javascript - Retrieving telegram poll results when the poll is closed - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744545935a2611895.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论