Skip to content

Commit

Permalink
feat: Support Telegram Bot API 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
danielperez9430 committed May 30, 2024
1 parent e7dd42c commit f40b421
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [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)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
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.3-00aced.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api)
[![Bot API](https://img.shields.io/badge/Bot%20API-v.7.4-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://t.me/+nc3A9Hs1S81mYzdk](https://img.shields.io/badge/💬%20Telegram-Group-blue.svg?style=flat-square)](https://t.me/+nc3A9Hs1S81mYzdk)
[![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>
Expand Down
16 changes: 16 additions & 0 deletions doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ TelegramBot
* [.createInvoiceLink(title, description, payload, providerToken, currency, prices, [options])](#TelegramBot+createInvoiceLink) ⇒ <code>Promise</code>
* [.answerShippingQuery(shippingQueryId, ok, [options])](#TelegramBot+answerShippingQuery) ⇒ <code>Promise</code>
* [.answerPreCheckoutQuery(preCheckoutQueryId, ok, [options])](#TelegramBot+answerPreCheckoutQuery) ⇒ <code>Promise</code>
* [.refundStarPayment(userId, telegramPaymentChargeId, [options])](#TelegramBot+refundStarPayment) ⇒ <code>Promise</code>
* [.sendGame(chatId, gameShortName, [options])](#TelegramBot+sendGame) ⇒ <code>Promise</code>
* [.setGameScore(userId, score, [options])](#TelegramBot+setGameScore) ⇒ <code>Promise</code>
* [.getGameHighScores(userId, [options])](#TelegramBot+getGameHighScores) ⇒ <code>Promise</code>
Expand Down Expand Up @@ -2364,6 +2365,21 @@ an [Update](https://core.telegram.org/bots/api#update) with the field *pre_check
| ok | <code>Boolean</code> | Specify if every order details are ok |
| [options] | <code>Object</code> | Additional Telegram query options |

<a name="TelegramBot+refundStarPayment"></a>

### telegramBot.refundStarPayment(userId, telegramPaymentChargeId, [options]) ⇒ <code>Promise</code>
Use this method for refund a successful payment in [Telegram Stars](https://t.me/BotNews/90)

**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Promise</code> - On success, True is returned
**See**: https://core.telegram.org/bots/api#refundstarpayment

| Param | Type | Description |
| --- | --- | --- |
| userId | <code>Number</code> | Unique identifier of the user whose payment will be refunded |
| telegramPaymentChargeId | <code>String</code> | Telegram payment identifier |
| [options] | <code>Object</code> | Additional Telegram query options |

<a name="TelegramBot+sendGame"></a>

### telegramBot.sendGame(chatId, gameShortName, [options]) ⇒ <code>Promise</code>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-telegram-bot-api",
"version": "0.66.0",
"version": "0.67.0",
"description": "Telegram Bot API",
"main": "./index.js",
"directories": {
Expand Down
15 changes: 15 additions & 0 deletions src/telegram.js
Original file line number Diff line number Diff line change
Expand Up @@ -3025,6 +3025,21 @@ class TelegramBot extends EventEmitter {
return this._request('answerPreCheckoutQuery', { form });
}

/**
* Use this method for refund a successful payment in [Telegram Stars](https://t.me/BotNews/90)
*
* @param {Number} userId Unique identifier of the user whose payment will be refunded
* @param {String} telegramPaymentChargeId Telegram payment identifier
* @param {Object} [options] Additional Telegram query options
* @return {Promise} On success, True is returned
* @see https://core.telegram.org/bots/api#refundstarpayment
*/
refundStarPayment(userId, telegramPaymentChargeId, form = {}) {
form.user_id = userId;
form.telegram_payment_charge_id = telegramPaymentChargeId;
return this._request('refundStarPayment', { form });
}

/**
* Use this method to send a game.
*
Expand Down

0 comments on commit f40b421

Please sign in to comment.