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

496 Commits

Author SHA1 Message Date
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
GochoMugo
ddadc4569b
[npm] Revert update of deps to support Node v0.12
Bug:

  Upgrading the dependencies 'file-type' and 'babel-eslint'
  removed support for Node.js v0.12 series.

  We are intending to continue to support 0.12 until we
  reach v1.
2017-01-09 15:28:19 +03:00
GochoMugo
aaa3992a78
[webhook] Fix referencing options
Bug:

  The confusion between using 'options' (passed by caller)
  and 'this.options' (cached on the object), we were making
  the assumption 'options.https' is unchanged!

  It's references is changed already as we had earlier assigned
  'this.options' to point to 'options', thus same object.
2017-01-08 00:43:01 +03:00
GochoMugo
0174b875ff
[examples] Update examples
Feature:

  * Add example demonstrating use of inline keyboards
    and callback queries (see PR #150)
  * Use token from environment variable, if available

References:

  * PR #150 - Provided example with inline keyboard and callbacks:
    https://github.com/yagop/node-telegram-bot-api/pull/150
2017-01-07 18:30:07 +03:00
GochoMugo
31a2376a1f
[webhook] Allow passing options to HTTPS server
Feature:

  We shall allow passing more options to the HTTP server,
  in `https.createServer()`.

  We are using a new property, `https`, to avoid any namespace
  collisions with our own options.

  `options.key`, `options.cert` and `options.pfx` are convenient
  options, in that they allow the user to provide paths to the
  corresponding files, which are read automatically,
  though synchronously!

Implementation:

  * completely backwards-compatible
  * all changes are being tested, except `options.pfx`

References:

  * Pass `ca` prop to https.createServer(): https://github.com/yagop/node-telegram-bot-api/pull/17
2017-01-07 17:58:01 +03:00
GochoMugo
f8667dc548
[npm] Do not update 'contributors' by default
Bug:

  The contributors tool is invoked during testing.
  It prompts for user input which freezes the CI.
  Disable it for now until we find a proper workaround
  or fix the tool!
2017-01-07 15:05:05 +03:00
GochoMugo
d54a6cd227
Fix npm script
Bug:

  The updates jsdoc2md changes its CLI API! Update
  our usage!
2017-01-07 14:26:42 +03:00
GochoMugo
9b4e1d9088
Update npm scripts 2017-01-07 12:53:32 +03:00
GochoMugo
f1b8e2d4f5
[examples] Update examples 2017-01-07 12:44:29 +03:00
GochoMugo
cc76b27cee
[maintenance] Update dependencies
Notes:

  The following dependencies have not been updated,
  as they break our tests:

  * eslint
  * eslint-config-airbnb
2017-01-07 12:05:54 +03:00
GochoMugo
487b5f4b8b
Fix ES6 syntax
Fix:

  This enables the library to be used without transpiling on
  Node 6 (current LTS).

Author: @GingerPlusPlus
2017-01-06 22:26:25 +03:00
Gocho Mugo
215e0dc23b Add deleteWebHook, getWebHookInfo (#246) 2017-01-06 21:48:31 +03:00
Gocho Mugo
bc7549599e Ensure consistency of methods signatures (#245)
Bug:

  The library assumes signatures of methods to be, somewhat:

    methodName(requiredParam1, requiredParam2, form = {})

  where 'requiredParam1' ('requiredParam2', ..., 'requiredParamN')
  are parameters that MUST be provided, and
  'form' is an optional object allowing supplying any additional,
  optional parameters that the Bot API allows.

  This allows any new parameters added by Telegram to be
  readily-supported by our library.

  Also, the following have been included:

  * Corresponding tests
  * Documentation on the old, deprecated signatures
  * Console-logging the deprecation notices
2017-01-06 21:03:10 +03:00
Gocho Mugo
ce4dff78fa Merge PR #250: 2017, Major Changes
See https://github.com/yagop/node-telegram-bot-api/pull/250 for
details on this PR!
2017-01-06 18:43:00 +03:00
GochoMugo
96bff10119
[test] Skip tests for TelegramBot#sendContact()
Bug:

  Please see note in test file!
2017-01-06 18:25:49 +03:00
GochoMugo
6dabdb47d8 [test] Calculate rate-limit timeout from error response
Feature:

  Instead of guessing of a proper timeout, we shall use the error
  response to calculate it. The error provides us with the number
  of milliseconds we need to wait before retrying the request.
2017-01-06 18:21:38 +03:00
GochoMugo
80a25c0e6e
[test] Place and update test options in mocha.opts file 2017-01-06 15:13:24 +03:00
GochoMugo
eba70cd3d7
[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
2017-01-06 14:44:42 +03:00
GochoMugo
0cd993f3e8 [test] Fix incorrect test cases 2017-01-06 13:03:52 +03:00