2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-28 12:57:38 +00:00

414 Commits

Author SHA1 Message Date
Evgeny Bondarenko
c1fc486225 src: Load transpiled code for Node 5
References:
  * Bug-Report #297: https://github.com/yagop/node-telegram-bot-api/issues/297
  * Bug-Report-by: @jehy
  * PR  #298: https://github.com/yagop/node-telegram-bot-api/pull/298
  * PR-by: @jehy
2017-03-09 17:17:03 +03:00
GochoMugo
607a39ed5e
src/polling: Fix defaulting value of 'options.polling.params.timeout' 2017-02-16 11:47:55 +03:00
GochoMugo
e9106a3d0e
doc: Fix typos in Github issue template
References:

  * Reported-by: @GingerPlusPlus
2017-02-16 11:47:22 +03:00
Mohammed Sohail
9c60068122 examples: Express webhook (#287)
Feature:

  A webhook integration with an express app.

References:

  * Feature request: https://github.com/yagop/node-telegram-bot-api/issues/282
  * PR: https://github.com/yagop/node-telegram-bot-api/pull/287
  * Requested-by: @kamikazechaser 
  * PR-by: @kamikazechaser
2017-02-15 08:17:55 +03:00
Plusb Preco
a44eb7f1ee docs: Docs improvements (#291)
Feature:

  * Add notes about events in `api` document
  * Update copyright year
  * Cleanup docs

References:

  * Feature request: https://github.com/yagop/node-telegram-bot-api/issues/289
  * PR: https://github.com/yagop/node-telegram-bot-api/pull/291
  * Requested-by: @preco21 
  * PR-by: @preco21
2017-02-15 07:59:56 +03:00
GochoMugo
b2afdeb6a8
doc: Prepare for release v0.27.0 2017-02-10 17:50:50 +03:00
GochoMugo
3edb6d9b6e
doc: Update changelog 2017-02-10 17:45:55 +03:00
GochoMugo
130f6940ce
src/polling: Fix bug #284
Bug:

  During polling, deleting the already-set webhook, caused
  the `TelegramBotPolling#_getUpdates()` return an unexpected
  value.

  We expect the method to return an array (in the `.then()` clause).
  However, deleting the webhook returns its value, which is an object,
  from the method `_getUpdates()`.

Fix:

  Simply retry the polling request and return the promise.

Notes:

  Should we use recursion? I do not think so.
  Why? The chances of getting the error (having a webhook set) AGAIN
  is quite rare. And if it happens, there must be some problem with
  different instances invoking polling and webhook simultaneously.
  In that case, we wont struggle to recover from such a scenario.
  User is on their own! Isht!

References:

  * Bug report:   https://github.com/yagop/node-telegram-bot-api/issues/284
  * Reported by:  @dcparga
2017-02-10 12:40:47 +03:00
GochoMugo
9a9dfa9560
src: Minor fixes 2017-02-09 19:06:38 +03:00
GochoMugo
e75d51ca8f
src/polling: Add constructor option 'options.polling.params'
Feature:

  Please see the updated API reference for more information on this
  new option.

Side-effects:

  * `options.timeout` is deprecated!

References:

  * "Feature request": https://github.com/yagop/node-telegram-bot-api/issues/243
2017-02-09 17:24:11 +03:00
Gocho Mugo
eed7c1e4d0 src: Add proper error handling (#283)
Feature:

    Please see `doc/usage.md` for more information on error-handling.
2017-02-09 16:12:22 +03:00
GochoMugo
6f5dad6e5b
src/telegram: Add shim for Array#findIndex()
Bug:

  Array#findIndex() is unavailable in Node.js v0.x.
  Since we are deprecating Node.js v0.x already, we
  can use a shim in the mean time.

  Once we stop supporting that version range, we can
  drop the shim entirely.

tags: deprecate/node-v0.x
2017-02-09 15:25:38 +03:00
GochoMugo
79de62a96e
src/telegram: Add TelegramBot#removeReplyListener()
Feature:

  Please see the updated API Reference.

References:

  * Author: @githugger (Frederic Schneider <fschneider1992@gmail.com>)
  * Original PR: https://github.com/yagop/node-telegram-bot-api/pull/74
2017-02-09 15:07:08 +03:00
GochoMugo
0441c99b97
examples: Add webhook example for Zeit Now
References:

  * Original PR #274: https://github.com/yagop/node-telegram-bot-api/pull/274
  * PR-by: @Ferrari
2017-02-08 13:27:23 +03:00
GochoMugo
d4a469df6b
pkg: Fix bug #275
Bug:

  Node.js v4 does not support the ES6 syntax fully, thus we
  get the error:

    Block scoped declarations (let, const, function,class) not yet
    supported outside strict mode

Fix:

  * Load transpiled code
  * Deprecate support for Node.js v4.x

References:

  * Bug report: https://github.com/yagop/node-telegram-bot-api/issues/275
  * PR: https://github.com/yagop/node-telegram-bot-api/pull/280
  * Reported-by: @crazyabdul
  * PR-by: @crazyabdul
2017-02-08 12:16:51 +03:00
GochoMugo
7e4cadb514
src/polling: Fix bug #281
Bug:

  On certain errors, during polling, cause the following error to be
  thrown:

    TypeError: Cannot read property 'statusCode' of undefined

  This is caused when we try to access the 'response' property on
  the error object in the error handler (`catch(error)`). It goes
  missing when the error was fatal, for example, network error, thus
  no server response available.

References:

  * Issue #281:  https://github.com/yagop/node-telegram-bot-api/issues/281
  * Reported-by: @dimawebmaker
2017-02-08 11:44:42 +03:00
GochoMugo
3221d647cc
src/polling: Fix bug #276
Bug:

  With environment variable, `NODE_ENV`, is set to 'development',
  'request-promise' emits the process warning:

  Warning: a promise was created in a handler, but was not returned from
  it

  > If you know what you're doing and don't want to silence all
  > warnings, you can create runaway promises without causing this
  > warning by returning e.g. null:
  >
  > — http://bluebirdjs.com/docs/warning-explanations.html#warning-a-promise-was-created-in-a-handler-but-was-not-returned-from-it

  We believe we know what we are doing.

References:

  * Issue #276: https://github.com/yagop/node-telegram-bot-api/issues/276
2017-02-08 11:33:08 +03:00
GochoMugo
14f37c7181
test: Add test for TelegramBot#sendDocument() using 'fileOpts' param
References:

  * Original PR: https://github.com/yagop/node-telegram-bot-api/pull/152
  * Original Author: @evolun
2017-02-03 10:47:41 +03:00
GochoMugo
9d12bdfa41
src/webhook: Use String#indexOf() instead of RegExp#test() to find token
References:

  * Original PR: https://github.com/yagop/node-telegram-bot-api/pull/147
  * Original Author: @AVVS
2017-02-03 10:16:19 +03:00
GochoMugo
2013f6cffa
doc: Add templates for Issues and PRs 2017-02-01 11:47:06 +03:00
GochoMugo
2ee761677a
doc: Update changelog 2017-01-31 09:27:57 +03:00
GochoMugo
dad8697411
doc: Document options.webHook.host 2017-01-30 13:44:07 +03:00
GochoMugo
c886cf2cb5 src/webhook: Add health-check endpoint (#272)
References:

  * Author: @mironov (https://github.com/mironov)
  * PR: https://github.com/yagop/node-telegram-bot-api/pull/272
2017-01-30 13:26:33 +03:00
GochoMugo
9f031a72e5
pr/272: Finish on PR 2017-01-30 13:24:15 +03:00
Anton Mironov
3263c6c253 Webhook health check endpoint 2017-01-30 12:50:22 +03:00
GochoMugo
92506f50e6
doc: Link to the latest documentation 2017-01-30 10:13:31 +03:00
GochoMugo
24a3f6dade
examples: Minor cleanup 2017-01-29 18:59:05 +03:00
Daniil Yastremskiy
3ed45fb624 examples: Add webhook example for Heroku (#271) 2017-01-29 18:55:11 +03:00
Ni2c2k
535aa56345 doc: Fix links for examples and help in README (#266) 2017-01-25 21:48:38 +03:00
GochoMugo
a32259b1a1
src/telegram: Consider stream.path could not be parsed 2017-01-25 18:59:06 +03:00
GochoMugo
99f364df11
doc/help: Add link to source 2017-01-25 13:53:56 +03:00
Mohammed Sohail
235ea2276b doc: Add Badge for supported Bot API Version (#264) 2017-01-25 11:46:50 +03:00
GochoMugo
584a388fc5
doc: Add project to community section 2017-01-20 15:11:16 +03:00
GochoMugo
9cd663024f
pkg: Specify supported Node.js versions 2017-01-20 15:02:12 +03:00
GochoMugo
54212daa50
pkg: Bump minor version v0.26.0 2017-01-20 10:01:11 +03:00
GochoMugo
885f895da3
pkg: Update contributors 2017-01-20 09:57:54 +03:00
GochoMugo
ef3574ee88 doc: Improve project documentation 2017-01-20 09:13:18 +03:00
GochoMugo
e77c5ad8ec
src: Fix lint error 2017-01-13 16:00:42 +03:00
GochoMugo
f3b124ebad
doc: Add ChangeLog 2017-01-13 11:36:24 +03:00
GochoMugo
3201ce4172
telegram: Use POST requests by default
Feature:

  To be more RFC compliant, particularly when sending
  files, we are going to default to using POST requests.
  We have been using GET requests (even when uploading files).

  PS: This causes major problems with PWRTelegram API
2017-01-13 11:06:31 +03:00
GochoMugo
df4d9c06f3
src: Fix default options in constructors 2017-01-13 10:52:43 +03:00
GochoMugo
a9d6e93622
[telegram] Return error on trying to use Polling, WebHook together
Feature:

  Polling and WebHook are mutually exclusive. Therefore, return an
  error whenever the user tries to start polling, and the instance has
  an open webhook, or user tries to open a webhook, and the instance
  is already polling.
2017-01-11 17:06:04 +03:00
GochoMugo
061d11a109
[npm] Add script: mocha 2017-01-11 17:05:38 +03:00
GochoMugo
0c18cda922
[docs] Fix undocumented return value for TelegramBot#setWebHook() 2017-01-11 16:20:07 +03:00
GochoMugo
0d20565bd5
[telegram] Add constructor option, 'filepath'
Feature:

  The constructor option, 'filepath', allows us to remove
  the TelegramBot's behaviour of allowing users to pass in
  file-paths as arguments, as it involves some operations
  that might be (are) strongly against what a programmer wishes
  to achieve with the library.

  Expect this to be documented better in the near future.

Implementation:

  * Backwards compatible: The default behavior is not changed!
2017-01-11 11:06:41 +03:00
GochoMugo
e009b60efa
[webhook] Do not rely on http.Server#listening property
Bug:

  The 'http.Server#listening' property was added in Node.js v5.7.0!
  Support the older Node.js versions!
2017-01-09 16:49:06 +03:00
GochoMugo
6753f7befd
[telegram] Handle error when formatting formData
Bug:

  The method TelegramBot#_formatSendData() throws an error
  if the Buffer file type is NOT supported. We need to handle
  it, by returning a Promise that is reject with the originally
  thrown exception.

References:

  * PR trying to achieve the same: https://github.com/yagop/node-telegram-bot-api/pull/66
2017-01-09 16:16:01 +03:00
GochoMugo
97c8130d93
[webhook,polling] Improve starting, stopping of webhook, polling
Feature:

  The different mechanisms of fetching updates, i.e. polling
  and webhook, have had their implementations improved:

  * the TelegramBot instance needs to create the polling and
    webhook instances once, and when necessary
  * returning promises from TelegramBot#openWebHook() and
    TelegramBot#startPolling() allows more precise control

  Also,

  * TelegramBot#initPolling() is being deprecated in favor of
    TelegramBot#startPolling() to ensure consistency (as the
    opposite action of TelegramBot#stopPolling())
2017-01-09 15:57:34 +03:00
GochoMugo
4735518116
[docs] Mention auto-deletion of webhook during polling 2017-01-09 15:56:28 +03:00
GochoMugo
2a782fddbc
Deprecate support for Node.js v0.12
Notes:

  We are deprecating support for Node.js v0.12, to
  be removed in next major version!
2017-01-09 15:46:27 +03:00