-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added: 1. Add constructor options: * (#243) `options.polling.params` (by @GochoMugo, requested-by @sidelux) 1. Add methods: * (#74) *TelegramBot#removeReplyListener()* (by @githugger) 1. (#283) Add proper error handling (by @GochoMugo) 1. (#272) Add health-check endpoint (by @mironov) * `options.webHook.healthEndpoint` 1. (#152) Add test for TelegramBot#sendDocument() using 'fileOpts' param (by @evolun) 1. Document `options.webHook.host` (by @GochoMugo) 1. (#264) Add Bot API version to README (by @kamikazechaser) 1. Add examples: - (#271) WebHook on Heroku (by @TheBeastOfCaerbannog) - (#274) WebHook on Zeit Now (by @ferrari) Changed: 1. (#147) Use *String#indexOf()*, instead of *RegExp#test()*, to find token in webhook request (by @AVVS) Fixed: * Fix bug: - (#275, #280) fix es6 syntax error on Node.js v4.x (by @CrazyAbdul) - (#276) promise.warning from `request-promise` (by @GochoMugo, reported-by @preco21) - (#281) fix handling error during polling (by @GochoMugo, reported-by @dimawebmaker) - (#284) fix error during deletion of already-set webhook, during polling (by @GochoMugo, reported-by @dcparga) 1. Fix links in documentation (by @Ni2c2k)
- Loading branch information
Showing
19 changed files
with
783 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<!-- | ||
This template includes two sections: | ||
1. Bug reporting | ||
2. Feature request | ||
3. Question | ||
Please remove whichever section that does not apply to your issue | ||
--> | ||
|
||
|
||
|
||
<!--******************************************************************** | ||
Reporting a Bug. | ||
*********************************************************************--> | ||
|
||
> Bug Report | ||
I have read: | ||
|
||
* [Usage information](https://github.com/yagop/node-telegram-bot-api/tree/master/doc/usage.md) | ||
* [Help information](https://github.com/yagop/node-telegram-bot-api/tree/master/doc/help.md) | ||
|
||
I am using the latest version of the library. | ||
|
||
### Expected Behavior | ||
|
||
<!-- Explain what you are trying to achieve --> | ||
|
||
### Actual Behavior | ||
|
||
<!-- Explain what happens, contrary to what you expected --> | ||
|
||
### Steps to reproduce the Behavior | ||
|
||
<!-- Explain how we can reproduce the bug --> | ||
|
||
|
||
|
||
<!--******************************************************************** | ||
Feature Request. | ||
*********************************************************************--> | ||
|
||
> Feature Request | ||
I have: | ||
|
||
* searched for such a feature request (https://github.com/yagop/node-telegram-bot-api/labels/enhancement) and found none | ||
|
||
### Introduction | ||
|
||
<!-- Describe what value this feature would add, and in which use case, | ||
or scenario --> | ||
|
||
### Example | ||
|
||
<!-- A code snippet of how this feature would work, were it already | ||
implemented --> | ||
|
||
|
||
|
||
<!--******************************************************************** | ||
Question. | ||
*********************************************************************--> | ||
|
||
> Question | ||
<!-- Ask your question here. Please be precise, adding as much detail | ||
as necessary. Also, add a code snippet(s) if possible. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!-- | ||
Mark whichever option below applies to this PR. | ||
For example, if your PR passes all tests, you would mark the option as so: | ||
- [x] All tests pass | ||
Note the 'x' in between the square brackets '[]' | ||
--> | ||
- [ ] All tests pass | ||
- [ ] I have run `npm run gen-doc` | ||
|
||
### Description | ||
|
||
<!-- Explain what you are trying to achieve with this PR --> | ||
|
||
### References | ||
|
||
<!-- | ||
Add references to other documents/pages that are relevant to this | ||
PR, such as related issues, documentation, etc. | ||
For example, | ||
* Issue #1: https://github.com/yagop/node-telegram-bot-api/issues/1 | ||
* Telegram Bot API - Getting updates: https://core.telegram.org/bots/api#getting-updates | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* This example demonstrates setting up webhook | ||
* on the Heroku platform. | ||
*/ | ||
|
||
|
||
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN'; | ||
const TelegramBot = require('..'); | ||
const options = { | ||
webHook: { | ||
// Port to which you should bind is assigned to $PORT variable | ||
// See: https://devcenter.heroku.com/articles/dynos#local-environment-variables | ||
port: process.env.PORT | ||
// you do NOT need to set up certificates since Heroku provides | ||
// the SSL certs already (https://<app-name>.herokuapp.com) | ||
// Also no need to pass IP because on Heroku you need to bind to 0.0.0.0 | ||
} | ||
}; | ||
// Heroku routes from port :443 to $PORT | ||
// Add URL of your app to env variable or enable Dyno Metadata | ||
// to get this automatically | ||
// See: https://devcenter.heroku.com/articles/dyno-metadata | ||
const url = process.env.APP_URL || 'https://<app-name>.herokuapp.com:443'; | ||
const bot = new TelegramBot(TOKEN, options); | ||
|
||
|
||
// This informs the Telegram servers of the new webhook. | ||
// Note: we do not need to pass in the cert, as it already provided | ||
bot.setWebHook(`${url}/bot${TOKEN}`); | ||
|
||
|
||
// Just to ping! | ||
bot.on('message', function onMessage(msg) { | ||
bot.sendMessage(msg.chat.id, 'I am alive on Heroku!'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.