GramIO API Reference / @gramio/contexts/dist / Message
Class: Message
Defined in: contexts/index.d.ts:3007
This object represents a message.
Extended by
BoostAddedContextChatBackgroundSetContextChatOwnerChangedContextChatOwnerLeftContextChatSharedContextChecklistTasksAddedContextChecklistTasksDoneContextDeleteChatPhotoContextDirectMessagePriceChangedContextForumTopicClosedContextForumTopicCreatedContextForumTopicEditedContextForumTopicReopenedContextGeneralForumTopicHiddenContextGeneralForumTopicUnhiddenContextGiftContextGiftUpgradeSentContextGiveawayCompletedContextGiveawayCreatedContextGiveawayWinnersContextGroupChatCreatedContextInvoiceContextLeftChatMemberContextLocationContextManagedBotCreatedContextMessageAutoDeleteTimerChangedContextMessageContextMigrateFromChatIdContextMigrateToChatIdContextNewChatMembersContextNewChatPhotoContextNewChatTitleContextPaidMessagePriceChangedContextPassportDataContextPinnedMessageContextPollOptionAddedContextPollOptionDeletedContextProximityAlertTriggeredContextRefundedPaymentContextSuccessfulPaymentContextSuggestedPostApprovalFailedContextSuggestedPostApprovedContextSuggestedPostDeclinedContextSuggestedPostPaidContextSuggestedPostRefundedContextUniqueGiftContextUsersSharedContextVideoChatEndedContextVideoChatParticipantsInvitedContextVideoChatScheduledContextVideoChatStartedContextWebAppDataContextWriteAccessAllowedContext
Constructors
Constructor
new Message(
payload):Message
Defined in: contexts/index.d.ts:3009
Parameters
| Parameter | Type |
|---|---|
payload | TelegramMessage |
Returns
Message
Properties
| Property | Type | Defined in |
|---|---|---|
payload | TelegramMessage | contexts/index.d.ts:3008 |
Accessors
[toStringTag]
Get Signature
get [toStringTag]():
string
Defined in: contexts/index.d.ts:3011
Returns
string
animation
Get Signature
get animation():
AnimationAttachment
Defined in: contexts/index.d.ts:3098
Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set
Returns
audio
Get Signature
get audio():
AudioAttachment
Defined in: contexts/index.d.ts:3100
Message is an audio file, information about the file
Returns
authorSignature
Get Signature
get authorSignature():
string
Defined in: contexts/index.d.ts:3074
Signature of the post author for messages in channels, or the custom title of an anonymous group administrator
Returns
string
businessConnectionId
Get Signature
get businessConnectionId():
string
Defined in: contexts/index.d.ts:3036
Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier.
Returns
string
caption
Get Signature
get caption():
string
Defined in: contexts/index.d.ts:3119
Caption for the animation, audio, document, photo, video or voice, 0-1024 characters
Returns
string
captionEntities
Get Signature
get captionEntities():
MessageEntity[]
Defined in: contexts/index.d.ts:3124
For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
Returns
channelChatCreated
Get Signature
get channelChatCreated():
true
Defined in: contexts/index.d.ts:3195
Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in replyMessage if someone replies to a very first message in a channel.
Returns
true
chat
Get Signature
get chat():
Chat
Defined in: contexts/index.d.ts:3038
Conversation the message belongs to
Returns
chatBackgroundSet
Get Signature
get chatBackgroundSet():
ChatBackground
Defined in: contexts/index.d.ts:3246
Service message: chat background set
Returns
chatBoostAdded
Get Signature
get chatBoostAdded():
ChatBoostAdded
Defined in: contexts/index.d.ts:3244
Service message: chat boost added
Returns
chatOwnerChanged
Get Signature
get chatOwnerChanged():
ChatOwnerChanged
Defined in: contexts/index.d.ts:3170
Service message: chat owner has changed
Returns
chatOwnerLeft
Get Signature
get chatOwnerLeft():
ChatOwnerLeft
Defined in: contexts/index.d.ts:3168
Service message: chat owner has left
Returns
chatShared
Get Signature
get chatShared():
ChatShared
Defined in: contexts/index.d.ts:3228
Service message: a chat was shared with the bot
Returns
checklist
Get Signature
get checklist():
Checklist
Defined in: contexts/index.d.ts:3053
Returns
checklistTasksAdded
Get Signature
get checklistTasksAdded():
ChecklistTasksAdded
Defined in: contexts/index.d.ts:3251
Service message: checklist tasks added
Returns
checklistTasksDone
Get Signature
get checklistTasksDone():
ChecklistTasksDone
Defined in: contexts/index.d.ts:3248
Service message: checklist tasks done
Returns
connectedWebsite
Get Signature
get connectedWebsite():
string
Defined in: contexts/index.d.ts:3154
The domain name of the website on which the user has logged in.
Returns
string
contact
Get Signature
get contact():
Contact
Defined in: contexts/index.d.ts:3132
Message is a shared contact, information about the contact
Returns
createdAt
Get Signature
get createdAt():
number
Defined in: contexts/index.d.ts:3034
Date the message was sent in Unix time
Returns
number
deleteChatPhoto
Get Signature
get deleteChatPhoto():
true
Defined in: contexts/index.d.ts:3176
Service message: the chat photo was deleted
Returns
true
dice
Get Signature
get dice():
Dice
Defined in: contexts/index.d.ts:3134
Message is a dice with random value from 1 to 6
Returns
directMessagePriceChanged
Get Signature
get directMessagePriceChanged():
DirectMessagePriceChanged
Defined in: contexts/index.d.ts:3253
Service message: direct message price changed
Returns
directMessagesTopic
Get Signature
get directMessagesTopic():
DirectMessagesTopic
Defined in: contexts/index.d.ts:3017
Optional. Information about the direct messages chat topic that contains the message
Returns
document
Get Signature
get document():
DocumentAttachment
Defined in: contexts/index.d.ts:3102
Message is a general file, information about the file
Returns
effectId
Get Signature
get effectId():
string
Defined in: contexts/index.d.ts:3093
Unique identifier of the message effect added to the message
Returns
string
entities
Get Signature
get entities():
MessageEntity[]
Defined in: contexts/index.d.ts:3087
For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
Returns
externalReply
Get Signature
get externalReply():
ExternalReplyInfo
Defined in: contexts/index.d.ts:3055
Information about the message that is being replied to, which may come from another chat or forum topic
Returns
forumTopicClosed
Get Signature
get forumTopicClosed():
ForumTopicClosed
Defined in: contexts/index.d.ts:3269
Service message: forum topic closed
Returns
forumTopicCreated
Get Signature
get forumTopicCreated():
ForumTopicCreated
Defined in: contexts/index.d.ts:3265
Service message: forum topic created
Returns
forumTopicEdited
Get Signature
get forumTopicEdited():
ForumTopicEdited
Defined in: contexts/index.d.ts:3267
Service message: forum topic edited
Returns
forumTopicReopened
Get Signature
get forumTopicReopened():
ForumTopicReopened
Defined in: contexts/index.d.ts:3271
Service message: forum topic reopened
Returns
forwardOrigin
Get Signature
get forwardOrigin():
MessageOriginUser|MessageOriginChat|MessageOriginChannel|MessageOriginHiddenUser
Defined in: contexts/index.d.ts:3040
Information about the original message for forwarded messages
Returns
MessageOriginUser | MessageOriginChat | MessageOriginChannel | MessageOriginHiddenUser
from
Get Signature
get from():
User
Defined in: contexts/index.d.ts:3019
Sender, empty for messages sent to channels
Returns
game
Get Signature
get game():
Game
Defined in: contexts/index.d.ts:3136
Message is a game, information about the game
Returns
generalForumTopicHidden
Get Signature
get generalForumTopicHidden():
GeneralForumTopicHidden
Defined in: contexts/index.d.ts:3273
Service message: the 'General' forum topic hidden
Returns
generalForumTopicUnhidden
Get Signature
get generalForumTopicUnhidden():
GeneralForumTopicUnhidden
Defined in: contexts/index.d.ts:3275
Service message: the 'General' forum topic unhidden
Returns
gift
Get Signature
get gift():
GiftInfo
Defined in: contexts/index.d.ts:3230
Service message: a gift was sent to the chat
Returns
giftUpgradeSent
Get Signature
get giftUpgradeSent():
GiftInfo
Defined in: contexts/index.d.ts:3232
Service message: upgrade of a gift was purchased after the gift was sent
Returns
giveaway
Get Signature
get giveaway():
Giveaway
Defined in: contexts/index.d.ts:3277
The message is a scheduled giveaway message
Returns
giveawayCompleted
Get Signature
get giveawayCompleted():
GiveawayCompleted
Defined in: contexts/index.d.ts:3281
Service message: a giveaway without public winners was completed
Returns
giveawayCreated
Get Signature
get giveawayCreated():
GiveawayCreated
Defined in: contexts/index.d.ts:3279
Service message: a scheduled giveaway was created
Returns
giveawayWinners
Get Signature
get giveawayWinners():
GiveawayWinners
Defined in: contexts/index.d.ts:3283
A giveaway with public winners was completed
Returns
groupChatCreated
Get Signature
get groupChatCreated():
true
Defined in: contexts/index.d.ts:3178
Service message: the group has been created
Returns
true
id
Get Signature
get id():
number
Defined in: contexts/index.d.ts:3013
Unique message identifier inside this chat
Returns
number
invoice
Get Signature
get invoice():
Invoice
Defined in: contexts/index.d.ts:3219
Message is an invoice for a payment, information about the invoice
Returns
leftChatMember
Get Signature
get leftChatMember():
User
Defined in: contexts/index.d.ts:3166
A member was removed from the group, information about them (this member may be the bot itself)
Returns
linkPreviewOptions
Get Signature
get linkPreviewOptions():
LinkPreviewOptions
Defined in: contexts/index.d.ts:3089
Options used for link preview generation for the message, if it is a text message and link preview options were changed
Returns
location
Get Signature
get location():
Location
Defined in: contexts/index.d.ts:3146
Message is a shared location, information about the location
Returns
managedBotCreated
Get Signature
get managedBotCreated():
ManagedBotCreated
Defined in: contexts/index.d.ts:3295
Service message: user created a bot that will be managed by the current bot
Returns
mediaGroupId
Get Signature
get mediaGroupId():
string
Defined in: contexts/index.d.ts:3069
The unique identifier of a media message group this message belongs to
Returns
string
messageAutoDeleteTimerChanged
Get Signature
get messageAutoDeleteTimerChanged():
MessageAutoDeleteTimerChanged
Defined in: contexts/index.d.ts:3188
Service message: auto-delete timer settings changed in the chat
Returns
migrateFromChatId
Get Signature
get migrateFromChatId():
number
Defined in: contexts/index.d.ts:3211
The supergroup has been migrated from a group with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
Returns
number
migrateToChatId
Get Signature
get migrateToChatId():
number
Defined in: contexts/index.d.ts:3203
The group has been migrated to a supergroup with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
Returns
number
newChatMembers
Get Signature
get newChatMembers():
User[]
Defined in: contexts/index.d.ts:3161
New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
Returns
User[]
newChatPhoto
Get Signature
get newChatPhoto():
PhotoSize[]
Defined in: contexts/index.d.ts:3174
A chat photo was change to this value
Returns
newChatTitle
Get Signature
get newChatTitle():
string
Defined in: contexts/index.d.ts:3172
A chat title was changed to this value
Returns
string
paidStarCount
Get Signature
get paidStarCount():
number
Defined in: contexts/index.d.ts:3078
Optional. The number of Telegram Stars that were paid by the sender of the message to send it
Returns
number
passportData
Get Signature
get passportData():
PassportData
Defined in: contexts/index.d.ts:3156
Telegram Passport data
Returns
photo
Get Signature
get photo():
PhotoSize[]
Defined in: contexts/index.d.ts:3104
Message is a photo, available sizes of the photo
Returns
pinnedMessage
Get Signature
get pinnedMessage():
Omit<Message,"replyMessage"> |InaccessibleMessage
Defined in: contexts/index.d.ts:3217
Specified message was pinned. Note that the Message object in this field will not contain further replyMessage fields even if it is itself a reply.
Returns
Omit<Message, "replyMessage"> | InaccessibleMessage
poll
Get Signature
get poll():
Poll
Defined in: contexts/index.d.ts:3138
Message is a native poll, information about the poll
Returns
pollOptionAdded
Get Signature
get pollOptionAdded():
PollOptionAdded
Defined in: contexts/index.d.ts:3297
Service message: answer option was added to a poll
Returns
pollOptionDeleted
Get Signature
get pollOptionDeleted():
PollOptionDeleted
Defined in: contexts/index.d.ts:3299
Service message: answer option was deleted from a poll
Returns
proximityAlertTriggered
Get Signature
get proximityAlertTriggered():
ProximityAlertTriggered
Defined in: contexts/index.d.ts:3240
Service message. A user in the chat triggered another user's proximity alert while sharing Live Location.
Returns
quote
Get Signature
get quote():
TextQuote
Defined in: contexts/index.d.ts:3057
For replies that quote part of the original message, the quoted part of the message
Returns
replyMarkup
Get Signature
get replyMarkup():
InlineKeyboardMarkup
Defined in: contexts/index.d.ts:3152
Inline keyboard attached to the message.
login_url buttons are represented as ordinary url buttons.
Returns
replyMessage
Get Signature
get replyMessage():
Omit<Message,"replyMessage">
Defined in: contexts/index.d.ts:3046
For replies, the original message
Returns
Omit<Message, "replyMessage">
replyStory
Get Signature
get replyStory():
Story
Defined in: contexts/index.d.ts:3048
For replies to a story, the original story
Returns
replyToChecklistTaskId
Get Signature
get replyToChecklistTaskId():
number
Defined in: contexts/index.d.ts:3050
Optional. Identifier of the specific checklist task that is being replied to
Returns
number
replyToPollOptionId
Get Signature
get replyToPollOptionId():
string
Defined in: contexts/index.d.ts:3052
Optional. Persistent identifier of the specific poll option that is being replied to
Returns
string
senderBoostCount
Get Signature
get senderBoostCount():
number
Defined in: contexts/index.d.ts:3028
If the sender of the message boosted the chat, the number of boosts added by the user
Returns
number
senderBusinessBot
Get Signature
get senderBusinessBot():
User
Defined in: contexts/index.d.ts:3030
The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account.
Returns
senderChat
Get Signature
get senderChat():
Chat
Defined in: contexts/index.d.ts:3026
Sender of the message, sent on behalf of a chat. The channel itself for channel messages. The supergroup itself for messages from anonymous group administrators. The linked channel for messages automatically forwarded to the discussion group
Returns
senderTag
Get Signature
get senderTag():
string
Defined in: contexts/index.d.ts:3032
Tag or custom title of the sender of the message; for supergroups only
Returns
string
sticker
Get Signature
get sticker():
StickerAttachment
Defined in: contexts/index.d.ts:3106
Message is a sticker, information about the sticker
Returns
story
Get Signature
get story():
StoryAttachment
Defined in: contexts/index.d.ts:3108
Message is a forwarded story
Returns
successfulPayment
Get Signature
get successfulPayment():
SuccessfulPayment
Defined in: contexts/index.d.ts:3224
Message is a service message about a successful payment, information about the payment.
Returns
suggestedPostApprovalFailed
Get Signature
get suggestedPostApprovalFailed():
SuggestedPostApprovalFailed
Defined in: contexts/index.d.ts:3257
Service message: approval of a suggested post has failed
Returns
suggestedPostApproved
Get Signature
get suggestedPostApproved():
SuggestedPostApproved
Defined in: contexts/index.d.ts:3255
Service message: a suggested post was approved
Returns
suggestedPostDeclined
Get Signature
get suggestedPostDeclined():
SuggestedPostDeclined
Defined in: contexts/index.d.ts:3259
Service message: a suggested post was declined
Returns
suggestedPostInfo
Get Signature
get suggestedPostInfo():
SuggestedPostInfo
Defined in: contexts/index.d.ts:3091
Optional. Information about suggested post parameters if the message is a suggested post
Returns
suggestedPostPaid
Get Signature
get suggestedPostPaid():
SuggestedPostPaid
Defined in: contexts/index.d.ts:3261
Service message: payment for a suggested post was received
Returns
suggestedPostRefunded
Get Signature
get suggestedPostRefunded():
SuggestedPostRefunded
Defined in: contexts/index.d.ts:3263
Service message: payment for a suggested post was refunded
Returns
supergroupChatCreated
Get Signature
get supergroupChatCreated():
true
Defined in: contexts/index.d.ts:3186
Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in replyMessage if someone replies to a very first message in a directly created supergroup.
Returns
true
text
Get Signature
get text():
string
Defined in: contexts/index.d.ts:3082
For text messages, the actual UTF-8 text of the message, 0-4096 characters
Returns
string
threadId
Get Signature
get threadId():
number
Defined in: contexts/index.d.ts:3015
Unique identifier of a message thread to which the message belongs; for supergroups only
Returns
number
uniqueGift
Get Signature
get uniqueGift():
UniqueGiftInfo
Defined in: contexts/index.d.ts:3234
Service message: a unique gift was sent to the chat
Returns
updatedAt
Get Signature
get updatedAt():
number
Defined in: contexts/index.d.ts:3061
Date the message was last edited in Unix time
Returns
number
usersShared
Get Signature
get usersShared():
UsersShared
Defined in: contexts/index.d.ts:3226
Service message: a user was shared with the bot
Returns
venue
Get Signature
get venue():
Venue
Defined in: contexts/index.d.ts:3144
Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set
Returns
viaBot
Get Signature
get viaBot():
User
Defined in: contexts/index.d.ts:3059
Bot through which the message was sent
Returns
video
Get Signature
get video():
VideoAttachment
Defined in: contexts/index.d.ts:3110
Message is a video, information about the video
Returns
videoChatEnded
Get Signature
get videoChatEnded():
VideoChatEnded
Defined in: contexts/index.d.ts:3289
Service message: video chat ended
Returns
videoChatParticipantsInvited
Get Signature
get videoChatParticipantsInvited():
VideoChatParticipantsInvited
Defined in: contexts/index.d.ts:3291
Service message: new participants invited to a video chat
Returns
videoChatScheduled
Get Signature
get videoChatScheduled():
VideoChatScheduled
Defined in: contexts/index.d.ts:3285
Service message: video chat scheduled
Returns
videoChatStarted
Get Signature
get videoChatStarted():
VideoChatStarted
Defined in: contexts/index.d.ts:3287
Service message: video chat started
Returns
videoNote
Get Signature
get videoNote():
VideoNoteAttachment
Defined in: contexts/index.d.ts:3112
Message is a video note, information about the video message
Returns
voice
Get Signature
get voice():
VoiceAttachment
Defined in: contexts/index.d.ts:3114
Message is a voice message, information about the file
Returns
webAppData
Get Signature
get webAppData():
WebAppData
Defined in: contexts/index.d.ts:3293
Service message: data sent by a Web App
Returns
writeAccessAllowed
Get Signature
get writeAccessAllowed():
WriteAccessAllowed
Defined in: contexts/index.d.ts:3242
Service message: the user allowed the bot added to the attachment menu to write messages
Returns
Methods
hasMediaSpoiler()
hasMediaSpoiler():
true
Defined in: contexts/index.d.ts:3130
true, if the message media is covered by a spoiler animation
Returns
true
hasProtectedContent()
hasProtectedContent():
true
Defined in: contexts/index.d.ts:3063
true, if the message can't be forwarded
Returns
true
isAutomaticForward()
isAutomaticForward():
true
Defined in: contexts/index.d.ts:3044
true, if the message is a channel post that was automatically forwarded to the connected discussion group
Returns
true
isFromOffline()
isFromOffline():
true
Defined in: contexts/index.d.ts:3065
true, True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message
Returns
true
isPaidPost()
isPaidPost():
true
Defined in: contexts/index.d.ts:3067
Optional. True, if the message is a paid post
Returns
true
isShowCaptionAboveMedia()
isShowCaptionAboveMedia():
boolean
Defined in: contexts/index.d.ts:3128
True, if the caption must be shown above the message media
Returns
boolean
isTopicMessage()
isTopicMessage():
boolean
Defined in: contexts/index.d.ts:3042
true, if the message is sent to a forum topic
Returns
boolean