-
Notifications
You must be signed in to change notification settings - Fork 4
Context Object
The Context Object (often referred to as ctx
within code examples) is a central part of the bot framework, providing a wide array of methods for interacting with the bot API, managing messages, queries, games, payments, chats, stickers, and more. It encapsulates the current state and context in which the bot operates, allowing for responsive and dynamic interactions with users.
bot.on("message", (ctx) => {
ctx.reply("Welcome to the bot!");
});
The Context Object offers a comprehensive suite of methods categorized by their purpose and functionality:
- update
- messageUpdate
- editedMessageUpdate
- channelPostUpdate
- editedChannelPostUpdate
- inlineQueryUpdate
- chosenInlineResultUpdate
- callbackQueryUpdate
- shippingQueryUpdate
- preCheckoutQueryUpdate
- pollUpdate
- pollAnswerUpdate
- myChatMemberUpdate
- chatMemberUpdate
- chatJoinRequestUpdate
- messageReactionUpdate
- messageReactionCountUpdate
- chatBoostUpdate
- removedChatBoostUpdate
- updateType
- chat
- from
- message
- chatId
- userId
- messageId
- answerCallbackQuery
- answerInlineQuery
- answerWebAppQuery
- getWebhookInfo
- deleteMyCommands
- setMyCommands
- getMyCommands
- setMyName
- getMyName
- setMyDescription
- getMyDescription
- setMyShortDescription
- getMyShortDescription
- setMyDefaultAdministratorRights
- getMyDefaultAdministratorRights
- getMe
- logOut
- close
- sendSticker
- getStickerSet
- getCustomEmojiStickers
- uploadStickerFile
- createNewStickerSet
- addStickerToSet
- setStickerPositionInSet
- deleteStickerFromSet
- setStickerEmojiList
- setStickerKeywords
- setStickerMaskPosition
- setStickerSetTitle
- setStickerSetThumbnail
- setCustomEmojiStickerSetThumbnail
- deleteStickerSet
- getForumTopicIconStickers
- createForumTopic
- editForumTopic
- closeForumTopic
- reopenForumTopic
- deleteForumTopic
- unpinAllForumTopicMessages
- editGeneralForumTopic
- closeGeneralForumTopic
- reopenGeneralForumTopic
- hideGeneralForumTopic
- unhideGeneralForumTopic
- unpinAllGeneralForumTopicMessages
- getUserProfilePhotos
- getFile
- sendGame
- setGameScore
- getGameHighScores
- sendInvoice
- createInvoiceLink
- answerShippingQuery
- answerPreCheckoutQuery
- banChatMember
- unbanChatMember
- restrictChatMember
- promoteChatMember
- setChatAdministratorCustomTitle
- banChatSenderChat
- unbanChatSenderChat
- setChatPermissions
- exportChatInviteLink
- createChatInviteLink
- editChatInviteLink
- revokeChatInviteLink
- approveChatJoinRequest
- declineChatJoinRequest
- setChatPhoto
- deleteChatPhoto
- setChatTitle
- setChatDescription
- pinChatMessage
- unpinChatMessage
- unpinAllChatMessages
- leaveChat
- getChat
- getChatAdministrators
- getChatMemberCount
- getChatMember
- setChatStickerSet
- deleteChatStickerSet
- setChatMenuButton
- getChatMenuButton
- getUserChatBoosts
- reply
- replyWithHtml
- replyWithMarkdown
- replyWithPhoto
- replyWithChatAction
- replyWithEditedMessage
- sendMessage
- forwardMessage
- forwardMessages
- copyMessage
- copyMessages
- sendPhoto
- sendAudio
- sendDocument
- sendVideo
- sendAnimation
- sendVoice
- sendVideoNote
- sendMediaGroup
- sendLocation
- sendVenue
- sendContact
- sendPoll
- stopPoll
- sendDice
- sendChatAction
- setMessageReaction
- deleteMessage
- deleteMessages
- editMessageText
- editMessageCaption
- editMessageMedia
- editMessageReplyMarkup
- stopMessageLiveLocation
- editMessageLiveLocation
- appendRow
- clear
- clearByRange
- clearValue
- findOne
- findAll
- deleteColumn
- deleteColumns
- deleteRow
- deleteRows
- getSheetData
- getLastColumn
- getLastRow
- insertColumnAfter
- insertColumnBefore
- insertColumns
- insertColumnsAfter
- insertColumnsBefore
- insertRowAfter
- insertRowBefore
- insertRows
- insertRowsAfter
- insertRowsBefore
- moveColumns
- moveRows
- setName
- sortByColumn
- saveOne
- saveMany
- getValue
- getValues
- getTSession
- getTSessionValue
- setTSessionValue
- setTSessionValues
- removeTSessionValue
- deleteTSession
- getPSession
- getPSessionValue
- setPSessionValue
- setPSessionValues
- removePSessionValue
- deletePSession
- getPCacheValue
- getPCache
- setPCacheValue
- setPCacheValues
- removePCacheValue
- deletePCache
- getTCacheValue
- setTCacheValue
- getTCacheValues
- setTCacheValues
- removeTCacheValue
- removeTCacheValues
This list provides a quick overview of the available methods within the Context Object for interacting with various aspects of the bot framework and Telegram API. For detailed usage, parameters, and examples, refer to the specific method documentation within the bot framework's documentation resources.
- Telesun
- Getting Started - Apps script
- Getting Started with the Telesun Ready Template
- Import Telesun
- Telesun-Handlers
- Context Object
- Next Middleware
- Stages
- Manager Classes:
- Mail:
- Google Spreadsheet:
- Best Practice:
- Getting Updates:
- Example Types:
- Example Bots: