Node-telegram-bot-api: Request support for Polls: New Telegram Bot API v4.2

Created on 14 Apr 2019  路  13Comments  路  Source: yagop/node-telegram-bot-api

Request for support for Polls

Changelog: Bot API 4.2 April 14, 2019

  • Added support for native polls: added the object Poll, the methods sendPoll and stopPoll and the field poll in the Update object.
  • The method deleteMessage can now be used to delete messages sent by a user to the bot in private chats within 48 hours.
  • Added support for pinned messages in basic groups in addition to supergroups and channel chats: you can pass group's chat_id to pinChatMessage and unpinChatMessage, and receive the pinned group message in Chat object.
  • Added the field is_member to the ChatMember object, which can be used to find whether a restricted user is a member of the chat.
  • Added the field forward_sender_name to the Message object, containing name of the sender who has opted to hide their account.
  • Starting in July 2019, webhook requests from Bot API will be coming from the subnets 149.154.160.0/20 and 91.108.4.0/22. Most users won't need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: https://core.telegram.org/bots/webhooks.
  • Document thumbnails now should be inscribed in a 320x320 square instead of 90x90.

Source: https://core.telegram.org/bots/api#april-14-2019

TODO close-on-next-release telegram testing

Most helpful comment

The main features are ready. Just need to add the tests. Alternatively, if there is high demand for the features before the tests are written, I will merge the changes.

All 13 comments

Todo

  • [x] add sendPoll method
  • [x] add stopPoll method
  • [x] add poll field

I think this update should include all the updates reported in Telegram bot blog: https://core.telegram.org/bots/api-changelog#april-14-2019

@alexandercerutti The only thing missing function is the pools. The rest of the improvements are server-side and they work perfectly with the current library

Example:

msg.forward_sender_name // Return name of the user if user have forward restrictions active

@danielperez9430 oh okay, so nvm. 馃槉

The main features are ready. Just need to add the tests. Alternatively, if there is high demand for the features before the tests are written, I will merge the changes.

@kamikazechaser WoW, good work mate. It's possible to use it, now?

Update: I tried to download the changes and paste them into the Node_Modules folder and works

Does the code in the master branch already work for Polls 2.0? https://telegram.org/blog/polls-2-0-vmq

Thank you

Yes, it should work, just pass type as an optional parameter.

Hi, please can me send the correct sintaxt to use in a node js telegram bot?
I don' find how to use... I need to create quiz and polls.

Hi, please can me send the correct sintaxt to use in a node js telegram bot?
I don' find how to use... I need to create quiz and polls.

Check this examples mate:
https://tecnonucleous.com/2020/02/13/como-enviar-encuestas-2-0-con-nuetro-bot-de-telegram/

Hi, please can me send the correct sintaxt to use in a node js telegram bot?
I don' find how to use... I need to create quiz and polls.

Check this examples mate:
https://tecnonucleous.com/2020/02/13/como-enviar-encuestas-2-0-con-nuetro-bot-de-telegram/

bot.onText(/^!encuesta|^\/encuesta/,

There is a way to use a variable in object of poll? Same as "encuesta + variabletext"?

Hi, please can me send the correct sintaxt to use in a node js telegram bot?
I don' find how to use... I need to create quiz and polls.

Check this examples mate:
https://tecnonucleous.com/2020/02/13/como-enviar-encuestas-2-0-con-nuetro-bot-de-telegram/

bot.onText(/^!encuesta|^/encuesta/,

There is a way to use a variable in object of poll? Same as "encuesta + variabletext"?

You can match text before the command, like this example:

// Matches "/echo [whatever]"
bot.onText(/\/echo (.+)/, (msg, match) => {
  // 'msg' is the received Message from Telegram
  // 'match' is the result of executing the regexp above on the text content
  // of the message

  const chatId = msg.chat.id;
  const resp = match[1]; // the captured "whatever"
// More...

});

Wow! so can we create the polls now? via this npm module?
Please guide me to the documentation link and/or code samples. thank you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

qunatumwhiskey picture qunatumwhiskey  路  4Comments

Hostile picture Hostile  路  3Comments

sidelux picture sidelux  路  3Comments

Lemmmy picture Lemmmy  路  3Comments

jacopocappelli1989 picture jacopocappelli1989  路  4Comments