2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-31 06:16:07 +00:00

[telegram] Expose TelegramBot#processUpdate()

Feature:

  We are exposing TelegramBot#processUpdate() to allow instances
  to be used, with mechanisms of fetching updates, other than
  those provided by the library.

References:

  * Example use case: https://github.com/GochoMugo/tgfancy/pull/7
This commit is contained in:
GochoMugo
2017-01-06 14:44:42 +03:00
parent 0cd993f3e8
commit eba70cd3d7
2 changed files with 104 additions and 88 deletions

View File

@@ -80,6 +80,7 @@ TelegramBot
* [.getMe()](#TelegramBot+getMe) ⇒ <code>Promise</code>
* [.setWebHook(url, [cert])](#TelegramBot+setWebHook)
* [.getUpdates([timeout], [limit], [offset])](#TelegramBot+getUpdates) ⇒ <code>Promise</code>
* [.processUpdate(update)](#TelegramBot+processUpdate)
* [.sendMessage(chatId, text, [options])](#TelegramBot+sendMessage) ⇒ <code>Promise</code>
* [.answerInlineQuery(inlineQueryId, results, [options])](#TelegramBot+answerInlineQuery) ⇒ <code>Promise</code>
* [.forwardMessage(chatId, fromChatId, messageId)](#TelegramBot+forwardMessage) ⇒ <code>Promise</code>
@@ -213,6 +214,20 @@ Use this method to receive incoming updates using long polling
| [limit] | <code>Number</code> &#124; <code>String</code> | Limits the number of updates to be retrieved. |
| [offset] | <code>Number</code> &#124; <code>String</code> | Identifier of the first update to be returned. |
<a name="TelegramBot+processUpdate"></a>
### telegramBot.processUpdate(update)
Process an update; emitting the proper events and executing regexp
callbacks. This method is useful should you be using a different
way to fetch updates, other than those provided by TelegramBot.
**Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code>
**See**: https://core.telegram.org/bots/api#update
| Param | Type |
| --- | --- |
| update | <code>Object</code> |
<a name="TelegramBot+sendMessage"></a>
### telegramBot.sendMessage(chatId, text, [options]) ⇒ <code>Promise</code>