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

Compare commits

...

81 Commits

Author SHA1 Message Date
danielperez9430
59b43a5355 feat: Support Telegram Bot API v9.1 2025-07-28 20:44:55 +02:00
danielperez9430
6d7adc3e12 feat: Support Telegram Bot API 9.0 2025-04-17 01:04:54 +02:00
danielperez9430
8fe6f04df2 feat: Partial Support Telegram Bot API v9.0 2025-04-16 19:38:18 +02:00
danielperez9430
074912cdb3 deps: upgrade @cypress/request
Added request to devDeps for test because @cypress/request-promise require it but not autoinstall it for the tests
2025-04-16 19:37:35 +02:00
danielperez9430
cb21b01c3a style: doc block format 2025-04-16 18:53:19 +02:00
danielperez9430
0b2662fd24 feat: Bot API v8.3 2025-04-16 15:48:03 +02:00
danielperez9430
b4effe6980 docs(Readme) 2025-04-16 11:16:46 +02:00
danielperez9430
94e61c0a10 feat: Bot API 8.1 2025-04-16 11:14:41 +02:00
Ismail Bin Mujeeb
8cff652e05
feat: save prepared inline message v8.0 (#1248)
* Add support for savePreparedInlineMessage in bot api v8.0 #1243

* run `npm run doc` command

---------

Co-authored-by: Daniel Pérez Fernández <dpefe@hotmail.es>
2025-04-16 10:54:56 +02:00
danielperez9430
01c3ea77c9 feat: Support Telegram Bot API 7.10 2025-04-16 10:07:23 +02:00
Daniel Pérez Fernández
5fd83b3243 feat: Support for sendPaidMedia 2025-04-16 01:14:46 +02:00
Melroy van den Berg
531a15e7b8
docs: Remove travis badge (#1225) 2025-04-15 13:34:12 +02:00
ivanjh
12d28f3958
fix: FatalError set reference to causing error (#1257) 2025-04-15 13:33:09 +02:00
danielperez9430
766b4344a8 🚧: Support bot api v7.9
Added:

* getStarTransactions (v7.5)
* createChatSubscriptionInviteLink (v7.9)
* editChatSubscriptionInviteLink (v7.9)
2024-09-06 00:07:16 +02:00
danielperez9430
f40b421717 feat: Support Telegram Bot API 7.4 2024-05-30 23:33:27 +02:00
Dmytro Svynarenko
e7dd42c227
fix: getChatMember #1200 (#1201) 2024-05-30 22:55:50 +02:00
danielperez9430
7e9ee42769 fix: getUserChatBoosts 2024-05-30 22:37:54 +02:00
danielperez9430
65ef0a2fcc feat: Support Telegram Bot API 7.3 2024-05-08 15:36:52 +02:00
danielperez9430
fea59f455c feat: Support Telegram Bot API 7.2 2024-05-03 20:30:33 +02:00
danielperez9430
556de8794d fix: Missing updates 2024-03-09 19:13:58 +01:00
danielperez9430
7fe501f19f feat: Support for message reaction event 2024-03-09 19:03:58 +01:00
danielperez9430
d323a3bac5 feat: support getUserChatBoosts 2024-02-21 01:20:45 +01:00
danielperez9430
515a1acdc7 feat: Telegram Bot API 7.1 2024-02-21 01:05:50 +01:00
danielperez9430
8f741b2cb6 fix: setMessageReaction 2024-02-21 00:59:45 +01:00
danielperez9430
db976c4598 fix: CopyMessages 2024-02-21 00:59:15 +01:00
danielperez9430
8df6e6583e test: CopyMessage and getMyDefaultAdministratorRights 2024-02-21 00:58:40 +01:00
danielperez9430
be25ec69d2 feat: Support forwardMessages method 2024-02-20 23:29:44 +01:00
danielperez9430
00ffca5fdd chore: Code style and order of the methods 2024-02-20 19:56:20 +01:00
Sp3rick
cceea22a93
feat: Add methods deleteMessages and copyMessages
* Added setMessageReaction method
* Added setMessageReaction method

* Added and implemented _fixReplyParameters

---------

Co-authored-by: Sp3rick <your_email@example.com>
2024-02-20 19:47:13 +01:00
許景欣
e81ec60377
feat: add copyMessages method 2024-02-16 23:40:17 +01:00
Daniel
4fa9a735bb fix: RegexExp in process messges updates 2023-11-01 12:31:54 +01:00
Daniel
5385d41f1f feat: update to v0.64.0 version 2023-10-25 12:41:41 +02:00
Daniel Pérez Fernández
12d4d25af4
deps: Change request to @cypress/request (#1145) 2023-10-25 12:31:46 +02:00
Daniel
f17e801b8a docs: revokeChatInviteLink 2023-10-24 11:25:43 +02:00
Daniel Pérez Fernández
595cdbd0c6
feat: Telegram Bot API 6.8 support (#1113)
* feat: Telegram Bot API 6.8 support

* chore: telegramWebHook file format
2023-08-23 01:07:17 +02:00
Ilya Khrustalev
dfe24a4d38
docs: update api.md for setWebHook (fix #1083) (#1084) 2023-08-23 00:57:17 +02:00
Daniel Pérez Fernández
542002ec0d
feat: Telegram Bot API Support 6.6 + 6.7 [WIP] (#1069)
* feat: Telegram Bot API Support

* refactor: uploadStickerFile

* feat: Support Telegram Bot API v6.7

* fix: tests

* feat: Test for deleteStickerSet
2023-08-23 00:49:09 +02:00
Yago
2885db0e31
Merge pull request #1094 from kaiserdj/patch-1
docs: Update group link
2023-06-19 11:45:07 +09:00
Kaiserdj™
ad2b8c2ce1
docs: Update group link 2023-06-09 21:37:52 +02:00
Daniel
4ec6a68840 docs: Update group link 2023-06-07 15:36:22 +02:00
Karl-Heinz Wind
ab0eb183ad
fix: Handle rejected when open a webhook in a port that was already in use
Co-authored-by: windka <karl-heinz.wind.external@trumpf.com>
2023-05-03 10:32:25 +02:00
Dmitry Vyazin
c4164a21ce
docs: Update README 2023-05-03 10:29:58 +02:00
agoudbg
6077f9ba10
docs: update api.md for createNewStickerSet (#1043)
* fix: createNewStickerSet description error

* docs: Update api.md
2023-01-31 01:17:55 +01:00
Dmitry Vyazin
41f493ba82
docs: update README.md (#1044) 2023-01-31 01:17:06 +01:00
Daniel
53b5565e8a fix: remove try catch in _fixAddFileThumb 2022-12-31 14:07:51 +01:00
Daniel Pérez Fernández
58261d1be3
feat: Telegram Bot API 6.4 Support (#1040)
* feat: Telegram Bot API 6.4

* fix: Add Thumb sendVideo/...

* docs: Regenerate

* fix: set/get mycommands and suggested tip amounts
2022-12-30 20:47:36 +01:00
Yurii Hrom
4ef4fe9ba9
Update incorrect link in tutorials.md (#1027) 2022-11-19 17:52:25 +03:00
Daniel Pérez Fernández
ab5928669b
feat: Telegram Bot API v6.3 (#1020)
* feat: Telegram Topics

* update docs

* fix: test

* update: docs
2022-11-06 02:54:23 +01:00
Antonio Hernández
0eb8b8032f
fix: Parse entities when sending request (#1013) 2022-11-06 00:15:24 +01:00
Daniel Pérez Fernández
ccdd14670b
docs: Fix readme with correct link to api docs 2022-09-26 19:44:05 +02:00
Daniel Pérez Fernández
d85370452a
fix: Changelog 2022-08-29 10:22:39 +02:00
SerKo
22d99fd91d
docs: update @types install note (#999) 2022-08-24 17:11:22 +03:00
Daniel Pérez Fernández
fe4afd6533
feat: Support Bot API v6.2 (#996)
* docs: Update readme and add Typescript types

* feat: getCustomEmojiStickers

* feat: Add getCustomEmojiStickers test + fix other test

* fix: docs

* docs: Update changelog + docs
2022-08-15 21:44:44 +02:00
Tinsae
c9b05e7996
feat: Support test enviroment (#994)
* Added a support for testing enviroment

* Added annotation for testing enviroment and run doc

Co-authored-by: Mohamed Sohail <sohailsameja@gmail.com>
2022-08-15 01:00:41 +02:00
Daniel Pérez Fernández
f50cf982c7
Hotfix: tests + modify order src/telegram + docs (#988)
* test: stopPoll

* test: setChatStickerSet and deleteChatStickerSet

* refactor: src/telegram.js

* Remove legacy methods:
 - getChatMembersCount
 - getChatMembersCount
 - kickChatMember

* Remove mandatory param  “start_parameter” from sendInvoice, because actually is a optional param

* docs: Update docs API

* docs: Update

* fix: addStickerToSet

* fix: stringify

* refactor: And add deleteStickerFromSet + setStickerPositionInSet

* fix: eslint

* docs: Update changelog
2022-07-19 12:43:39 +02:00
Daniel Pérez Fernández
449f03f786
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
2022-07-18 08:41:31 +02:00
Daniel Pérez Fernández
d28875154c
feat: Telegram Bot API 6.1 and bug fixes (#977)
## [0.58.0][0.58.0] - 2022-06-22

1. Support Bot API v6.1: (@danielperez9430)
   * Add method *createInvoiceLink()*

2. Support for setStickerSetThumb (@elihaidv)

3. Add new test (@danielperez9430)
   * createInvoiceLink

4. Test fixes (@danielperez9430)
   * sendVideoNote
   * createNewStickerSet
   * setStickerSetThumb
   * getChatMenuButton
   * setWebHook

5. Bug fixes (@danielperez9430)
   * answerWebAppQuery
   * Support for send thumb in sendAudio
2022-06-22 21:11:16 +02:00
Lawrence Onah
f97cad7588
Update README.md (#978) 2022-06-21 21:29:24 +02:00
Daniel Pérez Fernández
6ad9115fb1
Merge pull request #846 from elihaidv/master
setStickerSetThumb function added
2022-06-03 23:28:43 +02:00
Yago
72feca3d02
Merge pull request #966 from danielperez9430/master
Support for Telegram Bot API 6.0
2022-04-24 22:19:44 +02:00
danielperez9430
280a58c0e2 Support for Telegram Bot API 6.0
* Add method *setChatMenuButton()*
   * Add method *getChatMenuButton()*
   * Add method *setMyDefaultAdministratorRights()*
   * Add method *getMyDefaultAdministratorRights()*
   * Add method *answerWebAppQuery()*
   * Renamed the fields voice_chat_scheduled, voice_chat_started, voice_chat_ended, and voice_chat_participants_invited to video_chat_scheduled, video_chat_started, video_chat_ended, and video_chat_participants_invited

   Tests:

   * answerWebAppQuery
   * setChatMenuButton
   * getChatMenuButton
   * setMyDefaultAdministratorRights
   * getMyDefaultAdministratorRights
2022-04-23 01:01:34 +02:00
Antonio Hernández
0f33cb5ab7
doc: added missing documentation related to events (#938) 2022-02-06 20:14:29 +03:00
Yago
e114682f2e
Merge pull request #922 from danielperez9430/master
Telegram Bot API 5.5 Support
2021-12-10 02:13:56 +01:00
danielperez9430
1a7f41c930 docs: Generate new docs 2021-12-09 02:27:50 +01:00
danielperez9430
c6cb87ec12 fix: Bug with docs 2021-12-09 02:27:38 +01:00
danielperez9430
bbbc6cb8b8 feat: Support Telegram Bot API 5.5 2021-12-07 16:43:16 +01:00
danielperez9430
5ff22148d8 feat: banChatSenderChat and unbanChatSenderChat methods 2021-12-07 16:42:00 +01:00
danielperez9430
19b5fc5bd3 fix(Test): Update test for new chat invite link format 2021-12-07 16:41:35 +01:00
Yago
68ac69cf99
Merge pull request #912 from danielperez9430/master
Support for Telegram Bot API 5.4
2021-11-07 20:33:48 +01:00
Daniel Pérez Fernández
e119612b5f docs(Changelog) 2021-11-07 18:56:42 +01:00
Daniel Pérez Fernández
b9e8675736 fix: editMessageMedia - Now you can send a local file 2021-11-07 18:55:14 +01:00
Daniel Pérez Fernández
d87e8d258d chore: Update package.json version to 0.55.0 2021-11-07 16:08:57 +01:00
Daniel Pérez Fernández
a1e73481db docs: Update changelod and readme 2021-11-07 16:08:22 +01:00
Daniel Pérez Fernández
6c0f2e73c0 feat: Add support for new event "chat_join_request" 2021-11-07 16:07:50 +01:00
Daniel Pérez Fernández
15c878ea89 docs: Update api.md 2021-11-07 16:07:21 +01:00
Daniel Pérez Fernández
b60f065a83 feat: Add new method "approveChatJoinRequest" and "declineChatJoinRequest" 2021-11-07 16:06:51 +01:00
Daniel Pérez Fernández
921cb65fce docs: Update api.md 2021-11-07 16:06:04 +01:00
Alexander Cerutti
5cc6629ca0
Removed deprecated node-telegram-operations-manager from list (#896)
* Removed deprecated node-telegram-operations-manager from list

* Fixed repeated words
2021-08-12 21:19:34 +03:00
Yago Perez
2416679cee 0.54.0 2021-07-21 22:01:08 +02:00
Daniel Pérez Fernández
5a4787884e
Telegram Bot API v5.3 Support (#886)
* Add new method sendPoll

* getMyCommands

* setMyCommands

* Update doc/api

* 1# Fix Test sendPhoto

The sendPhoto method does not support .gif files, use sendAnimation.

This fix remplace .gif file by .png

* CustomTitle and ChatPermissions support

setChatAdministratorCustomTitle
setChatPermissions

* Update Readme

Update Badge Telegram API Version

* Minor Fix and Fix setChatPhoto

The Telegram Bots api has a bug that they are fixing and gives problems with the previous image. While they don't fix it, the image replacement is the fastest solution

* Minor Fix and Add Test

Fixed setChatPermissions

Test:
- sendDice
- getMyCommands
- setMyCommands
- setChatAdministratorCustomTitle
- setChatPermissions

* Update Changelog and Package.json version

* Fix typos in Changelog

* Add support for poll_answer

From: https://github.com/yagop/node-telegram-bot-api/pull/777

* Add JieJiSS contribution in Changelog

* Add sendPoll Test

* Add unpinAllChatMessages Support

* Add copyMessage support

* Add close and logOut Support

* Add Test + Minor fixes

* Update CHANGELOG

Update version 0.50.1

* Update Readme Bot API Badge

* Update Version to 0.51.0

* Bot API 5.1 support Improved Invite Links

- Added the method createChatInviteLink
- Added the method editChatInviteLink
- Added the method revokeChatInviteLink

* Update version to 0.52.0 and new tests

- Update Changelog
- New Test
- Update version to 0.52.0

* Add new messageTypes

-  voice_chat_started
-  voice_chat_ended
- voice_chat_participants_invited

* Update Changelog and add new MessageType

* New messageTypes and updates

Add support for new messageTypes:
  - chat_invite_link
  - chat_member_updated

Add support for new updates:
 - my_chat_member
 - chat_member

* Telegram Bot API 5.2 Support

* Update Changelog + readme

* Fix Changelog

* Telegram Bot API v5.3

Add new methods:
* deleteMyCommands
* banChatMember
* getChatMemberCount

Deprecated:
 * Method kickChatMember()
 * Method getChatMembersCount()

New Test:
  * deleteMyCommands
  * banChatMember
  * getChatMemberCount

* docs: gen on linux

Co-authored-by: Mohammed Sohail <sohailsameja@gmail.com>
2021-06-29 11:38:33 +03:00
elihaidv
7738677b45
setStickerSetThumb function added
https://core.telegram.org/bots/api#setstickersetthumb

Now you can add thumb image to the sticker set
2020-12-28 18:47:38 +02:00
18 changed files with 7098 additions and 3540 deletions

View File

@ -7,7 +7,8 @@
"no-param-reassign": [2,{"props":false}],
"max-len": [2, 200],
"arrow-body-style": 0,
"comma-dangle": 0
"comma-dangle": 0,
"indent": ["error", 2]
},
"plugins": [
"mocha"

View File

@ -2,7 +2,274 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [0.52.1][0.52.1] - 2021-04-26
## [0.68.0][0.68.0] - UNRELEASE
1. Support Telegram Bot API 9.1 (@danielperez9430)
* sendChecklist
* editMessageChecklist
* getMyStarBalance
2. Support Telegram Bot API 9.0 (@danielperez9430)
* readBusinessMessage
* deleteBusinessMessages
* setBusinessAccountName
* setBusinessAccountUsername
* setBusinessAccountBio
* setBusinessAccountProfilePhoto
* removeBusinessAccountProfilePhoto
* setBusinessAccountGiftSettings
* getBusinessAccountStarBalance
* transferBusinessAccountStars
* getBusinessAccountGifts
* convertGiftToStars
* upgradeGift
* transferGift
* postStory
* editStory
* deleteStory
* giftPremiumSubscription
3. Support Telegram Bot API 8.2 and 8.3 (@danielperez9430)
* verifyUser
* verifyChat
* removeUserVerification
* removeChatVerification
4. Support Telegram Bot API 8.0 and 8.1
* savePreparedInlineMessage (@IsmailBinMujeeb & @danielperez9430)
* setUserEmojiStatus (@danielperez9430)
* editUserStarSubscription (@danielperez9430)
* getAvailableGifts (@danielperez9430)
* sendGift (@danielperez9430)
5. Support Telegram Bot API 7.10 (@danielperez9430)
* Update: `purchased_paid_media`
6. Support Telegram Bot API 7.6 (@danielperez9430)
* sendPaidMedia
## [0.67.0][0.67.0] - 2024-05-30
1. Support Telegram Bot API 7.4 (@danielperez9430)
* refundStarPayment
## [0.66.0][0.66.0] - 2024-05-03
1. Support Telegram Bot API 7.2 & 7.3 (@danielperez9430)
* getBusinessConnection
* replaceStickerInSet
2. Support for updates: (@danielperez9430)
* business_connection
* business_message
* edited_business_message
* deleted_business_messages
3. Minor fixes: (@danielperez9430)
* getUserChatBoosts
## [0.65.1][0.65.1] - 2024-03-09
1. Support for updates (@danielperez9430)
* message_reaction
* message_reaction_count
* chat_boost
* removed_chat_boost
## [0.65.0][0.65.0] - 2024-02-20
1. Support Telegram Bot API v7.1
* deleteMessages (@Sp3ricka)
* copyMessages (@xjx0106 & @Sp3ricka)
* setMessageReaction (@Sp3ricka)
* forwardMessages (@danielperez9430)
* getUserChatBoosts (@danielperez9430)
2. Minor changes: (@danielperez9430)
* Refactor methods order
* Fix copyMessages & setMessageReaction methods
* Added missing tests
* Fix tests for methods copyMessages & getMyDefaulAdministratorRights
## [0.64.0][0.64.0] - 2023-10-25
1. Replace `request` with a maintained version (@danielperez9430)
* Change `request` to `@cypress/request`
* Change `request-promise` to `@cypress/request-promise`
## [0.63.0][0.63.0] - 2023-08-23
1. Support Telegram Bot API v6.8 (@danielperez9430)
* unpinAllGeneralForumTopicMessages
## [0.62.0][0.62.0] - 2023-03-19
1. Support Telegram Bot API v6.6 & v6.7 (@danielperez9430)
* setMyDescription
* getMyDescription
* setMyShortDescription
* getMyShortDescription
* setCustomEmojiStickerSetThumbnail
* setStickerSetTitle
* deleteStickerSet
* setStickerEmojiList
* setStickerKeywords
* setStickerMaskPosition
## [0.61.0][0.61.0] - 2022-12-30
1. Support Telegram Bot API v6.4 (@danielperez9430)
* editGeneralForumTopic
* closeGeneralForumTopic
* reopenGeneralForumTopic
* hideGeneralForumTopic
* unhideGeneralForumTopic
2. Minor changes: (@danielperez9430)
* The parameters `name` and `icon_custom_emoji_id` of the method `editForumTopic` are now optional.
* Fix add thumb in sendAudio, sendVideo and sendVideoNote
* Fix getMyCommands and setMyCommands
* Suggested tip amounts stringify in sendInvoice
## [0.60.0][0.60.0] - 2022-10-06
1. Support Telegram Bot API v6.3 (@danielperez9430)
* createForumTopic
* closeForumTopic
* reopenForumTopic
* deleteForumTopic
* unpinAllForumTopicMessages
* getForumTopicIconStickers
2. Fix test getMyDefaultAdministratorRights (@danielperez9430)
3. Fix parse entities - (@toniop99)
## [0.59.0][0.59.0] - 2022-08-15
1. Support Telegram Bot API v6.2 (@danielperez9430)
* getCustomEmojiStickers
2. Support test enviroment (@tinsaeDev & @kamikazechaser)
3. Remove dependencies: (@danielperez9430)
* Remove *bluebird* => Use NodeJS Native Promises
* Remove *depd* => Use node native deprecate util for warnings
* Remove contributor dev dependency and add list of contributors in the readme
4. Remove legacy methods: (@danielperez9430)
* getChatMembersCount
* kickChatMember
5. Docs: (@danielperez9430)
* Update the docs of the methods
* Order methods follow the Telegram bot API docs in src/telegram.js
* Update README
6. Fix: (@danielperez9430)
* addStickerToSet() -> Allow to send tgs_sticker + webm_sticker
* Remove mandatory param “start_parameter” from sendInvoice, because in the docs is a optional param
* getStickerSet test fix deprecated response value "contains_masks" change to "sticker_type"
* Fix some other tests
7. New Test: (@danielperez9430)
* deleteStickerFromSet
* setStickerPositionInSet
* getCustomEmojiStickers
## [0.58.0][0.58.0] - 2022-06-22
1. Support Bot API v6.1: (@danielperez9430)
* Add method *createInvoiceLink()*
2. Support for setStickerSetThumb (@elihaidv)
3. Add new test (@danielperez9430)
* createInvoiceLink
4. Test fixes (@danielperez9430)
* sendVideoNote
* createNewStickerSet
* setStickerSetThumb
* getChatMenuButton
* setWebHook
5. Bug fixes (@danielperez9430)
* answerWebAppQuery
* Support for send thumb in sendAudio
## [0.57.0][0.57.0] - 2022-04-23
Added:
1. Support Bot API v6: (@danielperez9430)
* Add method *setChatMenuButton()*
* Add method *getChatMenuButton()*
* Add method *setMyDefaultAdministratorRights()*
* Add method *getMyDefaultAdministratorRights()*
* Add method *answerWebAppQuery()*
* Renamed the fields voice_chat_scheduled, voice_chat_started, voice_chat_ended, and voice_chat_participants_invited to video_chat_scheduled, video_chat_started, video_chat_ended, and video_chat_participants_invited
Tests:
* answerWebAppQuery
* setChatMenuButton
* getChatMenuButton
* setMyDefaultAdministratorRights
* getMyDefaultAdministratorRights
## [0.56.0][0.56.0] - 2021-12-07
Added:
1. Support Bot API v5.5: (@danielperez9430)
* Add method *banChatSenderChat()*
* Add method *unbanChatSenderChat()*
Fixes:
* Tests for support with new invite link format
## [0.55.0][0.55.0] - 2021-11-06
Added:
1. Support Bot API v5.4: (@danielperez9430)
* Add method *approveChatJoinRequest()*
* Add method *declineChatJoinRequest()*
* Add support for new updates:
* *chat_join_request*
Fixes:
* Method *editMessageMedia*: Now you can send a local file (`"attach://" + filePatch`)
## [0.54.0][0.54.0] - 2021-06-29
Added:
1. Support Bot API v5.3: (@danielperez9430)
* Add method *deleteMyCommands()*
* Add method *banChatMember()*
* Add method *getChatMemberCount()*
New Test:
* deleteMyCommands
* banChatMember
* getChatMemberCount
Deprecated:
* Method *kickChatMember()*
* Method *getChatMembersCount()*
## [0.53.0][0.53.0] - 2021-04-26
Added:

View File

@ -5,24 +5,30 @@
Node.js module to interact with the official [Telegram Bot API](https://core.telegram.org/bots/api).
[![Bot API](https://img.shields.io/badge/Bot%20API-v.5.2-00aced.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api)
[![Bot API](https://img.shields.io/badge/Bot%20API-v.9.0-00aced.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api)
[![npm package](https://img.shields.io/npm/v/node-telegram-bot-api?logo=npm&style=flat-square)](https://www.npmjs.org/package/node-telegram-bot-api)
[![Build Status](https://img.shields.io/travis/yagop/node-telegram-bot-api/master?style=flat-square&logo=travis)](https://travis-ci.org/yagop/node-telegram-bot-api)
[![Coverage Status](https://img.shields.io/codecov/c/github/yagop/node-telegram-bot-api?style=flat-square&logo=codecov)](https://codecov.io/gh/yagop/node-telegram-bot-api)
[![https://telegram.me/node_telegram_bot_api](https://img.shields.io/badge/💬%20Telegram-Channel-blue.svg?style=flat-square)](https://telegram.me/node_telegram_bot_api)
[![https://telegram.me/ntbasupport](https://img.shields.io/badge/💬%20Telegram-Group-blue.svg?style=flat-square)](https://telegram.me/ntbasupport)
[![https://t.me/+_IC8j_b1wSFlZTVk](https://img.shields.io/badge/💬%20Telegram-Group-blue.svg?style=flat-square)](https://t.me/+_IC8j_b1wSFlZTVk)
[![https://telegram.me/Yago_Perez](https://img.shields.io/badge/💬%20Telegram-Yago_Perez-blue.svg?style=flat-square)](https://telegram.me/Yago_Perez)
</div>
## Install
## 📦 Install
```sh
npm i node-telegram-bot-api
```
## Usage
<br/>
> ✍️ **Note:** If you use Typescript you can install this package that contains type definitions for this library
>```sh
>npm install --save-dev @types/node-telegram-bot-api
>```
## 🚀 Usage
```js
const TelegramBot = require('node-telegram-bot-api');
@ -56,22 +62,22 @@ bot.on('message', (msg) => {
});
```
## Documentation
## 📚 Documentation
* [Usage][usage]
* [Examples][examples]
* [Tutorials][tutorials]
* [Help Information][help]
* API Reference [api-release] / [development][api-dev] / [experimental][api-experimental])
* API Reference: ([api-release](../master/doc/api.md) / [development][api-dev] / [experimental][api-experimental])
* [Contributing to the Project][contributing]
* [Experimental Features][experimental]
_**Note**: Development is done against the **master** branch.
Code for the latest release resides on the **release** branch.
_**Note**: Development is done against the **development** branch.
Code for the latest release resides on the **master** branch.
Experimental features reside on the **experimental** branch._
## Community
## 💭 Community
We thank all the developers in the Open-Source community who continuously
take their time and effort in advancing this project.
@ -89,8 +95,19 @@ Some things built using this library that might interest you:
* [teleirc](https://github.com/FruitieX/teleirc): A simple Telegram ↔ IRC gateway
* [bot-brother](https://github.com/SerjoPepper/bot-brother): Node.js library to help you easily create telegram bots
* [redbot](https://github.com/guidone/node-red-contrib-chatbot): A Node-RED plugin to create telegram bots visually
* [node-telegram-keyboard-wrapper](https://github.com/alexandercerutti/node-telegram-keyboard-wrapper): A wrapper to improve `reply_markup` structures creation in an easy way (supports Inline Keyboards, Reply Keyboard, Remove Keyboard and Force Reply)
* [node-telegram-operation-manager](https://github.com/alexandercerutti/node-telegram-operation-manager): A utility to manage replies flows and commands. Let also create custom queues for your own bot.
* [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.
* [telegram-inline-calendar](https://github.com/VDS13/telegram-inline-calendar): Date and time picker and inline calendar for Node.js telegram bots.
* [telegram-captcha](https://github.com/VDS13/telegram-captcha): Telegram bot to protect Telegram groups from automatic bots.
## 👥 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
@ -109,4 +126,4 @@ Copyright © 2019 Yago
[contributors]:https://github.com/yagop/node-telegram-bot-api/graphs/contributors
[experimental]:https://github.com/yagop/node-telegram-bot-api/tree/master/doc/experimental.md
[tg-channel]:https://telegram.me/node_telegram_bot_api
[tg-group]:https://telegram.me/ntbasupport
[tg-group]:https://t.me/+nc3A9Hs1S81mYzdk

3616
doc/api.md

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
* [node-telegram-bot-api-tutorial by @hosein2398](https://github.com/hosein2398/node-telegram-bot-api-tutorial)
* [node-telegram-bot-api-persian-language by @saeedhei](https://github.com/saeedhei/node-telegram-bot-api-persian-language)
* [Node.JS: Делаем своего Telegram бота [RUS]](https://archakov.im/post/telegram-bot-on-nodejs.html)
* [Node.JS: Делаем своего Telegram бота [RUS]](https://archakov.im/post/telegram-bot-on-nodejs)
* [YouTube: Пишем Telegram бота на NodeJS [RUS]](https://www.youtube.com/watch?v=RS1nmDMf69U&list=PL6AOr-PZtK-mM2QC1ixyfa5CtJZGK61aN)
* [Node.jsでTelegramのチャットボットを作る - Qiita](https://qiita.com/neetshin/items/0e2f6fa3ade41adb77bc)
* [Guía: Creación de bots de Telegram en Nodejs [ES]](https://tecnonucleous.com/creacion-de-bots-de-telegram-en-nodejs/)

View File

@ -1,9 +1,14 @@
# Usage
* [Events](#events)
* [WebHooks](#webhooks)
* [Sending files](#sending-files)
* [Error handling](#error-handling)
- [Usage](#usage)
- [Events](#events)
- [WebHooks](#webhooks)
- [Sending files](#sending-files)
- [File Options (metadata)](#file-options-metadata)
- [Performance Issue](#performance-issue)
- [Error handling](#error-handling)
- [Polling errors](#polling-errors)
- [WebHook errors](#webhook-errors)
<a name="events"></a>
## Events
@ -35,9 +40,13 @@ that emits the following events:
1. `shipping_query`: Received a new incoming shipping query
1. `pre_checkout_query`: Received a new incoming pre-checkout query
1. `poll`: Received a new incoming poll
1. `polling_error`: Error occurred during polling. See [polling errors](#polling-errors).
1. `webhook_error`: Error occurred handling a webhook request. See [webhook errors](#webhook-errors).
1. `error`: Unexpected error occurred, usually fatal!
2. `poll_answer`: A user has changed their answer in a non-anonymous poll (Only polls sent by the bot)
3. `chat_member`: A chat member's status was updated in a chat
4. `my_chat_member`: The bot's chat member status was updated in a chat
5. `chat_join_request`: A request to join the chat has been sent (The bot must have the can_invite_users administrator right)
5. `polling_error`: Error occurred during polling. See [polling errors](#polling-errors).
6. `webhook_error`: Error occurred handling a webhook request. See [webhook errors](#webhook-errors).
7. `error`: Unexpected error occurred, usually fatal!
**Tip:** Its much better to listen a specific event rather than on
`message` in order to stay safe from the content.

View File

@ -6,7 +6,7 @@
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
const TelegramBot = require('..');
const request = require('request');
const request = require('@cypress/request');
const options = {
polling: true
};

View File

@ -5,7 +5,7 @@
*/
const majorVersion = parseInt(process.versions.node.split('.')[0], 10);
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');
module.exports = require('./lib/telegram');
} else {

View File

@ -1,6 +1,6 @@
{
"name": "node-telegram-bot-api",
"version": "0.53.0",
"version": "0.68.0",
"description": "Telegram Bot API",
"main": "./index.js",
"directories": {
@ -29,17 +29,15 @@
"node": ">=0.12"
},
"dependencies": {
"@cypress/request": "^3.0.8",
"@cypress/request-promise": "^5.0.0",
"array.prototype.findindex": "^2.0.2",
"bl": "^1.2.3",
"bluebird": "^3.5.1",
"debug": "^3.1.0",
"depd": "^1.1.1",
"debug": "^3.2.7",
"eventemitter3": "^3.0.0",
"file-type": "^3.9.0",
"mime": "^1.6.0",
"pump": "^2.0.0",
"request": "^2.83.0",
"request-promise": "^4.2.2"
"pump": "^2.0.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
@ -54,7 +52,6 @@
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.26.0",
"concat-stream": "^1.6.0",
"contributor": "^0.1.25",
"eslint": "^2.13.1",
"eslint-config-airbnb": "^6.2.0",
"eslint-plugin-mocha": "^4.11.0",
@ -73,484 +70,5 @@
"bugs": {
"url": "https://github.com/yagop/node-telegram-bot-api/issues"
},
"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
}
]
}
"homepage": "https://github.com/yagop/node-telegram-bot-api"
}

View File

@ -30,7 +30,10 @@ exports.FatalError = class FatalError extends exports.BaseError {
const error = (typeof data === 'string') ? null : data;
const message = error ? error.message : data;
super('EFATAL', message);
if (error) this.stack = error.stack;
if (error) {
this.stack = error.stack;
this.cause = error;
}
}
};

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
const errors = require('./errors');
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;

View File

@ -4,8 +4,6 @@ const https = require('https');
const http = require('http');
const fs = require('fs');
const bl = require('bl');
const Promise = require('bluebird');
class TelegramBotWebHook {
/**
@ -52,12 +50,16 @@ class TelegramBotWebHook {
if (this.isOpen()) {
return Promise.resolve();
}
return new Promise(resolve => {
return new Promise((resolve, reject) => {
this._webServer.listen(this.options.port, this.options.host, () => {
debug('WebHook listening on port %s', this.options.port);
this._open = true;
return resolve();
});
this._webServer.once('error', (err) => {
reject(err);
});
});
}

3
src/utils.js Normal file
View File

@ -0,0 +1,3 @@
const util = require('util');
// Native deprecation warning
exports.deprecate = (msg) => util.deprecate(() => { }, msg, 'node-telegram-bot-api')();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 52 KiB

BIN
test/data/sticker_thumb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

File diff suppressed because it is too large Load Diff

View File

@ -81,8 +81,7 @@ exports = module.exports = {
const assert = require('assert');
const http = require('http');
const Promise = require('bluebird');
const request = require('request-promise');
const request = require('@cypress/request-promise');
const statics = require('node-static');
const servers = {};