mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-22 01:47:25 +00:00
feat: Remove bluebird + depd (#987)
* feat: Remove bluebird * docs: Update * remove depd ans use node native deprecate msg warnings * fix: correct util import name * remove: contributor dev dependencie and add list of contributors in the readme
This commit is contained in:
parent
d28875154c
commit
449f03f786
@ -92,6 +92,15 @@ Some things built using this library that might interest you:
|
|||||||
* [node-telegram-keyboard-wrapper](https://github.com/alexandercerutti/node-telegram-keyboard-wrapper): A wrapper to improve keyboards structures creation through a more easy-to-see way (supports Inline Keyboards, Reply Keyboard, Remove Keyboard and Force Reply)
|
* [node-telegram-keyboard-wrapper](https://github.com/alexandercerutti/node-telegram-keyboard-wrapper): A wrapper to improve keyboards structures creation through a more easy-to-see way (supports Inline Keyboards, Reply Keyboard, Remove Keyboard and Force Reply)
|
||||||
* [beetube-bot](https://github.com/kodjunkie/beetube-bot): A telegram bot for music, videos, movies, EDM tracks, torrent downloads, files and more.
|
* [beetube-bot](https://github.com/kodjunkie/beetube-bot): A telegram bot for music, videos, movies, EDM tracks, torrent downloads, files and more.
|
||||||
|
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://github.com/yagop/node-telegram-bot-api/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=yagop/node-telegram-bot-api" />
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
**The MIT License (MIT)**
|
**The MIT License (MIT)**
|
||||||
|
18
doc/api.md
18
doc/api.md
@ -123,7 +123,6 @@ TelegramBot
|
|||||||
* _static_
|
* _static_
|
||||||
* [.errors](#TelegramBot.errors) : <code>Object</code>
|
* [.errors](#TelegramBot.errors) : <code>Object</code>
|
||||||
* [.messageTypes](#TelegramBot.messageTypes) : <code>[ 'Array' ].<String></code>
|
* [.messageTypes](#TelegramBot.messageTypes) : <code>[ 'Array' ].<String></code>
|
||||||
* [.Promise](#TelegramBot.Promise)
|
|
||||||
|
|
||||||
<a name="new_TelegramBot_new"></a>
|
<a name="new_TelegramBot_new"></a>
|
||||||
|
|
||||||
@ -1847,23 +1846,6 @@ The different errors the library uses.
|
|||||||
The types of message updates the library handles.
|
The types of message updates the library handles.
|
||||||
|
|
||||||
**Kind**: static property of [<code>TelegramBot</code>](#TelegramBot)
|
**Kind**: static property of [<code>TelegramBot</code>](#TelegramBot)
|
||||||
<a name="TelegramBot.Promise"></a>
|
|
||||||
|
|
||||||
### TelegramBot.Promise
|
|
||||||
Change Promise library used internally, for all existing and new
|
|
||||||
instances.
|
|
||||||
|
|
||||||
**Kind**: static property of [<code>TelegramBot</code>](#TelegramBot)
|
|
||||||
|
|
||||||
| Param | Type |
|
|
||||||
| --- | --- |
|
|
||||||
| customPromise | <code>function</code> |
|
|
||||||
|
|
||||||
**Example**
|
|
||||||
```js
|
|
||||||
const TelegramBot = require('node-telegram-bot-api');
|
|
||||||
TelegramBot.Promise = myPromise;
|
|
||||||
```
|
|
||||||
* * *
|
* * *
|
||||||
|
|
||||||
|
|
||||||
|
2
index.js
2
index.js
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
const majorVersion = parseInt(process.versions.node.split('.')[0], 10);
|
const majorVersion = parseInt(process.versions.node.split('.')[0], 10);
|
||||||
if (majorVersion <= 5) {
|
if (majorVersion <= 5) {
|
||||||
const deprecate = require('depd')('node-telegram-bot-api');
|
const deprecate = require('./src/utils').deprecate;
|
||||||
deprecate('Node.js v5.x and below will no longer be supported in the future');
|
deprecate('Node.js v5.x and below will no longer be supported in the future');
|
||||||
module.exports = require('./lib/telegram');
|
module.exports = require('./lib/telegram');
|
||||||
} else {
|
} else {
|
||||||
|
486
package.json
486
package.json
@ -31,9 +31,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"array.prototype.findindex": "^2.0.2",
|
"array.prototype.findindex": "^2.0.2",
|
||||||
"bl": "^1.2.3",
|
"bl": "^1.2.3",
|
||||||
"bluebird": "^3.5.1",
|
|
||||||
"debug": "^3.1.0",
|
"debug": "^3.1.0",
|
||||||
"depd": "^1.1.1",
|
|
||||||
"eventemitter3": "^3.0.0",
|
"eventemitter3": "^3.0.0",
|
||||||
"file-type": "^3.9.0",
|
"file-type": "^3.9.0",
|
||||||
"mime": "^1.6.0",
|
"mime": "^1.6.0",
|
||||||
@ -54,7 +52,6 @@
|
|||||||
"babel-preset-es2015": "^6.24.1",
|
"babel-preset-es2015": "^6.24.1",
|
||||||
"babel-register": "^6.26.0",
|
"babel-register": "^6.26.0",
|
||||||
"concat-stream": "^1.6.0",
|
"concat-stream": "^1.6.0",
|
||||||
"contributor": "^0.1.25",
|
|
||||||
"eslint": "^2.13.1",
|
"eslint": "^2.13.1",
|
||||||
"eslint-config-airbnb": "^6.2.0",
|
"eslint-config-airbnb": "^6.2.0",
|
||||||
"eslint-plugin-mocha": "^4.11.0",
|
"eslint-plugin-mocha": "^4.11.0",
|
||||||
@ -73,484 +70,5 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/yagop/node-telegram-bot-api/issues"
|
"url": "https://github.com/yagop/node-telegram-bot-api/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/yagop/node-telegram-bot-api",
|
"homepage": "https://github.com/yagop/node-telegram-bot-api"
|
||||||
"contributors": [
|
}
|
||||||
{
|
|
||||||
"name": "Oleg",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/olegmdev",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 1,
|
|
||||||
"deletions": 0,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Archakov Dennis",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/Archakov06",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 1,
|
|
||||||
"deletions": 0,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "drGOD",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/drGOD",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 1,
|
|
||||||
"deletions": 0,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "MCSH",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/MCSH",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 2,
|
|
||||||
"deletions": 1,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Aaron Meese",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/ajmeese7",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 4,
|
|
||||||
"deletions": 4,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Misha",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/mnb3000",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 24,
|
|
||||||
"deletions": 12,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Savely Krasovsky",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/L11R",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 297,
|
|
||||||
"deletions": 1,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Victor Le",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/Coac",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 1,
|
|
||||||
"deletions": 1,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": null,
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/kucherenkovova",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 1,
|
|
||||||
"deletions": 1,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Guidone",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/guidone",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 1,
|
|
||||||
"deletions": 0,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Jaakko Lipsanen",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/JaakkoLipsanen",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 3,
|
|
||||||
"deletions": 3,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Fabio Zuber",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/Sirius-A",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 12,
|
|
||||||
"deletions": 0,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Evgeny Bondarenko",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/jehy",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 8,
|
|
||||||
"deletions": 8,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Anton Mironov",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/mironov",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 51,
|
|
||||||
"deletions": 15,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Daniil Yastremskiy",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/TheBeastOfCaerbannog",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 36,
|
|
||||||
"deletions": 0,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Nikolay Ershov",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/Ni2c2k",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 4,
|
|
||||||
"deletions": 4,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Alexander Tarmolov",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/tarmolov",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 5,
|
|
||||||
"deletions": 0,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": null,
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/GingerPlusPlus",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 6,
|
|
||||||
"deletions": 2,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Mikhail Burshteyn",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/m-burst",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 12,
|
|
||||||
"deletions": 5,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Sergey Bogdanov",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/desunit",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 1,
|
|
||||||
"deletions": 1,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Ola Flisbäck",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/oflisback",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 3,
|
|
||||||
"deletions": 3,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Horus Lugo",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/HorusGoul",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 108,
|
|
||||||
"deletions": 1,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Conor Fennell",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/conorfennell",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 50,
|
|
||||||
"deletions": 1,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Serhii Dmytruk",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/imserhii",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 35,
|
|
||||||
"deletions": 1,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Aleksandr L.",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/w-site",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 24,
|
|
||||||
"deletions": 0,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Matthew Brandly",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/brandly",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 1,
|
|
||||||
"deletions": 1,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Patricio López Juri",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/mrpatiwi",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 49,
|
|
||||||
"deletions": 2,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Anton",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/Feverqwe",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 23,
|
|
||||||
"deletions": 5,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Guido García",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/palmerabollo",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 1,
|
|
||||||
"deletions": 1,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Sebastian Troć",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/SebastianTroc",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 1,
|
|
||||||
"deletions": 1,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "CapacitorSet",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/CapacitorSet",
|
|
||||||
"contributions": 2,
|
|
||||||
"additions": 110,
|
|
||||||
"deletions": 2,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Plusb Preco",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/preco21",
|
|
||||||
"contributions": 2,
|
|
||||||
"additions": 111,
|
|
||||||
"deletions": 200,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Jishnu Mohan",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/jishnu7",
|
|
||||||
"contributions": 2,
|
|
||||||
"additions": 84,
|
|
||||||
"deletions": 0,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "TJ Horner",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/tjhorner",
|
|
||||||
"contributions": 2,
|
|
||||||
"additions": 223,
|
|
||||||
"deletions": 1,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Alex Godko",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/koloboid",
|
|
||||||
"contributions": 2,
|
|
||||||
"additions": 2,
|
|
||||||
"deletions": 2,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Dardan Neziri",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/knock-in",
|
|
||||||
"contributions": 2,
|
|
||||||
"additions": 22,
|
|
||||||
"deletions": 16,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Jérémy Gotteland",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/Tketa",
|
|
||||||
"contributions": 2,
|
|
||||||
"additions": 81,
|
|
||||||
"deletions": 3,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Iiro Jäppinen",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/iiroj",
|
|
||||||
"contributions": 2,
|
|
||||||
"additions": 40,
|
|
||||||
"deletions": 0,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": null,
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/evolun",
|
|
||||||
"contributions": 2,
|
|
||||||
"additions": 7,
|
|
||||||
"deletions": 3,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Vitaly Aminev",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/AVVS",
|
|
||||||
"contributions": 2,
|
|
||||||
"additions": 1065,
|
|
||||||
"deletions": 1001,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Cristian Baldi",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/crisbal",
|
|
||||||
"contributions": 2,
|
|
||||||
"additions": 26,
|
|
||||||
"deletions": 1,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Vítor Augusto da Silva Vasconcellos",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/HeavenVolkoff",
|
|
||||||
"contributions": 2,
|
|
||||||
"additions": 12,
|
|
||||||
"deletions": 0,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Rey",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/reyy",
|
|
||||||
"contributions": 2,
|
|
||||||
"additions": 34,
|
|
||||||
"deletions": 25,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Ivan Skorokhodov",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/universome",
|
|
||||||
"contributions": 3,
|
|
||||||
"additions": 219,
|
|
||||||
"deletions": 5,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Rafael Kr",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/RafaelKr",
|
|
||||||
"contributions": 3,
|
|
||||||
"additions": 3,
|
|
||||||
"deletions": 2,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": null,
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/EXL",
|
|
||||||
"contributions": 4,
|
|
||||||
"additions": 4,
|
|
||||||
"deletions": 4,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Riddler",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/Waterloo",
|
|
||||||
"contributions": 3,
|
|
||||||
"additions": 64,
|
|
||||||
"deletions": 2,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Chris54721",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/chris54721",
|
|
||||||
"contributions": 5,
|
|
||||||
"additions": 22,
|
|
||||||
"deletions": 6,
|
|
||||||
"hireable": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Ilias Ismanalijev",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/Illyism",
|
|
||||||
"contributions": 7,
|
|
||||||
"additions": 140,
|
|
||||||
"deletions": 10,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Gocho Mugo",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/GochoMugo",
|
|
||||||
"contributions": 152,
|
|
||||||
"additions": 7186,
|
|
||||||
"deletions": 3367,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Mohammed Sohail",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/kamikazechaser",
|
|
||||||
"contributions": 12,
|
|
||||||
"additions": 523,
|
|
||||||
"deletions": 127,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Yago",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/yagop",
|
|
||||||
"contributions": 197,
|
|
||||||
"additions": 3023,
|
|
||||||
"deletions": 1177,
|
|
||||||
"hireable": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Sedric Heidarizarei",
|
|
||||||
"email": null,
|
|
||||||
"url": "https://github.com/saeedhei",
|
|
||||||
"contributions": 1,
|
|
||||||
"additions": 1,
|
|
||||||
"deletions": 0,
|
|
||||||
"hireable": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -16,8 +16,7 @@ const path = require('path');
|
|||||||
const URL = require('url');
|
const URL = require('url');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const pump = require('pump');
|
const pump = require('pump');
|
||||||
const deprecate = require('depd')('node-telegram-bot-api');
|
const deprecate = require('./utils').deprecate;
|
||||||
let Promise = require('bluebird');
|
|
||||||
|
|
||||||
const _messageTypes = [
|
const _messageTypes = [
|
||||||
'text',
|
'text',
|
||||||
@ -61,30 +60,6 @@ const _deprecatedMessageTypes = [
|
|||||||
'new_chat_participant', 'left_chat_participant'
|
'new_chat_participant', 'left_chat_participant'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
if (!process.env.NTBA_FIX_319) {
|
|
||||||
// Enable Promise cancellation.
|
|
||||||
try {
|
|
||||||
const msg =
|
|
||||||
'Automatic enabling of cancellation of promises is deprecated.\n' +
|
|
||||||
'In the future, you will have to enable it yourself.\n' +
|
|
||||||
'See https://github.com/yagop/node-telegram-bot-api/issues/319.';
|
|
||||||
deprecate(msg);
|
|
||||||
Promise.config({
|
|
||||||
cancellation: true,
|
|
||||||
});
|
|
||||||
} catch (ex) {
|
|
||||||
/* eslint-disable no-console */
|
|
||||||
const msg =
|
|
||||||
'error: Enabling Promise cancellation failed.\n' +
|
|
||||||
' Temporary fix is to load/require this library as early as possible before using any Promises.';
|
|
||||||
console.error(msg);
|
|
||||||
throw ex;
|
|
||||||
/* eslint-enable no-console */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSON-serialize data. If the provided data is already a String,
|
* JSON-serialize data. If the provided data is already a String,
|
||||||
* return it as is.
|
* return it as is.
|
||||||
@ -117,19 +92,6 @@ class TelegramBot extends EventEmitter {
|
|||||||
return _messageTypes;
|
return _messageTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Change Promise library used internally, for all existing and new
|
|
||||||
* instances.
|
|
||||||
* @param {Function} customPromise
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const TelegramBot = require('node-telegram-bot-api');
|
|
||||||
* TelegramBot.Promise = myPromise;
|
|
||||||
*/
|
|
||||||
static set Promise(customPromise) {
|
|
||||||
Promise = customPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add listener for the specified [event](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#events).
|
* Add listener for the specified [event](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#events).
|
||||||
* This is the usual `emitter.on()` method.
|
* This is the usual `emitter.on()` method.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const errors = require('./errors');
|
const errors = require('./errors');
|
||||||
const debug = require('debug')('node-telegram-bot-api');
|
const debug = require('debug')('node-telegram-bot-api');
|
||||||
const deprecate = require('depd')('node-telegram-bot-api');
|
const deprecate = require('./utils').deprecate;
|
||||||
const ANOTHER_WEB_HOOK_USED = 409;
|
const ANOTHER_WEB_HOOK_USED = 409;
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,8 +4,6 @@ const https = require('https');
|
|||||||
const http = require('http');
|
const http = require('http');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const bl = require('bl');
|
const bl = require('bl');
|
||||||
const Promise = require('bluebird');
|
|
||||||
|
|
||||||
|
|
||||||
class TelegramBotWebHook {
|
class TelegramBotWebHook {
|
||||||
/**
|
/**
|
||||||
|
3
src/utils.js
Normal file
3
src/utils.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
const util = require('util');
|
||||||
|
// Native deprecation warning
|
||||||
|
exports.deprecate = (msg) => util.deprecate(() => { }, msg, 'node-telegram-bot-api')();
|
@ -1,5 +1,4 @@
|
|||||||
const TelegramBot = require('..');
|
const TelegramBot = require('..');
|
||||||
const Promise = require('bluebird');
|
|
||||||
const request = require('request-promise');
|
const request = require('request-promise');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
@ -121,15 +120,6 @@ describe('TelegramBot', function telegramSuite() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows providing custom Promise library', function test() {
|
|
||||||
TelegramBot.Promise = global.Promise;
|
|
||||||
const promise = bot.stopPolling();
|
|
||||||
assert.ok(promise instanceof global.Promise);
|
|
||||||
assert.ok(!(promise instanceof Promise));
|
|
||||||
// revert
|
|
||||||
TelegramBot.Promise = Promise;
|
|
||||||
});
|
|
||||||
|
|
||||||
it('automatically starts polling', function test() {
|
it('automatically starts polling', function test() {
|
||||||
assert.strictEqual(botPolling.isPolling(), true);
|
assert.strictEqual(botPolling.isPolling(), true);
|
||||||
return utils.isPollingMockServer(pollingPort2);
|
return utils.isPollingMockServer(pollingPort2);
|
||||||
@ -210,7 +200,7 @@ describe('TelegramBot', function telegramSuite() {
|
|||||||
});
|
});
|
||||||
it('only accepts POST method', function test() {
|
it('only accepts POST method', function test() {
|
||||||
const methods = ['GET', 'PUT', 'DELETE', 'OPTIONS'];
|
const methods = ['GET', 'PUT', 'DELETE', 'OPTIONS'];
|
||||||
return Promise.each(methods, (method) => {
|
return Promise.all(methods, (method) => {
|
||||||
return utils.sendWebHookMessage(webHookPort2, TOKEN, {
|
return utils.sendWebHookMessage(webHookPort2, TOKEN, {
|
||||||
method,
|
method,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
@ -81,7 +81,6 @@ exports = module.exports = {
|
|||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
const Promise = require('bluebird');
|
|
||||||
const request = require('request-promise');
|
const request = require('request-promise');
|
||||||
const statics = require('node-static');
|
const statics = require('node-static');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user