From 766b4344a8bc3861c1eef43333a4887ac8ed2879 Mon Sep 17 00:00:00 2001 From: danielperez9430 Date: Fri, 6 Sep 2024 00:07:16 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7:=20Support=20bot=20api=20v7.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added: * getStarTransactions (v7.5) * createChatSubscriptionInviteLink (v7.9) * editChatSubscriptionInviteLink (v7.9) --- src/telegram.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/telegram.js b/src/telegram.js index b527a9f..97c70cf 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -1719,6 +1719,42 @@ class TelegramBot extends EventEmitter { return this._request('editChatInviteLink', { form }); } + /** + * Use this method to create a subscription invite link for a channel chat. + * + * The bot must have the can_invite_users administrator rights + * + * @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) + * @param {Number} subscriptionPeriod The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days) + * @param {Number} subscriptionPrice The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat (1-2500) + * @param {Object} [options] Additional Telegram query options + * @return {Promise} The new invite link as a [ChatInviteLink](https://core.telegram.org/bots/api#chatinvitelink) object + * @see https://core.telegram.org/bots/api#createchatsubscriptioninvitelink + */ + createChatSubscriptionInviteLink(chatId, subscriptionPeriod, subscriptionPrice, form = {}) { + form.chat_id = chatId; + form.subscription_period = subscriptionPeriod; + form.subscription_price = subscriptionPrice; + return this._request('createChatSubscriptionInviteLink', { form }); + } + + /** + * Use this method to edit a subscription invite link created by the bot. + * + * The bot must have the can_invite_users administrator rights + * + * @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) + * @param {String} inviteLink The invite link to edit + * @param {Object} [options] Additional Telegram query options + * @return {Promise} The new invite link as a [ChatInviteLink](https://core.telegram.org/bots/api#chatinvitelink) object + * @see https://core.telegram.org/bots/api#editchatsubscriptioninvitelink + */ + editChatSubscriptionInviteLink(chatId, inviteLink, form = {}) { + form.chat_id = chatId; + form.invite_link = inviteLink; + return this._request('editChatSubscriptionInviteLink', { form }); + } + /** * Use this method to revoke an invite link created by the bot. * Note: If the primary link is revoked, a new link is automatically generated @@ -3025,6 +3061,17 @@ class TelegramBot extends EventEmitter { return this._request('answerPreCheckoutQuery', { form }); } + /** + * Use this method for get the bot's Telegram Star transactions in chronological order + * + * @param {Object} [options] Additional Telegram query options + * @return {Promise} On success, returns a [StarTransactions](https://core.telegram.org/bots/api#startransactions) object + * @see https://core.telegram.org/bots/api#getstartransactions + */ + getStarTransactions(form = {}) { + return this._request('getStarTransactions', { form }); + } + /** * Use this method for refund a successful payment in [Telegram Stars](https://t.me/BotNews/90) *