GramIO API Reference / @gramio/contexts/dist / Message
Class: Message
Defined in: contexts/index.d.ts:2908
This object represents a message.
Extended by
BoostAddedContextChatBackgroundSetContextChatOwnerChangedContextChatOwnerLeftContextChatSharedContextChecklistTasksAddedContextChecklistTasksDoneContextDeleteChatPhotoContextDirectMessagePriceChangedContextForumTopicClosedContextForumTopicCreatedContextForumTopicEditedContextForumTopicReopenedContextGeneralForumTopicHiddenContextGeneralForumTopicUnhiddenContextGiftContextGiftUpgradeSentContextGiveawayCompletedContextGiveawayCreatedContextGiveawayWinnersContextGroupChatCreatedContextInvoiceContextLeftChatMemberContextLocationContextMessageAutoDeleteTimerChangedContextMessageContextMigrateFromChatIdContextMigrateToChatIdContextNewChatMembersContextNewChatPhotoContextNewChatTitleContextPaidMessagePriceChangedContextPassportDataContextPinnedMessageContextProximityAlertTriggeredContextRefundedPaymentContextSuccessfulPaymentContextSuggestedPostApprovalFailedContextSuggestedPostApprovedContextSuggestedPostDeclinedContextSuggestedPostPaidContextSuggestedPostRefundedContextUniqueGiftContextUsersSharedContextVideoChatEndedContextVideoChatParticipantsInvitedContextVideoChatScheduledContextVideoChatStartedContextWebAppDataContextWriteAccessAllowedContext
Constructors
Constructor
new Message(
payload):Message
Defined in: contexts/index.d.ts:2910
Parameters
| Parameter | Type |
|---|---|
payload | TelegramMessage |
Returns
Message
Properties
| Property | Type | Defined in |
|---|---|---|
payload | TelegramMessage | contexts/index.d.ts:2909 |
Accessors
[toStringTag]
Get Signature
get [toStringTag]():
string
Defined in: contexts/index.d.ts:2912
Returns
string
animation
Get Signature
get animation():
AnimationAttachment
Defined in: contexts/index.d.ts:2997
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:2999
Message is an audio file, information about the file
Returns
authorSignature
Get Signature
get authorSignature():
string
Defined in: contexts/index.d.ts:2973
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:2937
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:3018
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:3023
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:3094
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:2939
Conversation the message belongs to
Returns
chatBackgroundSet
Get Signature
get chatBackgroundSet():
ChatBackground
Defined in: contexts/index.d.ts:3145
Service message: chat background set
Returns
chatBoostAdded
Get Signature
get chatBoostAdded():
ChatBoostAdded
Defined in: contexts/index.d.ts:3143
Service message: chat boost added
Returns
chatOwnerChanged
Get Signature
get chatOwnerChanged():
ChatOwnerChanged
Defined in: contexts/index.d.ts:3069
Service message: chat owner has changed
Returns
chatOwnerLeft
Get Signature
get chatOwnerLeft():
ChatOwnerLeft
Defined in: contexts/index.d.ts:3067
Service message: chat owner has left
Returns
chatShared
Get Signature
get chatShared():
ChatShared
Defined in: contexts/index.d.ts:3127
Service message: a chat was shared with the bot
Returns
checklist
Get Signature
get checklist():
Checklist
Defined in: contexts/index.d.ts:2952
Returns
checklistTasksAdded
Get Signature
get checklistTasksAdded():
ChecklistTasksAdded
Defined in: contexts/index.d.ts:3150
Service message: checklist tasks added
Returns
checklistTasksDone
Get Signature
get checklistTasksDone():
ChecklistTasksDone
Defined in: contexts/index.d.ts:3147
Service message: checklist tasks done
Returns
connectedWebsite
Get Signature
get connectedWebsite():
string
Defined in: contexts/index.d.ts:3053
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:3031
Message is a shared contact, information about the contact
Returns
createdAt
Get Signature
get createdAt():
number
Defined in: contexts/index.d.ts:2935
Date the message was sent in Unix time
Returns
number
deleteChatPhoto
Get Signature
get deleteChatPhoto():
true
Defined in: contexts/index.d.ts:3075
Service message: the chat photo was deleted
Returns
true
dice
Get Signature
get dice():
Dice
Defined in: contexts/index.d.ts:3033
Message is a dice with random value from 1 to 6
Returns
directMessagePriceChanged
Get Signature
get directMessagePriceChanged():
DirectMessagePriceChanged
Defined in: contexts/index.d.ts:3152
Service message: direct message price changed
Returns
directMessagesTopic
Get Signature
get directMessagesTopic():
DirectMessagesTopic
Defined in: contexts/index.d.ts:2918
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:3001
Message is a general file, information about the file
Returns
effectId
Get Signature
get effectId():
string
Defined in: contexts/index.d.ts:2992
Unique identifier of the message effect added to the message
Returns
string
entities
Get Signature
get entities():
MessageEntity[]
Defined in: contexts/index.d.ts:2986
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:2954
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:3168
Service message: forum topic closed
Returns
forumTopicCreated
Get Signature
get forumTopicCreated():
ForumTopicCreated
Defined in: contexts/index.d.ts:3164
Service message: forum topic created
Returns
forumTopicEdited
Get Signature
get forumTopicEdited():
ForumTopicEdited
Defined in: contexts/index.d.ts:3166
Service message: forum topic edited
Returns
forumTopicReopened
Get Signature
get forumTopicReopened():
ForumTopicReopened
Defined in: contexts/index.d.ts:3170
Service message: forum topic reopened
Returns
forwardOrigin
Get Signature
get forwardOrigin():
MessageOriginUser|MessageOriginChat|MessageOriginChannel|MessageOriginHiddenUser
Defined in: contexts/index.d.ts:2941
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:2920
Sender, empty for messages sent to channels
Returns
game
Get Signature
get game():
Game
Defined in: contexts/index.d.ts:3035
Message is a game, information about the game
Returns
generalForumTopicHidden
Get Signature
get generalForumTopicHidden():
GeneralForumTopicHidden
Defined in: contexts/index.d.ts:3172
Service message: the 'General' forum topic hidden
Returns
generalForumTopicUnhidden
Get Signature
get generalForumTopicUnhidden():
GeneralForumTopicUnhidden
Defined in: contexts/index.d.ts:3174
Service message: the 'General' forum topic unhidden
Returns
gift
Get Signature
get gift():
GiftInfo
Defined in: contexts/index.d.ts:3129
Service message: a gift was sent to the chat
Returns
giftUpgradeSent
Get Signature
get giftUpgradeSent():
GiftInfo
Defined in: contexts/index.d.ts:3131
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:3176
The message is a scheduled giveaway message
Returns
giveawayCompleted
Get Signature
get giveawayCompleted():
GiveawayCompleted
Defined in: contexts/index.d.ts:3180
Service message: a giveaway without public winners was completed
Returns
giveawayCreated
Get Signature
get giveawayCreated():
GiveawayCreated
Defined in: contexts/index.d.ts:3178
Service message: a scheduled giveaway was created
Returns
giveawayWinners
Get Signature
get giveawayWinners():
GiveawayWinners
Defined in: contexts/index.d.ts:3182
A giveaway with public winners was completed
Returns
groupChatCreated
Get Signature
get groupChatCreated():
true
Defined in: contexts/index.d.ts:3077
Service message: the group has been created
Returns
true
id
Get Signature
get id():
number
Defined in: contexts/index.d.ts:2914
Unique message identifier inside this chat
Returns
number
invoice
Get Signature
get invoice():
Invoice
Defined in: contexts/index.d.ts:3118
Message is an invoice for a payment, information about the invoice
Returns
leftChatMember
Get Signature
get leftChatMember():
User
Defined in: contexts/index.d.ts:3065
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:2988
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:3045
Message is a shared location, information about the location
Returns
mediaGroupId
Get Signature
get mediaGroupId():
string
Defined in: contexts/index.d.ts:2968
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:3087
Service message: auto-delete timer settings changed in the chat
Returns
migrateFromChatId
Get Signature
get migrateFromChatId():
number
Defined in: contexts/index.d.ts:3110
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:3102
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:3060
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:3073
A chat photo was change to this value
Returns
newChatTitle
Get Signature
get newChatTitle():
string
Defined in: contexts/index.d.ts:3071
A chat title was changed to this value
Returns
string
paidStarCount
Get Signature
get paidStarCount():
number
Defined in: contexts/index.d.ts:2977
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:3055
Telegram Passport data
Returns
photo
Get Signature
get photo():
PhotoSize[]
Defined in: contexts/index.d.ts:3003
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:3116
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:3037
Message is a native poll, information about the poll
Returns
proximityAlertTriggered
Get Signature
get proximityAlertTriggered():
ProximityAlertTriggered
Defined in: contexts/index.d.ts:3139
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:2956
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:3051
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:2947
For replies, the original message
Returns
Omit<Message, "replyMessage">
replyStory
Get Signature
get replyStory():
Story
Defined in: contexts/index.d.ts:2949
For replies to a story, the original story
Returns
replyToChecklistTaskId
Get Signature
get replyToChecklistTaskId():
number
Defined in: contexts/index.d.ts:2951
Optional. Identifier of the specific checklist task that is being replied to
Returns
number
senderBoostCount
Get Signature
get senderBoostCount():
number
Defined in: contexts/index.d.ts:2929
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:2931
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:2927
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:2933
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:3005
Message is a sticker, information about the sticker
Returns
story
Get Signature
get story():
StoryAttachment
Defined in: contexts/index.d.ts:3007
Message is a forwarded story
Returns
successfulPayment
Get Signature
get successfulPayment():
SuccessfulPayment
Defined in: contexts/index.d.ts:3123
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:3156
Service message: approval of a suggested post has failed
Returns
suggestedPostApproved
Get Signature
get suggestedPostApproved():
SuggestedPostApproved
Defined in: contexts/index.d.ts:3154
Service message: a suggested post was approved
Returns
suggestedPostDeclined
Get Signature
get suggestedPostDeclined():
SuggestedPostDeclined
Defined in: contexts/index.d.ts:3158
Service message: a suggested post was declined
Returns
suggestedPostInfo
Get Signature
get suggestedPostInfo():
SuggestedPostInfo
Defined in: contexts/index.d.ts:2990
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:3160
Service message: payment for a suggested post was received
Returns
suggestedPostRefunded
Get Signature
get suggestedPostRefunded():
SuggestedPostRefunded
Defined in: contexts/index.d.ts:3162
Service message: payment for a suggested post was refunded
Returns
supergroupChatCreated
Get Signature
get supergroupChatCreated():
true
Defined in: contexts/index.d.ts:3085
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:2981
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:2916
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:3133
Service message: a unique gift was sent to the chat
Returns
updatedAt
Get Signature
get updatedAt():
number
Defined in: contexts/index.d.ts:2960
Date the message was last edited in Unix time
Returns
number
usersShared
Get Signature
get usersShared():
UsersShared
Defined in: contexts/index.d.ts:3125
Service message: a user was shared with the bot
Returns
venue
Get Signature
get venue():
Venue
Defined in: contexts/index.d.ts:3043
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:2958
Bot through which the message was sent
Returns
video
Get Signature
get video():
VideoAttachment
Defined in: contexts/index.d.ts:3009
Message is a video, information about the video
Returns
videoChatEnded
Get Signature
get videoChatEnded():
VideoChatEnded
Defined in: contexts/index.d.ts:3188
Service message: video chat ended
Returns
videoChatParticipantsInvited
Get Signature
get videoChatParticipantsInvited():
VideoChatParticipantsInvited
Defined in: contexts/index.d.ts:3190
Service message: new participants invited to a video chat
Returns
videoChatScheduled
Get Signature
get videoChatScheduled():
VideoChatScheduled
Defined in: contexts/index.d.ts:3184
Service message: video chat scheduled
Returns
videoChatStarted
Get Signature
get videoChatStarted():
VideoChatStarted
Defined in: contexts/index.d.ts:3186
Service message: video chat started
Returns
videoNote
Get Signature
get videoNote():
VideoNoteAttachment
Defined in: contexts/index.d.ts:3011
Message is a video note, information about the video message
Returns
voice
Get Signature
get voice():
VoiceAttachment
Defined in: contexts/index.d.ts:3013
Message is a voice message, information about the file
Returns
webAppData
Get Signature
get webAppData():
WebAppData
Defined in: contexts/index.d.ts:3192
Service message: data sent by a Web App
Returns
writeAccessAllowed
Get Signature
get writeAccessAllowed():
WriteAccessAllowed
Defined in: contexts/index.d.ts:3141
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:3029
true, if the message media is covered by a spoiler animation
Returns
true
hasProtectedContent()
hasProtectedContent():
true
Defined in: contexts/index.d.ts:2962
true, if the message can't be forwarded
Returns
true
isAutomaticForward()
isAutomaticForward():
true
Defined in: contexts/index.d.ts:2945
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:2964
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:2966
Optional. True, if the message is a paid post
Returns
true
isShowCaptionAboveMedia()
isShowCaptionAboveMedia():
boolean
Defined in: contexts/index.d.ts:3027
True, if the caption must be shown above the message media
Returns
boolean
isTopicMessage()
isTopicMessage():
boolean
Defined in: contexts/index.d.ts:2943
true, if the message is sent to a forum topic
Returns
boolean