mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-29 13:27:44 +00:00
Added getChat, getChatAdministrators, getChatMembersCount and getChatMember
This commit is contained in:
parent
335a5045d8
commit
67344660d4
55
README.md
55
README.md
@ -84,6 +84,10 @@ TelegramBot
|
|||||||
* [.downloadFile(fileId, downloadDir)](#TelegramBot+downloadFile) ⇒ <code>Promise</code>
|
* [.downloadFile(fileId, downloadDir)](#TelegramBot+downloadFile) ⇒ <code>Promise</code>
|
||||||
* [.onText(regexp, callback)](#TelegramBot+onText)
|
* [.onText(regexp, callback)](#TelegramBot+onText)
|
||||||
* [.onReplyToMessage(chatId, messageId, callback)](#TelegramBot+onReplyToMessage)
|
* [.onReplyToMessage(chatId, messageId, callback)](#TelegramBot+onReplyToMessage)
|
||||||
|
* [.getChat(chatId)](#TelegramBot+getChat) ⇒ <code>Promise</code>
|
||||||
|
* [.getChatAdministrators(chatId)](#TelegramBot+getChatAdministrators) ⇒ <code>Promise</code>
|
||||||
|
* [.getChatMembersCount(chatId)](#TelegramBot+getChatMembersCount) ⇒ <code>Promise</code>
|
||||||
|
* [.getChatMember(chatId, userId)](#TelegramBot+getChatMember) ⇒ <code>Promise</code>
|
||||||
|
|
||||||
<a name="new_TelegramBot_new"></a>
|
<a name="new_TelegramBot_new"></a>
|
||||||
|
|
||||||
@ -362,7 +366,7 @@ Note that you must provide one of chat_id, message_id, or
|
|||||||
inline_message_id in your request.
|
inline_message_id in your request.
|
||||||
|
|
||||||
**Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code>
|
**Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code>
|
||||||
**See**: https://core.telegram.org/bots/api#editmessagetext
|
**See**: https://core.telegram.org/bots/api#editmessagecaption
|
||||||
|
|
||||||
| Param | Type | Description |
|
| Param | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
@ -489,4 +493,53 @@ Register a reply to wait for a message response.
|
|||||||
| messageId | <code>Number</code> | <code>String</code> | The message id to be replied. |
|
| messageId | <code>Number</code> | <code>String</code> | The message id to be replied. |
|
||||||
| callback | <code>function</code> | Callback will be called with the reply message. |
|
| callback | <code>function</code> | Callback will be called with the reply message. |
|
||||||
|
|
||||||
|
<a name="TelegramBot+getChat"></a>
|
||||||
|
|
||||||
|
### telegramBot.getChat(chatId) ⇒ <code>Promise</code>
|
||||||
|
Returns information about the chat in form of a `Chat` object.
|
||||||
|
|
||||||
|
**Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code>
|
||||||
|
**See**: https://core.telegram.org/bots/api#getchat
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| chatId | <code>Number</code> | <code>String</code> | Unique identifier for the target group or username of the target supergroup |
|
||||||
|
|
||||||
|
<a name="TelegramBot+getChatAdministrators"></a>
|
||||||
|
|
||||||
|
### telegramBot.getChatAdministrators(chatId) ⇒ <code>Promise</code>
|
||||||
|
Returns the administrators in a chat in form of an Array of `ChatMember` objects.
|
||||||
|
|
||||||
|
**Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code>
|
||||||
|
**See**: https://core.telegram.org/bots/api#getchatadministrators
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| chatId | <code>Number</code> | <code>String</code> | Unique identifier for the target group or username of the target supergroup |
|
||||||
|
|
||||||
|
<a name="TelegramBot+getChatMembersCount"></a>
|
||||||
|
|
||||||
|
### telegramBot.getChatMembersCount(chatId) ⇒ <code>Promise</code>
|
||||||
|
Returns the number of members in a chat in form of an `Int` object.
|
||||||
|
|
||||||
|
**Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code>
|
||||||
|
**See**: https://core.telegram.org/bots/api#getchatmemberscount
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| chatId | <code>Number</code> | <code>String</code> | Unique identifier for the target group or username of the target supergroup |
|
||||||
|
|
||||||
|
<a name="TelegramBot+getChatMember"></a>
|
||||||
|
|
||||||
|
### telegramBot.getChatMember(chatId, userId) ⇒ <code>Promise</code>
|
||||||
|
Returns information about a member of a chat in form of a `ChatMember` object.
|
||||||
|
|
||||||
|
**Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code>
|
||||||
|
**See**: https://core.telegram.org/bots/api#getchatmember
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| chatId | <code>Number</code> | <code>String</code> | Unique identifier for the target group or username of the target supergroup |
|
||||||
|
| userId | <code>String</code> | Unique identifier of the target user |
|
||||||
|
|
||||||
* * *
|
* * *
|
||||||
|
@ -699,6 +699,60 @@ class TelegramBot extends EventEmitter {
|
|||||||
callback
|
callback
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns information about the chat in form of a `Chat` object.
|
||||||
|
* @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup
|
||||||
|
* @return {Promise}
|
||||||
|
* @see https://core.telegram.org/bots/api#getchat
|
||||||
|
*/
|
||||||
|
getChat(chatId) {
|
||||||
|
const form = {
|
||||||
|
chat_id: chatId
|
||||||
|
};
|
||||||
|
return this._request('getChat', { form });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the administrators in a chat in form of an Array of `ChatMember` objects.
|
||||||
|
* @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup
|
||||||
|
* @return {Promise}
|
||||||
|
* @see https://core.telegram.org/bots/api#getchatadministrators
|
||||||
|
*/
|
||||||
|
getChatAdministrators(chatId) {
|
||||||
|
const form = {
|
||||||
|
chat_id: chatId
|
||||||
|
};
|
||||||
|
return this._request('getChatAdministrators', { form });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of members in a chat in form of an `Int` object.
|
||||||
|
* @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup
|
||||||
|
* @return {Promise}
|
||||||
|
* @see https://core.telegram.org/bots/api#getchatmemberscount
|
||||||
|
*/
|
||||||
|
getChatMembersCount(chatId) {
|
||||||
|
const form = {
|
||||||
|
chat_id: chatId
|
||||||
|
};
|
||||||
|
return this._request('getChatMembersCount', { form });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns information about a member of a chat in form of a `ChatMember` object.
|
||||||
|
* @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup
|
||||||
|
* @param {String} userId Unique identifier of the target user
|
||||||
|
* @return {Promise}
|
||||||
|
* @see https://core.telegram.org/bots/api#getchatmember
|
||||||
|
*/
|
||||||
|
getChatMember(chatId, userId) {
|
||||||
|
const form = {
|
||||||
|
chat_id: chatId,
|
||||||
|
user_id: userId
|
||||||
|
};
|
||||||
|
return this._request('getChatMember', { form });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = TelegramBot;
|
module.exports = TelegramBot;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user