Constructor
new OpengramContext(update, telegram, options)
Constructor of Opengram context object
Name | Type | Description |
---|---|---|
update | Update | Raw update object from telegram |
telegram | Telegram | Instance of Telegram |
options | ContextOptions | Extra options |
- Source
Members
anyEntities
Returns MessageEntity array for current update.
Shortcut to
context.message.entities
context.editedMessage.entities
context.callbackQuery.message.entities
context.channelPost.entities
context.editedChannelPost.entities
context.message.caption_entities
context.editedMessage.caption_entities
context.callbackQuery.message.caption_entities
context.channelPost.caption_entities
context.editedChannelPost.caption_entities
- Source
anyMessage
Returns Message object for current update.
Shortcut to
context.message
context.editedMessage
context.callbackQuery.message
context.channelPost
context.editedChannelPost
- Source
anyText
Returns text for current update.
Shortcut to
context.message.caption
context.editedMessage.caption
context.callbackQuery.message.caption
context.ctx.channelPost.caption
context.editedChannelPost.caption
context.message.text
context.editedMessage.text
context.callbackQuery.message.text
context.ctx.channelPost.text
context.editedChannelPost.text
- Source
callbackQuery
Returns CallbackQuery object for current update
Shortcut to context.update.callback_query
- Source
channelPost
Returns channel post object for current update
Shortcut to context.update.channel_post
- Source
chat
Returns Chat object for current update
Shortcut to
context.myChatMember.chat
context.chatMember.chat
context.chatJoinRequest.chat
context.message.chat
context.editedMessage.chat
context.callbackQuery.message.chat
context.channelPost.chat
context.editedChannelPost.chat
- Source
chatJoinRequest
Returns ChatJoinRequest object for current update
Shortcut to context.update.chat_join_request
- Source
chatMember
Returns ChatMemberUpdated object for current update
Shortcut to context.update.chat_member
- Source
chosenInlineResult
Returns ChosenInlineResult object for current update
Shortcut to context.update.chosen_inline_result
- Source
editedChannelPost
Returns edited channel post object for current update
Shortcut to context.update.edited_channel_post
- Source
editedMessage
Returns edited message object for current update
Shortcut to context.update.edited_message
- Source
from
Returns User object for current update
Shortcut to
context.inlineQuery.from
context.shippingQuery.from
context.preCheckoutQuery.from
context.chosenInlineResult.from
context.myChatMember.from
context.chatJoinRequest.from
context.message.from
context.editedMessage.from
context.callbackQuery.message.from
context.channelPost.from
context.editedChannelPost.from
- Source
inlineMessageId
Returns inline message id string for current update
Shortcut to context.callbackQuery.inline_message_id
, context.chosenInlineResult.inline_message_id
- Source
inlineQuery
Returns InlineQuery object for current update
Shortcut to context.update.inline_query
- Source
me
Getter for getting bot username
- Source
message
Returns Message object for current update
Shortcut to context.update.message
- Source
myChatMember
Returns ChatMemberUpdated object for current update
Shortcut to context.update.my_chat_member
- Source
passportData
Returns PassportData object for current update
Shortcut to context.message.passport_data
- Source
poll
Returns Poll object for current update
Shortcut to context.update.poll
- Source
pollAnswer
Returns PollAnswer object for current update
Shortcut to context.update.poll_answer
- Source
preCheckoutQuery
Returns PreCheckoutQuery object for current update
Shortcut to context.update.pre_checkout_query
- Source
senderChat
Returns Chat object for current update
Shortcut to
context.message.sender_chat
context.editedMessage.sender_chat
context.callbackQuery.message.sender_chat
context.channelPost.sender_chat
context.editedChannelPost.sender_chat
- Source
shippingQuery
Returns ShippingQuery object for current update
Shortcut to context.update.shipping_query
- Source
state
Getter returns state object, available only in current update which be destroyed after update processed
You can store some temporary data for sharing with other middlewares in chain
- Source
state
Setter for state object, available only in current update which be destroyed after update processed
You can store some temporary data for sharing with other middlewares in chain
- Source
telegram
Returns instance of Telegram for api calls
Alias for context.tg
- Source
tg :Telegram
- Source
update :Update
- Source
updateType :UpdateType
- Source
webhookReply
Getter for webhookReply
Use this property to control reply via webhook feature for current context.
- Source
webhookReply
Setter for webhookReply
Use this property to control reply via webhook feature for current context.
- Source
Methods
addStickerToSet(name, extra, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to add a new sticker to a set created by the bot for user from current update. You must use exactly one of the fields png_sticker
, tgs_sticker
, or webm_sticker
. Animated stickers can be added to animated sticker sets and only to them. Animated sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | Sticker set name | |
extra | ExtraAddStickerToSet | Other parameters | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
answerCbQuery(textopt, showAlertopt, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to send answers to current callback query sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert.
Returns True
on success or WebhookResponse when webhook response enabled.
Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @BotFather and accept the terms. Otherwise, you may use links like t.me/your_bot?start=XXXX
that open your bot with a parameter.
Name | Type | Attributes | Description |
---|---|---|---|
text | string | <optional> | Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters |
showAlert | boolean | <optional> | If True, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false. |
extra | ExtraAnswerCbQuery | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
answerGameQuery(urlopt, signalopt) → {Promise}
Alias to answerCbQuery for game query
Name | Type | Attributes | Description |
---|---|---|---|
url | string | <optional> | URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @BotFather, specify the URL that opens your game - note that this will only work if the query comes from a |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise
answerInlineQuery(results, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to send answers to current inline query.
Returns True
on success or WebhookResponse when webhook response enabled. No more than 50 results per query are allowed.
Name | Type | Attributes | Description |
---|---|---|---|
results | Array.<InlineQueryResult> | A array of results for the inline query | |
extra | ExtraAnswerInlineQuery | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
answerPreCheckoutQuery(ok, errorMessageopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query
. Use this method to respond to current pre-checkout queries.
Returns True
on success or WebhookResponse when webhook response enabled.
Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
Name | Type | Attributes | Description |
---|---|---|---|
ok | boolean | Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems. | |
errorMessage | string | <optional> | Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
answerShippingQuery(ok, shippingOptionsopt, errorMessageopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
If you sent an invoice requesting a shipping address and the parameter is_flexible
was specified, the Bot API will send an Update with a shipping_query
field to the bot. Use this method to reply to cvurrent shipping queries.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
ok | boolean | Specify True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible) | |
shippingOptions | Array.<ShippingOption> | <optional> | Required if ok is True. Array of available shipping options. |
errorMessage | string | <optional> | Required if ok is False. Error message in human-readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user. |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
approveChatJoinRequest(userId, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to approve join request for chat from current update. The bot must be an administrator in the chat for this to work and must have the can_invite_users
administrator right.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
userId | number | Unique identifier of the target user | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
banChatMember(userId, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to ban a user in current group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
userId | number | Unique identifier of the target user | |
extra | ExtraBanChatMember | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
banChatSenderChat(senderChatId, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to ban a channel chat in current supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
senderChatId | number | Unique identifier of the target sender chat | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
closeForumTopic(signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
closeGeneralForumTopic(signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics
administrator rights.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
copyMessage(chatId, extraopt, signalopt) → {Promise.<MessageId>}
Use this method to copy messages of any kind from current chat. Service messages and invoice messages can't be copied. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message.
Returns the MessageId of the sent message on success.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
extra | ExtraCopyMessage | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<MessageId>
createChatInviteLink(extraopt, signalopt) → {Promise.<ChatInviteLink>}
Use this method to create an additional invite link for chat from current update. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink.
Returns the new invite link as ChatInviteLink object.
Name | Type | Attributes | Description |
---|---|---|---|
extra | ExtraCreateChatInviteLink | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<ChatInviteLink>
createForumTopic(name, extraopt, signalopt) → {Promise.<ForumTopic>}
Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights.
Returns information about the created topic as a ForumTopic object.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | Topic name, 1-128 characters | |
extra | ExtraCreateForumTopic | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<ForumTopic>
createInvoiceLink(invoice, signalopt) → {Promise.<string>}
Use this method to create a link for an invoice.
Returns the created invoice link as String
on success.
Name | Type | Attributes | Description |
---|---|---|---|
invoice | InvoiceLinkParams | Object with invoice properties | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<string>
createNewStickerSet(name, title, extra, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to create a new sticker set owned by current user. The bot will be able to edit the sticker set thus created. You must use exactly one of the fields png_sticker
, tgs_sticker
, or webm_sticker
.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | Short name of sticker set, to be used in | |
title | string | Sticker set title, 1-64 characters | |
extra | ExtraCreateNewStickerSet | Other parameters | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
declineChatJoinRequest(userId, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to decline join request for chat from current update. The bot must be an administrator in the chat for this to work and must have the can_invite_users
administrator right.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
userId | number | Unique identifier of the target user | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
deleteChatPhoto(signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to delete current chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
deleteChatStickerSet(signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to delete a group sticker set from current supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set
optionally returned in getChat requests to check if the bot can use this method.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
deleteForumTopic(signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
deleteMessage(messageId, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to delete message from current update or message with id specified in arguments, including service messages, with the following limitations:
- A message can only be deleted if it was sent less than 48 hours ago.
- A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.
- Bots can delete outgoing messages in private chats, groups, and supergroups.
- Bots can delete incoming messages in private chats.
- Bots granted can_post_messages permissions can delete outgoing messages in channels.
- If the bot is an administrator of a group, it can delete any message there.
- If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
messageId | number | Identifier of the message to delete | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
deleteMyCommands(extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
extra | ExtraDeleteMyCommands | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
deleteStickerFromSet(sticker, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to delete a sticker from a set created by the bot.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
sticker | string | File identifier of the sticker | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
editChatInviteLink(inviteLink, extraopt, signalopt) → {Promise.<ChatInviteLink>}
Use this method to edit a non-primary invite link created by the bot for chat from current update. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
Returns the edited invite link as a ChatInviteLink object.
Name | Type | Attributes | Description |
---|---|---|---|
inviteLink | string | The invite link to edit | |
extra | ExtraEditChatInviteLink | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<ChatInviteLink>
editForumTopic(nameopt, iconCustomEmojiIdopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | <optional> | Topic name, 1-128 characters |
iconCustomEmojiId | string | <optional> | New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
editGeneralForumTopic(name, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics
administrator rights.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | New topic name, 1-128 characters | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
editMessageCaption(captionopt, extraopt, signalopt) → {Promise.<(boolean|Message)>}
Use this method to edit captions of inline messages / messages from current update.
On success, if the edited message is not an inline message, the edited Message is returned, otherwise True
is returned.
Name | Type | Attributes | Description |
---|---|---|---|
caption | string | <optional> | New caption of the message, 0-1024 characters after entities parsing |
extra | ExtraEditMessageCaption | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|Message)>
editMessageLiveLocation(latitude, longitude, extraopt, signalopt) → {Promise.<(boolean|Message)>}
Use this method to edit live location inline message / message from current update. A location can be edited until its live_period
expires or editing is explicitly disabled by a call to stopMessageLiveLocation.
On success, if the edited message is not an inline message, the edited Message is returned, otherwise True
is returned.
Name | Type | Attributes | Description |
---|---|---|---|
latitude | number | Latitude of new location | |
longitude | number | Longitude of new location | |
extra | ExtraEditMessageLiveLocation | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|Message)>
editMessageMedia(media, extraopt, signalopt) → {Promise.<(boolean|Message)>}
Use this method to edit animation, audio, document, photo, or video inline messages / messages from current update. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id
or specify a URL.
On success, if the edited message is not an inline message, the edited Message is returned, otherwise True
is returned.
Name | Type | Attributes | Description |
---|---|---|---|
media | InputMedia | Object for a new media content of the message | |
extra | ExtraEditMessageMedia | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|Message)>
editMessageReplyMarkup(markupopt, signalopt) → {Promise.<(boolean|Message)>}
Use this method to edit only the reply markup of inline message / message from current update.
On success, if the edited message is not an inline message, the edited Message is returned, otherwise True
is returned.
Name | Type | Attributes | Description |
---|---|---|---|
markup | Object | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|Message)>
editMessageText(text, extraopt, signalopt) → {Promise.<(boolean|Message)>}
Use this method to edit text and game inline messages for current from current update.
On success, if the edited message is not an inline message, the edited Message is returned, otherwise True
is returned.
Name | Type | Attributes | Description |
---|---|---|---|
text | string | New text of the message, 1-4096 characters after entities parsing | |
extra | ExtraEditMessageText | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|Message)>
exportChatInviteLink(signalopt) → {Promise}
Use this method to generate a new primary invite link for current chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
Returns the new invite link as String
on success.
Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using exportChatInviteLink or by calling the getChat method. If your bot needs to generate a new primary invite link replacing its previous one, use exportChatInviteLink again.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise
forwardMessage(chatId, extraopt, signalopt) → {Promise.<Message>}
Use this method to forward messages of any kind from current chat. Service messages can't be forwarded.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | string | | Unique identifier for the target chat or username of the target channel (in the format | |
extra | ExtraForwardMessage | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
getChat(signalopt) → {Promise.<Chat>}
Use this method to get up-to-date information about current chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.).
Returns a Chat object on success.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Chat>
getChatAdministrators(signalopt) → {Promise.<Array.<ChatMember>>}
Use this method to get a list of administrators in chat from current update.
On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Array.<ChatMember>>
getChatMember(userId, signalopt) → {Promise.<ChatMember>}
Use this method to get information about a member of chat from current update.
Note that the method getChatMember is only guaranteed to work if the bot is an administrator in the chat. (for hidden members after Bots API 6.4) Returns a ChatMember object on success.
Name | Type | Attributes | Description |
---|---|---|---|
userId | number | | Unique identifier of the target user | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<ChatMember>
getChatMemberCount(signalopt) → {Promise.<number>}
Use this method to get the number of members in chat from current update.
Returns Int
on success.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<number>
getChatMembersCount(signalopt) → {Promise.<number>}
Use this method to get the number of members in chat from current update.
Returns Int
on success.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Deprecated
- Use getChatMemberCount
- Source
- Type:
- Promise.<number>
getChatMenuButton(signalopt) → {Promise.<MenuButton>}
Use this method to get the current value of the bot's menu button in private chat from current update, or the default menu button.
Returns MenuButton on success.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<MenuButton>
getCustomEmojiStickers(customEmojiIds, signalopt) → {Promise.<Array.<Sticker>>}
Use this method to get information about custom emoji stickers by their identifiers.
Returns an Array of Sticker objects.
Name | Type | Attributes | Description |
---|---|---|---|
customEmojiIds | Array.<string> | List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified. | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Array.<Sticker>>
getMyCommands(extraopt, signalopt) → {Promise.<Array.<BotCommand>>}
Use this method to get the current list of the bot's commands for the given scope and user language.
Returns Array of BotCommand on success. If commands aren't set, an empty list is returned.
Name | Type | Attributes | Description |
---|---|---|---|
extra | ExtraGetMyCommands | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Array.<BotCommand>>
getMyDefaultAdministratorRights(forChannelsopt, signalopt) → {Promise.<ChatAdministratorRights>}
Use this method to get the current default administrator rights of the bot.
Returns ChatAdministratorRights on success.
Name | Type | Attributes | Description |
---|---|---|---|
forChannels | boolean | <optional> | Pass True to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned. |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<ChatAdministratorRights>
getStickerSet(name, signalopt) → {Promise.<StickerSet>}
Use this method to get a sticker set.
On success, a StickerSet object is returned.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | Name of the sticker set | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<StickerSet>
hideGeneralForumTopic(signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics
administrator rights. The topic will be automatically closed if it was open.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
kickChatMember(userId, untilDateopt, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Alias to banChatMember, but have different arguments (Deprecated after Bots API 5.3)
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
userId | number | Unique identifier of the target user | |
untilDate | number | <optional> | Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only. |
extra | ExtraKickChatMember | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
leaveChat(signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method for your bot to leave from group, supergroup or channel from current update.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
pinChatMessage(messageId, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to add a message to the list of pinned messages in current chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
messageId | number | Identifier of a message to pin | |
extra | ExtraPinChatMessage | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
promoteChatMember(userId, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False
for all boolean parameters to demote a user.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
userId | number | Unique identifier of the target user | |
extra | ExtraPromoteChatMember | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
reopenForumTopic(signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
reopenGeneralForumTopic(signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics
administrator rights. The topic will be automatically unhidden if it was hidden.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
reply(text, extraopt, signalopt) → {Promise.<Message>}
Use this method to send text messages to current chat.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
text | string | Text of the message to be sent, 1-4096 characters after entities parsing | |
extra | ExtraSendMessage | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithAnimation(animation, extraopt, signalopt) → {Promise.<Message>}
Use this method to send animation files to chat from current update (GIF or H.264/MPEG-4 AVC video without sound).
On success, the sent Message is returned.
Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
Name | Type | Attributes | Description |
---|---|---|---|
animation | InputFile | | Animation to send. Pass a | |
extra | ExtraAnimation | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithAudio(audio, extraopt, signalopt) → {Promise.<Message>}
Use this method to send audio files to chat from current update, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3
or .M4A
format.
On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
For sending voice messages, use the OpengramContext#replyWithVoice method instead.
Name | Type | Attributes | Description |
---|---|---|---|
audio | InputFile | | Audio file to send. Pass a | |
extra | ExtraAudio | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithChatAction(action, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status).
Returns True
on success or WebhookResponse when webhook response enabled.
Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use replyWithChatAction with action = upload_photo
. The user will see a “sending photo” status for the bot.
We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.
Name | Type | Attributes | Description |
---|---|---|---|
action | Action | Type of action to broadcast. Choose one, depending on what the user is about to receive: | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
replyWithContact(phoneNumber, firstName, extraopt, signalopt) → {Promise.<Message>}
Use this method to send phone contacts to chat from current update.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
phoneNumber | string | Contact's phone number | |
firstName | string | Contact's first name | |
extra | ExtraContact | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithDice(extraopt, signalopt) → {Promise.<Message>}
Use this method to send an animated emoji that will display a random value to chat from current update.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
extra | ExtraDice | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithDocument(document, extraopt, signalopt) → {Promise.<Message>}
Use this method to send general files to chat from current update.
On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
Name | Type | Attributes | Description |
---|---|---|---|
document | InputFile | | Document to send. Pass a | |
extra | ExtraDocument | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithGame(gameName, extraopt, signalopt) → {Promise.<Message>}
Use this method to send a game to chat from current update.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
gameName | string | Short name of the game, serves as the unique identifier for the game. Set up your games via @BotFather. | |
extra | ExtraGame | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithHTML(html, extraopt, signalopt) → {Promise.<Message>}
Use this method to send text messages with HTML (parse_mode: 'HTML'
) to chat from current update.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
html | string | Text with HTML of the message to be sent, 1-4096 characters after entities parsing | |
extra | ExtraSendMessage | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithInvoice(invoice, extraopt, signalopt) → {Promise.<Message>}
Use this method to send invoice to current chat.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
invoice | InvoiceParams | Other invoice parameters | |
extra | ExtraInvoice | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithLocation(latitude, longitude, extraopt, signalopt) → {Promise}
Use this method to send point on the map to chat from current update.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
latitude | number | Latitude of the location | |
longitude | number | Longitude of the location | |
extra | ExtraLocation | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise
replyWithMarkdown(markdown, extraopt, signalopt) → {Promise.<Message>}
Use this method to send text messages with Markdown (parse_mode: 'Markdown'
) to chat from current update.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
markdown | string | Text with Markdown of the message to be sent, 1-4096 characters after entities parsing | |
extra | ExtraSendMessage | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithMarkdownV2(markdown, extraopt, signalopt) → {Promise.<Message>}
Use this method to send text messages with MarkdownV2 (parse_mode: 'MarkdownV2'
) to chat from current update.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
markdown | string | Text with MarkdownV2 of the message to be sent, 1-4096 characters after entities parsing | |
extra | ExtraSendMessage | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithMediaGroup(media, extraopt, signalopt) → {Promise.<Array.<Message>>}
Use this method to send a group of photos, videos, documents or audios as an album to chat from current update. Documents and audio files can be only grouped on an album with messages of the same type.
On success, an array of Messages that were sent is returned.
Name | Type | Attributes | Description |
---|---|---|---|
media | Array.<(InputMediaPhoto|InputMediaAudio|InputMediaVideo|InputMediaDocument)> | A array describing messages to be sent, must include 2-10 items | |
extra | ExtraMediaGroup | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Array.<Message>>
replyWithPhoto(photo, extraopt, signalopt) → {Promise.<Message>}
Use this method to send message with photo to chat from current update.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
photo | InputFile | | Photo to send. Pass a | |
extra | ExtraPhoto | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithPoll(question, options, extraopt, signalopt) → {Promise.<Message>}
Use this method to send a native poll with type regular
to chat from current update.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
question | string | Poll question, 1-300 characters | |
options | Array.<string> | List of answer options, 2-10 strings 1-100 characters each | |
extra | ExtraPoll | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithQuiz(question, options, extraopt, signalopt) → {Promise.<Message>}
Use this method to send a native poll with type quiz
to chat from current update.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
question | string | Poll question, 1-300 characters | |
options | Array.<string> | List of answer options, 2-10 strings 1-100 characters each | |
extra | ExtraQuiz | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithSticker(sticker, extraopt, signalopt) → {Promise.<Message>}
Use this method to send static .WEBP
, animated .TGS
, or video .WEBM
stickers to chat from current update.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
sticker | InputFile | | Sticker to send. Pass a | |
extra | ExtraSticker | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithVenue(latitude, longitude, title, address, extraopt, signalopt) → {Promise.<Message>}
Use this method to send information about a venue to chat from current update.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
latitude | number | Latitude of the venue | |
longitude | number | Longitude of the venue | |
title | string | Name of the venue | |
address | string | Address of the venue | |
extra | ExtraVenue | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithVideo(video, extraopt, signalopt) → {Promise.<Message>}
Use this method to send video files to chat from current update, Telegram clients support MPEG4 videos (other formats may be sent as Document).
On success, the sent Message is returned.
Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
Name | Type | Attributes | Description |
---|---|---|---|
video | InputFile | | Video to send. Pass a | |
extra | ExtraVideo | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithVideoNote(videoNote, extraopt, signalopt) → {Promise.<Message>}
As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages to chat from current update.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
videoNote | InputFile | | Video note to send. Pass a | |
extra | ExtraVideoNote | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
replyWithVoice(voice, extraopt, signalopt) → {Promise.<Message>}
Use this method to send audio files to chat from current update, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document).
On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
Name | Type | Attributes | Description |
---|---|---|---|
voice | InputFile | | Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. | |
extra | ExtraVoice | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
restrictChatMember(userId, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to restrict a user in current supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
userId | number | Unique identifier of the target user | |
extra | ExtraRestrictChatMember | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
revokeChatInviteLink(inviteLink, signalopt) → {Promise.<ChatInviteLink>}
Use this method to revoke an invite link created by the bot for chat from current update. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
Returns the revoked invite link as ChatInviteLink object.
Name | Type | Attributes | Description |
---|---|---|---|
inviteLink | string | The invite link to revoke | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<ChatInviteLink>
setChatAdministratorCustomTitle(userId, title, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to set a custom title for an administrator in current supergroup promoted by the bot.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
userId | number | Unique identifier of the target user | |
title | string | New custom title for the administrator; 0-16 characters, emoji are not allowed | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
setChatDescription(descriptionopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to change the description of current group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
Returns True
on success or WebhookResponse when webhook response enabled. https://core.telegram.org/bots/api#setchatdescription
Name | Type | Attributes | Description |
---|---|---|---|
description | string | <optional> | New chat description, 0-255 characters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
setChatMenuButton(menuButtonopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to change the bot's menu button in private chat from current update, or the default menu button.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
menuButton | MenuButton | <optional> | Unique identifier for the target private chat. If not specified, default bot's menu button will be changed |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
setChatPermissions(permissions, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to set default chat permissions for all members in chat from current update. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members
administrator rights.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
permissions | ChatPermissions | A object for new default chat permissions | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
setChatPhoto(photo, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to set a new profile photo for current chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
photo | InputFile | New chat photo, uploaded using multipart/form-data | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
setChatStickerSet(setName, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to set a new group sticker set for supergroup from current update. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set
optionally returned in getChat requests to check if the bot can use this method.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
setName | string | Name of the sticker set to be set as the group sticker set | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
setChatTitle(title, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to change the title of a chat. Titles can't be changed for current private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
title | string | New chat title, 1-255 characters | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
setMyCommands(commands, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to change the list of the bot's commands. See https://core.telegram.org/bots#commands for more details about bot commands.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
commands | Array.<BotCommand> | List of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified. | |
extra | ExtraSetMyCommands | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
setMyDefaultAdministratorRights(rightsopt, forChannelsopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot.
Returns True
on success or WebhookResponse when webhook response enabled. https://core.telegram.org/bots/api#setmydefaultadministratorrights
Name | Type | Attributes | Description |
---|---|---|---|
rights | ChatAdministratorRights | <optional> | Object describing new default administrator rights. If not specified, the default administrator rights will be cleared. |
forChannels | boolean | <optional> | Pass True to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed. |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
setPassportDataErrors(errors, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Informs current user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change).
Returns True
on success or WebhookResponse when webhook response enabled.
Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.
Name | Type | Attributes | Description |
---|---|---|---|
errors | Array.<PassportElementError> | Array describing the errors | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
setStickerPositionInSet(sticker, position, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to move a sticker in a set created by the bot to a specific position.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
sticker | string | File identifier of the sticker | |
position | number | New sticker position in the set, zero-based | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
setStickerSetThumb(name, userId, thumbnailopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Video thumbnails can be set only for video sticker sets only.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | Sticker set name | |
userId | number | User identifier of the sticker set owner | |
thumbnail | InputFile | | <optional> | A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements, or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated sticker set thumbnails can't be uploaded via HTTP URL. |
signal | AbortSignal | <optional> | Optional |
- Deprecated
- Use OpengramContext#setStickerSetThumbnail. Renamed after Bots API 6.6
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
setStickerSetThumbnail(name, userId, thumbnailopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Video thumbnails can be set only for video sticker sets only.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | Sticker set name | |
userId | number | User identifier of the sticker set owner | |
thumbnail | InputFile | | <optional> | A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements, or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated sticker set thumbnails can't be uploaded via HTTP URL. |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
stopMessageLiveLocation(markupopt, signalopt) → {Promise.<(boolean|Message)>}
Use this method to edit live location inline message / message from current update. A location can be edited until its live_period
expires or editing is explicitly disabled by a call to stopMessageLiveLocation.
On success, if the edited message is not an inline message, the edited Message is returned, otherwise True
is returned.
Name | Type | Attributes | Description |
---|---|---|---|
markup | Object | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|Message)>
stopPoll(messageId, extraopt, signalopt) → {Promise.<Poll>}
Use this method to stop a poll in chat from current update. which was sent by the bot.
On success, the stopped Poll is returned.
Name | Type | Attributes | Description |
---|---|---|---|
messageId | number | Identifier of the original message with the poll | |
extra | ExtraStopPoll | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Poll>
unbanChatMember(userId, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to unban a previously banned user in current supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned
.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
userId | number | Unique identifier of the target user | |
extra | ExtraUnbanMember | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
unbanChatSenderChat(senderChatId, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to unban a previously banned channel chat in current supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
senderChatId | number | Unique identifier of the target sender chat | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
unhideGeneralForumTopic(signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics
administrator rights.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
unpinAllChatMessages(signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to clear the list of pinned messages in chat from current update. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
unpinAllForumTopicMessages(signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
unpinAllGeneralForumTopicMessages(chatId, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages
administrator right in the supergroup.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
unpinChatMessage(extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}
Use this method to remove a message from the list of pinned messages in chat from current update. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel.
Returns True
on success or WebhookResponse when webhook response enabled.
Name | Type | Attributes | Description |
---|---|---|---|
extra | ExtraUnPinChatMessage | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
uploadStickerFile(sticker, extra, signalopt) → {Promise.<File>}
Use this method to upload a .PNG file with a sticker owned by current user for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times).
Returns the uploaded File on success.
Name | Type | Attributes | Description |
---|---|---|---|
sticker | InputSticker | PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. More information on Sending Files ». | |
extra | ExtraUploadStickerFile | Other parameters | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<File>