Skip to content
Merged
Show file tree
Hide file tree
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ editMessageCaption
editMessageReplyMarkup
kickChatMember
unbanChatMember
exportChatInviteLink
leaveChat
getChat
getChatAdministrators
Expand Down
31 changes: 31 additions & 0 deletions lib/telegram-bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -1396,6 +1396,8 @@ var TelegramApi = function (params)
if (params.cache_time !== undefined) args.cache_time = params.cache_time;
if (params.is_personal !== undefined) args.is_personal = params.is_personal;
if (params.next_offset !== undefined) args.next_offset = params.next_offset;
if (params.switch_pm_text !== undefined) args.switch_pm_text = params.switch_pm_text;
if (params.switch_pm_parameter !== undefined) args.switch_pm_parameter = params.switch_pm_parameter;

_rest({
method: 'POST',
Expand Down Expand Up @@ -1573,6 +1575,34 @@ var TelegramApi = function (params)
}).nodeify(cb);
};

/**
* METHOD: exportChatInviteLink
* PARAMS:
* chat_id Unique identifier for the target chat or username of the target channel — User or GroupChat id
*/
this.exportChatInviteLink = function (params, cb) {
var args = {};

if (params.chat_id !== undefined) args.chat_id = params.chat_id;

return new Promise(function(resolve, reject) {
_rest({
method: 'POST',
json: true,
formData: args,
uri: _baseurl + 'exportChatInviteLink'
})
.then(function(body) {
return commonResponseHandler(body);
})
.then(function(data) {
resolve(data);
})
.catch(function(err) {
reject(err);
});
}).nodeify(cb);
};

/**
* METHOD: deleteMessage
Expand Down Expand Up @@ -1648,6 +1678,7 @@ var TelegramApi = function (params)
this.deleteWebhook()
.then(function() {
internalGetUpdates();
return null; // avoid runaway promise warning, see http://goo.gl/rRqMUw
})
.catch(function(err) {
throw new Error(err)
Expand Down