node-telegram-bot-api
node-telegram-bot-api copied to clipboard
add getStarTransactions from Bot API 7.5
Feature Request
This code adds getStarTransactions method and required type (https://core.telegram.org/bots/api#getstartransactions)
src/telegram.js
/**
* Use this method to get the bot's Telegram Star transactions.
* On success, returns a [StarTransactions](https://core.telegram.org/bots/api#startransactions) object.
* @param {Object} [options] Additional Telegram query options
* @return {Promise}
* @see https://core.telegram.org/bots/api#startransactions
*/
getStarTransactions(form = {}) {
return this._request('getStarTransactions', { form });
}
test/telegram.js
describe('#getStarTransactions', function getStarTransactions() {
before(function before() {
utils.handleRatelimit(bot, 'getStarTransactions', this);
});
it('should return StarTransactions object', function test() {
return bot.getWebHookInfo().then(resp => {
assert.ok(is.object(resp));
});
});
});
type definitions index.d.ts (https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-telegram-bot-api)
interface StarTransaction {
id: string;
amount: number;
date: number;
}
getStarTransactions(): Promise<TelegramBot.StarTransaction[]>;