Skip to content

Commit 766b434

Browse files
🚧: Support bot api v7.9
Added: * getStarTransactions (v7.5) * createChatSubscriptionInviteLink (v7.9) * editChatSubscriptionInviteLink (v7.9)
1 parent f40b421 commit 766b434

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

‎src/telegram.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,42 @@ class TelegramBot extends EventEmitter {
17191719
return this._request('editChatInviteLink', { form });
17201720
}
17211721

1722+
/**
1723+
* Use this method to create a subscription invite link for a channel chat.
1724+
*
1725+
* The bot must have the can_invite_users administrator rights
1726+
*
1727+
* @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
1728+
* @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)
1729+
* @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)
1730+
* @param {Object} [options] Additional Telegram query options
1731+
* @return {Promise} The new invite link as a [ChatInviteLink](https://core.telegram.org/bots/api#chatinvitelink) object
1732+
* @see https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
1733+
*/
1734+
createChatSubscriptionInviteLink(chatId, subscriptionPeriod, subscriptionPrice, form = {}) {
1735+
form.chat_id = chatId;
1736+
form.subscription_period = subscriptionPeriod;
1737+
form.subscription_price = subscriptionPrice;
1738+
return this._request('createChatSubscriptionInviteLink', { form });
1739+
}
1740+
1741+
/**
1742+
* Use this method to edit a subscription invite link created by the bot.
1743+
*
1744+
* The bot must have the can_invite_users administrator rights
1745+
*
1746+
* @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
1747+
* @param {String} inviteLink The invite link to edit
1748+
* @param {Object} [options] Additional Telegram query options
1749+
* @return {Promise} The new invite link as a [ChatInviteLink](https://core.telegram.org/bots/api#chatinvitelink) object
1750+
* @see https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
1751+
*/
1752+
editChatSubscriptionInviteLink(chatId, inviteLink, form = {}) {
1753+
form.chat_id = chatId;
1754+
form.invite_link = inviteLink;
1755+
return this._request('editChatSubscriptionInviteLink', { form });
1756+
}
1757+
17221758
/**
17231759
* Use this method to revoke an invite link created by the bot.
17241760
* Note: If the primary link is revoked, a new link is automatically generated
@@ -3025,6 +3061,17 @@ class TelegramBot extends EventEmitter {
30253061
return this._request('answerPreCheckoutQuery', { form });
30263062
}
30273063

3064+
/**
3065+
* Use this method for get the bot's Telegram Star transactions in chronological order
3066+
*
3067+
* @param {Object} [options] Additional Telegram query options
3068+
* @return {Promise} On success, returns a [StarTransactions](https://core.telegram.org/bots/api#startransactions) object
3069+
* @see https://core.telegram.org/bots/api#getstartransactions
3070+
*/
3071+
getStarTransactions(form = {}) {
3072+
return this._request('getStarTransactions', { form });
3073+
}
3074+
30283075
/**
30293076
* Use this method for refund a successful payment in [Telegram Stars](https://t.me/BotNews/90)
30303077
*

0 commit comments

Comments
 (0)