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.