Context class
This class is used to represent the context of an update. It contains the update and the RawAPI instance.
Whenever an update is received, a context is created and passed to the handler. Currently Televerse support the following types of contexts:
Properties
- api → RawAPI
-
The RawAPI getter.
no setter
-
args
→ List<
String> -
If the message is a command, the list will be filled with the command arguments.
e.g. /hello @mom @dad will have a ctx.args like this:
'@mom', '@dad'
. This will be empty if the message is not a command or if the message doesn't contain text NOTE: This is obviously also used for the deeplink start parameters.no setter - businessConnection → BusinessConnection?
-
The BusinessConnection instance. This represents the business connection for which the context is created.
no setter
- businessMessage → Message?
-
New non-service message from a connected business account
no setter
- businessMessageDelete → BusinessMessagesDeleted?
-
Messages were deleted from a connected business account
no setter
- callbackQuery → CallbackQuery?
-
The callback query of the update.
no setter
- channelPost → Message?
-
The channel post.
no setter
- chat → Chat?
-
A shorthand getter for the Chat instance from the update.
no setter
- chatBoost → ChatBoostUpdated?
-
The chat boost that was updated.
no setter
- chatBoostRemoved → ChatBoostRemoved?
-
The chat boost that was removed.
no setter
- chatJoinRequest → ChatJoinRequest?
-
The ChatJoinRequest instance.
no setter
- chatMember → ChatMemberUpdated?
-
The Chat Member Updated instance of ChatMember
no setter
- chatMemberUpdated → ChatMemberUpdated?
-
Shorthand getter for the ChatMemberUpdated instance.
no setter
- chosenInlineResult → ChosenInlineResult?
-
The ChosenInlineResult instance.
no setter
- editedBusinessMessage → Message?
-
New version of a message from a connected business account
no setter
- editedChannelPost → Message?
-
The edited channel post.
no setter
- editedMessage → Message?
-
The edited message.
no setter
- from → User?
-
A shorthand getter for the User instance from the update.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → ID
-
The ChatID instance.
no setter
- inlineQuery → InlineQuery?
-
The incoming inline query.
no setter
-
matches
→ List<
RegExpMatch> ? -
Regular expression matches
no setter
- me → User
-
The bot that received the update's informations.
no setter
- message → Message?
-
The incoming message.
no setter
- messageReaction → MessageReactionUpdated?
-
The MessageReactionUpdated object.
no setter
- messageReactionCount → MessageReactionCountUpdated?
-
The MessageReactionCountUpdated object.
no setter
- msg → Message?
-
This is a shorthand getter for the Message recieved in the current context
no setter
- myChatMember → ChatMemberUpdated?
-
The Chat Member Updated instance of MyChatMember
no setter
- poll → Poll?
-
The Poll instance.
no setter
- pollAnswer → PollAnswer?
-
The PollAnswer instance.
no setter
- preCheckoutQuery → PreCheckoutQuery?
-
The PreCheckoutQuery instance.
no setter
- removedChatBoost → ChatBoostRemoved?
-
Removed chat boost instance
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shippingQuery → ShippingQuery?
-
The ShippingQuery instance.
no setter
- update → Update
-
The Update instance.
final
Methods
-
answerCallbackQuery(
{String? text, bool showAlert = false, String? url, int cacheTime = 0}) → Future< bool> - Context aware method for answering a callback query APIMethod.answerCallbackQuery.
-
answerInlineQuery(
List< InlineQueryResult> results, {int? cacheTime = 300, bool? isPersonal, String? nextOffset, InlineQueryResultsButton? button}) → Future<bool> - Answer inline query
-
answerPreCheckouQUery(
bool ok, {String? errorMessage}) → Future< bool> - Answer pre checkout query
-
answerShippingQuery(
bool ok, {List< ShippingOption> ? shippingOptions, String? errorMessage}) → Future<bool> - Answer the incoming shipping query
-
answerWebAppQuery(
String webAppQueryId, InlineQueryResult result) → Future< SentWebAppMessage> - Anwer a web app query
-
approveChatJoinRequest(
{int? userId}) → Future< bool> - Approve the chat join request.
-
banAuthor(
{DateTime? untilDate, bool? revokeMessages}) → Future< bool> - Ban the author of the message. This method will ban the author of the message in the current context.
-
banChatMember(
int userId, {DateTime? untilDate, bool? revokeMessages}) → Future< bool> - Context aware method for banning a user: APIMethod.banChatMember.
-
closeForumTopic(
{int? messageThreadId}) → Future< bool> - Context aware method for closing a forum topic APIMethod.closeForumTopic.
-
closeGeneralForumTopic(
) → Future< bool> - Context aware method for closing the general forum topic APIMethod.closeGeneralForumTopic.
-
copyMessage(
ID chatId, {int? messageThreadId, ParseMode? parseMode, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, ReplyParameters? replyParameters, bool? showCaptionAboveMedia}) → Future< MessageId> - Context aware method for copying a message APIMethod.copyMessage.
-
createChatInviteLink(
{String? name, DateTime? expireDate, int? memberLimit, bool? createsJoinRequest}) → Future< ChatInviteLink> - Create a chat invite link.
-
createForumTopic(
String name, {int? iconColor, String? iconCustomEmojiId}) → Future< ForumTopic> - Context aware method for creating a new forum topic APIMethod.createForumTopic.
-
createInvoiceLink(
{required String title, required String description, required String payload, String? providerToken, required String currency, required List< LabeledPrice> prices, int? maxTipAmount = 0, List<int> ? suggestedTipAmounts, String? providerData, String? photoUrl, int? photoSize, int? photoWidth, int? photoHeight, bool? needName, bool? needPhoneNumber, bool? needEmail, bool? needShippingAddress, bool? sendPhoneNumberToProvider, bool? sendEmailToProvider, bool? isFlexible}) → Future<String> - Create invoice link
-
declineChatJoinRequest(
{int? userId}) → Future< bool> - Decline the chat join request.
-
deleteChatPhoto(
) → Future< bool> - Delete the chat photo.
-
deleteChatStickerSet(
) → Future< bool> - Context aware method for delete chat sticker set APIMethod.deleteChatStickerSet.
-
deleteForumTopic(
{int? messageThreadId}) → Future< bool> - Context aware method for deleting a forum topic APIMethod.deleteForumTopic.
-
deleteMessage(
) → Future< bool> - Delete the message.
-
deleteMyCommands(
{BotCommandScope? scope, String? languageCode}) → Future< bool> - Delete the list of bot's commands for the given scope and user language.
-
editChatInviteLink(
String inviteLink, {String? name, DateTime? expireDate, int? memberLimit, bool? createsJoinRequest}) → Future< ChatInviteLink> - Edit chat invite link.
-
editForumTopic(
{int? messageThreadId, String? name, String? iconCustomEmojiId}) → Future< bool> - Context aware method for editing a forum topic APIMethod.editForumTopic.
-
editGeneralForumTopic(
String name) → Future< bool> - Context aware method for editing the general forum topic APIMethod.editGeneralForumTopic.
-
editInlineMessageLiveLocation(
{double? latitude, double? longitude, double? horizontalAccuracy, int? heading, int? proximityAlertRadius, InlineKeyboardMarkup? replyMarkup}) → Future< bool> - Context aware method for editing live location of inline message APIMethod.editMessageLiveLocation.
-
editMessageCaption(
{ParseMode? parseMode, InlineKeyboardMarkup? replyMarkup, bool? showCaptionAboveMedia}) → Future< bool> - Edit the message caption
-
editMessageLiveLocation(
{String? inlineMessageId, double? latitude, double? longitude, double? horizontalAccuracy, int? heading, int? proximityAlertRadius, InlineKeyboardMarkup? replyMarkup}) → Future< Message> - Edit message live location
-
editMessageMedia(
InputMedia media, {InlineKeyboardMarkup? replyMarkup}) → Future< bool> - Edit the message media Use this method to edit animation, audio, document, photo, or video messages.
-
editMessageReplyMarkup(
{InlineKeyboardMarkup? replyMarkup}) → Future< bool> - Edit the message reply markup Use this method to edit only the reply markup of messages.
-
editMessageText(
String text, {ParseMode? parseMode, List< MessageEntity> ? entities, InlineKeyboardMarkup? replyMarkup, LinkPreviewOptions? linkPreviewOptions}) → Future<bool> - Edit the message text
-
exportChatInviteLink(
) → Future< String> - Export the chat invite link.
-
forwardMessage(
ID chatId, {bool? disableNotification, int? messageThreadId, bool? protectContent}) → Future< Message> - Forward the message.
-
getAuthor(
) → Future< ChatMember> - Get Author
-
getChat(
) → Future< Chat> - Get information about the chat.
-
getChatAdministrators(
) → Future< List< ChatMember> > - Get the list of administrators in the chat, which aren't bots.
-
getChatMember(
int userId) → Future< ChatMember> - Context aware method to get chat member APIMethod.getChatMember.
-
getChatMembersCount(
) → Future< int> - Get the number of members in the chat.
-
getChatMenuButton(
) → Future< MenuButton> - Get the current chat menu button
-
getFile(
) → Future< File> - Context aware method for getting file: APIMethod.getFile.
-
getMyCommands(
{BotCommandScope? scope, String? languageCode}) → Future< List< BotCommand> > - Get the current list of bot's commands for the given scope and user language.
-
getMyDefaultAdministratorRights(
{bool? forChannels}) → Future< ChatAdministratorRights> - Get bot's default administrator rights
-
getUserProfilePhotos(
{int? offset, int? limit}) → Future< UserProfilePhotos> - Context aware method for getting users profile photos: APIMethod.getUserProfilePhotos.
-
hasText(
{Pattern? text, List< Pattern> ? texts}) → bool - hasText checks if the message has the given text.
-
hideGeneralForumTopic(
) → Future< bool> - Context aware method for hiding the general forum topic APIMethod.hideGeneralForumTopic.
-
leaveChat(
) → Future< bool> - Leave the chat.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pinChatMessage(
int messageId, {bool? disableNotification}) → Future< bool> - Context aware method for pin chat message APIMethod.pinChatMessage.
-
pinThisMessage(
{bool? disableNotification}) → Future< bool> - Context aware method for pin the current message APIMethod.pinChatMessage.
-
promoteAuthor(
{bool? isAnonymous, bool? canManageChat, bool? canPostMessages, bool? canEditMessages, bool? canDeleteMessages, bool? canManageVideoChats, bool? canRestrictMembers, bool? canPromoteMembers, bool? canChangeInfo, bool? canInviteUsers, bool? canPinMessages, bool? canManageTopics, bool? canPostStories, bool? canEditStories, bool? canDeleteStories}) → Future< bool> - Promote the author of the message in the current context. This method will promote the author of the message in the current context.
-
promoteChatMember(
int userId, {bool? isAnonymous, bool? canManageChat, bool? canPostMessages, bool? canEditMessages, bool? canDeleteMessages, bool? canManageVideoChats, bool? canRestrictMembers, bool? canPromoteMembers, bool? canChangeInfo, bool? canInviteUsers, bool? canPinMessages, bool? canManageTopics, bool? canPostStories, bool? canEditStories, bool? canDeleteStories}) → Future< bool> - Promote a user in the current context. This method will promote the user in the current context.
-
react(
String emoji, {bool? isBig}) → Future< bool> - React to the message with a reaction.
-
reactMultiple(
List< String> emojis, {bool? isBig}) → Future<bool> - React to the message with multiple reactions.
-
reopenForumTopic(
{int? messageThreadId}) → Future< bool> - Context aware method for reopening a forum topic APIMethod.reopenForumTopic.
-
reopenGeneralForumTopic(
) → Future< bool> - Context aware method for reopening the general forum topic APIMethod.reopenGeneralForumTopic.
-
reply(
String text, {int? messageThreadId, ParseMode? parseMode, List< MessageEntity> ? entities, LinkPreviewOptions? linkPreviewOptions, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, String? businessConnectionId, String? messageEffectId}) → Future<Message> - Reply a Text Message to the user.
-
replyWithAnimation(
InputFile animation, {int? messageThreadId, int? duration, int? width, int? height, InputFile? thumbnail, ParseMode? parseMode, bool? hasSpoiler, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, String? businessConnectionId, String? messageEffectId, bool? showCaptionAboveMedia}) → Future< Message> - Reply with an Animation to the user.
-
replyWithAudio(
InputFile audio, {int? messageThreadId, ParseMode? parseMode, int? duration, String? performer, String? title, InputFile? thumbnail, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, String? businessConnectionId, String? messageEffectId}) → Future< Message> - Reply with an Audio to the user.
-
replyWithChatAction(
ChatAction action, {int? messageThreadId, String? businessConnectionId}) → Future< bool> - Reply with a Chat Action to the user.
-
replyWithContact(
String phoneNumber, String firstName, {int? messageThreadId, String? lastName, String? vcard, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, String? businessConnectionId, String? messageEffectId}) → Future< Message> - Reply with a Contact to the user.
-
replyWithDice(
{DiceEmoji emoji = DiceEmoji.dice, int? messageThreadId, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, String? businessConnectionId, String? messageEffectId}) → Future< Message> - Reply with a Dice to the user.
-
replyWithDocument(
InputFile document, {int? messageThreadId, InputFile? thumbnail, ParseMode? parseMode, bool? disableContentTypeDetection, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, String? businessConnectionId, String? messageEffectId}) → Future< Message> - Reply with a Document to the user.
-
replyWithGame(
String shortName, {int? messageThreadId, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, String? businessConnectionId, String? messageEffectId}) → Future< Message> - Reply with a Game to the user.
-
replyWithLocation(
double latitude, double longitude, {int? messageThreadId, double? horizontalAccuracy, int? livePeriod, int? heading, int? proximityAlertRadius, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, String? businessConnectionId, String? messageEffectId}) → Future< Message> - Reply with a Location to the user.
-
replyWithMediaGroup(
List< InputMedia> media, {int? messageThreadId, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, String? businessConnectionId, String? messageEffectId}) → Future<List< Message> > - Reply with a Media Group to the user.
-
replyWithPhoto(
InputFile photo, {int? messageThreadId, ParseMode? parseMode, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, String? businessConnectionId, String? messageEffectId, bool? showCaptionAboveMedia}) → Future< Message> - Reply a Photo to the user. Reply with a Photo to the user.
-
replyWithPoll(
String question, List< InputPollOption> options, {int? messageThreadId, bool? isAnonymous, PollType type = PollType.regular, bool? allowsMultipleAnswers, int? correctOptionId, String? explanation, ParseMode? explanationParseMode, List<MessageEntity> ? explanationEntities, int? openPeriod, DateTime? closeDate, bool? isClosed, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, String? businessConnectionId, String? messageEffectId}) → Future<Message> - Reply with a Poll to the user.
-
replyWithSticker(
InputFile sticker, {int? messageThreadId, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, InlineKeyboardMarkup? replyMarkup, String? businessConnectionId, String? messageEffectId}) → Future< Message> - Reply with a Sticker to the user.
-
replyWithVenue(
double latitude, double longitude, String title, String address, {int? messageThreadId, String? foursquareId, String? foursquareType, String? googlePlaceId, String? googlePlaceType, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, String? businessConnectionId, String? messageEffectId}) → Future< Message> - Reply with a Venue to the user.
-
replyWithVideo(
InputFile video, {int? messageThreadId, int? duration, int? width, int? height, InputFile? thumbnail, ParseMode? parseMode, bool? hasSpoiler, bool? supportsStreaming, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, String? businessConnectionId, String? messageEffectId, bool? showCaptionAboveMedia}) → Future< Message> - Reply with a Video to the user.
-
replyWithVideoNote(
InputFile videoNote, {int? messageThreadId, int? duration, int? length, InputFile? thumbnail, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, String? businessConnectionId, String? messageEffectId}) → Future< Message> - Reply with a Video Note to the user.
-
replyWithVoice(
InputFile voice, {int? messageThreadId, ParseMode? parseMode, int? duration, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, String? businessConnectionId, String? messageEffectId}) → Future< Message> - Reply with a Voice to the user.
-
restrictAuthor(
ChatPermissions permissions, {DateTime? untilDate, bool? useIndependentChatPermissions}) → Future< bool> - Restrict the author of the message in the current context.
-
restrictChatMember(
int userId, ChatPermissions permissions, {DateTime? untilDate, bool? useIndependentChatPermissions}) → Future< bool> - Restrict a user in the current context.
-
revokeChatInviteLink(
String inviteLink) → Future< ChatInviteLink> - Revoke chat invite link.
-
sendInvoice(
{required String title, required String description, required String payload, String? providerToken, required String currency, required List< LabeledPrice> prices, int? messageThreadId, int? maxTipAmount = 0, List<int> ? suggestedTipAmounts, String? startParameter, String? providerData, String? photoUrl, int? photoSize, int? photoWidth, int? photoHeight, bool? needName, bool? needPhoneNumber, bool? needEmail, bool? needShippingAddress, bool? sendPhoneNumberToProvider, bool? sendEmailToProvider, bool? isFlexible, bool? disableNotification, bool? protectContent, InlineKeyboardMarkup? replyMarkup, ReplyParameters? replyParameters, String? messageEffectId}) → Future<Message> - Send invoice to the chat
-
sendTyping(
) → Future< bool> - Context aware method for send "Typing..." action: APIMethod.sendChatAction.
-
setChatAdministratorCustomTitle(
int userId, String customTitle) → Future< bool> - Set the chat administrator custom title.
-
setChatAdministratorCustomTitleOfAuthor(
String customTitle) → Future< bool> - Set the chat administrator custom title of the author of the message.
-
setChatDescription(
String description) → Future< bool> - Context aware method for set chat description APIMethod.setChatDescription.
-
setChatMenuButton(
→ Future< )bool> - Set the bot's menu button for this chat (must be a private chat).
-
setChatPermissions(
ChatPermissions permissions, {bool? useIndependentChatPermissions}) → Future< bool> - Set the chat permissions.
-
setChatPhoto(
InputFile photo) → Future< bool> - Set the chat photo.
-
setChatStickerSet(
String stickerSetName) → Future< bool> - Context aware method for set chat sticker set APIMethod.setChatStickerSet.
-
setChatTitle(
String title) → Future< bool> - Context aware method for set chat title APIMethod.setChatTitle.
-
setMyCommands(
List< BotCommand> commands, {BotCommandScope? scope, String? languageCode}) → Future<bool> - Change the list of bot's commands.
-
setMyDefaultAdministratorRights(
ChatAdministratorRights? rights, bool? forChannels) → Future< bool> - Set bot's default administrator rights
-
setMyDescription(
{String? description, String? languageCode}) → Future< bool> - Set my description
-
setMyName(
{String? name, String? languageCode}) → Future< bool> - Set my name
-
setMyShortDescription(
{String? shortDescription, String? languageCode}) → Future< bool> - Set my short description
-
stopInlineMessageLiveLocation(
{InlineKeyboardMarkup? replyMarkup}) → Future< bool> - Context aware method for stopping live location of inline message: APIMethod.stopMessageLiveLocation.
-
stopMessageLiveLocation(
{InlineKeyboardMarkup? replyMarkup}) → Future< Message> - Context aware method for stopping live location of message: APIMethod.stopMessageLiveLocation.
-
toString(
) → String -
A string representation of this object.
inherited
-
unbanAuthor(
{bool? onlyIfBanned}) → Future< bool> - Unban the author of the message. This method will unban the author of the message in the current context.
-
unbanChatMember(
int userId, {bool? onlyIfBanned}) → Future< bool> - Context aware method for unbanning a user: APIMethod.unbanChatMember.
-
unhideGeneralForumTopic(
) → Future< bool> - Context aware method for unhiding the general forum topic APIMethod.unhideGeneralForumTopic.
-
unpinAllForumTopicMessages(
{int? messageThreadId}) → Future< bool> - Context aware method for unpinning all forum topic messages APIMethod.unpinAllForumTopicMessages.
-
unpinAllGeneralForumTopicMessages(
) → Future< bool> - Context aware method for unpinning all general forum topic messages APIMethod.unpinAllGeneralForumTopicMessages.
-
unpinAllMessages(
) → Future< bool> - Unpin all messages in the chat.
-
unpinChatMessage(
int messageId) → Future< bool> - Context aware method for unpin chat message APIMethod.unpinChatMessage.
-
unpinThisMessage(
) → Future< bool> - Context aware method for unpin the current message APIMethod.unpinChatMessage. This will unpin the message in the current context.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited