Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
coverage/
.nyc_output/
npm-debug.log
.package.json
package-lock.json
51 changes: 51 additions & 0 deletions doc/api.md
Original file line number Diff line number Diff line change
@@ -73,6 +73,8 @@ TelegramBot
* [.exportChatInviteLink(chatId, [options])](#TelegramBot+exportChatInviteLink) ⇒ <code>Promise</code>
* [.createChatInviteLink(chatId, [options])](#TelegramBot+createChatInviteLink) ⇒ <code>Object</code>
* [.editChatInviteLink(chatId, inviteLink, [options])](#TelegramBot+editChatInviteLink) ⇒ <code>Promise</code>
* [.createChatSubscriptionInviteLink(chatId, subscriptionPeriod, subscriptionPrice, [options])](#TelegramBot+createChatSubscriptionInviteLink) ⇒ <code>Promise</code>
* [.editChatSubscriptionInviteLink(chatId, inviteLink, [options])](#TelegramBot+editChatSubscriptionInviteLink) ⇒ <code>Promise</code>
* [.revokeChatInviteLink(chatId, inviteLink, [options])](#TelegramBot+revokeChatInviteLink) ⇒ <code>Promise</code>
* [.approveChatJoinRequest(chatId, userId, [options])](#TelegramBot+approveChatJoinRequest) ⇒ <code>Promise</code>
* [.declineChatJoinRequest(chatId, userId, [options])](#TelegramBot+declineChatJoinRequest) ⇒ <code>Promise</code>
@@ -146,6 +148,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>
* [.getStarTransactions([options])](#TelegramBot+getStarTransactions) ⇒ <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>
@@ -1172,6 +1175,41 @@ The bot **must be an administrator in the chat** for this to work and must have
| inviteLink | <code>String</code> | Text with the invite link to edit |
| [options] | <code>Object</code> | Additional Telegram query options |

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

### telegramBot.createChatSubscriptionInviteLink(chatId, subscriptionPeriod, subscriptionPrice, [options]) ⇒ <code>Promise</code>
Use this method to create a subscription invite link for a channel chat.

The bot must have the can_invite_users administrator rights

**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Promise</code> - The new invite link as a [ChatInviteLink](https://core.telegram.org/bots/api#chatinvitelink) object
**See**: https://core.telegram.org/bots/api#createchatsubscriptioninvitelink

| Param | Type | Description |
| --- | --- | --- |
| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) |
| subscriptionPeriod | <code>Number</code> | The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days) |
| subscriptionPrice | <code>Number</code> | 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) |
| [options] | <code>Object</code> | Additional Telegram query options |

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

### telegramBot.editChatSubscriptionInviteLink(chatId, inviteLink, [options]) ⇒ <code>Promise</code>
Use this method to edit a subscription invite link created by the bot.

The bot must have the can_invite_users administrator rights

**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Promise</code> - The new invite link as a [ChatInviteLink](https://core.telegram.org/bots/api#chatinvitelink) object
**See**: https://core.telegram.org/bots/api#editchatsubscriptioninvitelink

| Param | Type | Description |
| --- | --- | --- |
| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) |
| inviteLink | <code>String</code> | The invite link to edit |
| [options] | <code>Object</code> | Additional Telegram query options |

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

### telegramBot.revokeChatInviteLink(chatId, inviteLink, [options]) ⇒ <code>Promise</code>
@@ -2365,6 +2403,19 @@ 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+getStarTransactions"></a>

### telegramBot.getStarTransactions([options]) ⇒ <code>Promise</code>
Use this method for get the bot's Telegram Star transactions in chronological order

**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Promise</code> - On success, returns a [StarTransactions](https://core.telegram.org/bots/api#startransactions) object
**See**: https://core.telegram.org/bots/api#getstartransactions

| Param | Type | Description |
| --- | --- | --- |
| [options] | <code>Object</code> | Additional Telegram query options |

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

### telegramBot.refundStarPayment(userId, telegramPaymentChargeId, [options]) ⇒ <code>Promise</code>
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
"eslint": "eslint ./src ./test ./examples",
"mocha": "mocha",
"pretest": "npm run build",
"test": "npm run eslint && istanbul cover ./node_modules/mocha/bin/_mocha"
"test": "npm run eslint && nyc --reporter=lcov --reporter=json --reporter=text-summary npm run mocha"
},
"author": "Yago Pérez <yagoperezs@gmail.com>",
"license": "MIT",
@@ -37,7 +37,7 @@
"eventemitter3": "^3.0.0",
"file-type": "^3.9.0",
"mime": "^1.6.0",
"pump": "^2.0.0"
"pump": "^3.0.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
@@ -57,11 +57,11 @@
"eslint-plugin-mocha": "^4.11.0",
"is": "^3.2.1",
"is-ci": "^1.0.10",
"istanbul": "^1.1.0-alpha.1",
"jsdoc-to-markdown": "^3.0.3",
"mocha": "^3.5.3",
"mocha": "^10.7.3",
"mocha-lcov-reporter": "^1.3.0",
"node-static": "^0.7.10"
"node-static": "^0.7.10",
"nyc": "^17.0.0"
},
"repository": {
"type": "git",
@@ -71,4 +71,4 @@
"url": "https://github.com/yagop/node-telegram-bot-api/issues"
},
"homepage": "https://github.com/yagop/node-telegram-bot-api"
}
}