Skip to content

export Class

Message ​

extends ​

BaseClass<Message, MessagePacket>

implements ​

Omit<MessagePacket, "entities" | "caption_entities">

Constructor ​

ts
 new Message( client, packet )
ParameterTypeDescription
clientClient
packetMessagePacket

Properties ​

get chat : Chat ​

get command : boolean ​

get entities : MessageEntitiesStore ​

get from : Chat | User ​

get id : number ​

get language_code : undefined | string ​

get manager : MessagesManager ​

get member : undefined | Message ​

get sender_chat : undefined | Chat ​

get topic : undefined | ForumTopic ​

get user : undefined | User ​

animation? : Animation ​

audio? : Audio ​

author_signature? : string ​

boost_added? : ChatBoostAdded ​

business_connection_id? : string ​

caption? : string ​

caption_entities? : MessageEntityPayload[] ​

channel_chat_created? : true ​

chat_background_set? : ChatBackground ​

chat_shared? : ChatShared ​

readonly client : Client ​

connected_website? : string ​

contact? : ContactPayload ​

date : number ​

delete_chat_photo? : true ​

dice? : DicePayload ​

document? : Document ​

edit_date? : number ​

edited? : boolean ​

effect_id? : string ​

external_reply? : ExternalReplyInfo ​

forum_topic_closed? : ForumTopicClosed ​

forum_topic_created? : ForumTopicCreated ​

forum_topic_edited? : ForumTopicEdited ​

forum_topic_reopened? : ForumTopicReopened ​

forward_origin? : MessageOrigin ​

game? : GamePacket ​

general_forum_topic_hidden? : GeneralForumTopicHidden ​

general_forum_topic_unhidden? : GeneralForumTopicUnhidden ​

giveaway? : Giveaway ​

giveaway_completed? : GiveawayCompleted ​

giveaway_created? : GiveawayCreated ​

giveaway_winners? : GiveawayWinners ​

group_chat_created? : true ​

has_media_spoiler? : true ​

has_protected_content? : true ​

invoice? : InvoicePacket ​

is_automatic_forward? : true ​

is_from_offline? : true ​

is_topic_message? : true ​

left_chat_member? : UserPacket ​

location? : Location ​

media_group_id? : string ​

message_auto_delete_timer_changed? : MessageAutoDeleteTimerChanged ​

message_id : number ​

message_thread_id? : number ​

migrate_from_chat_id? : number ​

migrate_to_chat_id? : number ​

new_chat_members? : UserPacket[] ​

new_chat_photo? : PhotoSize[] ​

new_chat_title? : string ​

passport_data? : PassportData ​

photo? : PhotoSize[] ​

pinned_message? : InaccessibleMessage ​

poll? : PollPacket ​

proximity_alert_triggered? : ProximityAlertTriggered ​

quote? : TextQuote ​

reactions : MessageReactions ​

refunded_payment? : RefundedPaymentPacket ​

reply_markup? : InlineKeyboardMarkup ​

reply_to_message? : Message ​

reply_to_story? : StoryPacket ​

sender_boost_count? : number ​

sender_business_bot? : UserPacket ​

show_caption_above_media? : true ​

sticker? : Sticker ​

story? : StoryPacket ​

successful_payment? : SuccessfulPayment ​

supergroup_chat_created? : true ​

text? : string ​

users_shared? : UsersShared ​

venue? : VenuePayload ​

via_bot? : UserPacket ​

video? : Video ​

video_chat_ended? : VideoChatEnded ​

video_chat_participants_invited? : VideoChatParticipantsInvited ​

video_chat_scheduled? : VideoChatScheduled ​

video_chat_started? : VideoChatStarted ​

video_note? : VideoNote ​

voice? : Voice ​

web_app_data? : WebAppData ​

write_access_allowed? : WriteAccessAllowed ​

Methods ​

asynccopy( chat_id, payload ) ​

ParameterTypeDescription
chat_idstring | numberThe chat to copy the message to.
payloadCopyMessagePayloadAdditional data for copying.

Copies the message to a chat.

Returns: Promise<boolean>

createCallbackCollector( options, filter ) ​

ParameterTypeDescription
optionsCallbackCollectorOptionsThe options for the collector, the filter is unoverridable.
filter?FunctionAdditional conditions to the filter.

Creates a callback query collector to the chat of the message while filtering only relevant to the message.

Returns: CallbackCollector

asyncdelete( ) ​

Deletes the message.

Returns: Promise<boolean>

asyncedit( payload ) ​

ParameterTypeDescription
payloadMessageEditPayloadThe content of what the message will contain.

Edits the message.

Returns: Promise<boolean | Message>

asynceditCaption( payload ) ​

ParameterTypeDescription
payloadMessagecaptionEditPayloadThe content of what the caption will contain.

Edits the caption of the message.

Returns: Promise<boolean | Message>

asynceditMedia( payload ) ​

ParameterTypeDescription
payloadMessageMediaEditPayloadThe content of what the media will contain.

Edits the media of the message.

Returns: Promise<boolean | Message>

asynceditReplyMarkup( payload ) ​

ParameterTypeDescription
payloadMessageReplyMarkupEditPayloadThe content of what the reply markup will contain.

Edits only the reply markup of the message.

Returns: Promise<boolean | Message>

asyncforward( chat_id, payload ) ​

ParameterTypeDescription
chat_idstring | numberThe chat to forward the message to.
payloadForwardPayloadAdditional data for forwarding.

Forwards the message to a chat.

Returns: Promise<boolean>

asyncpin( disable_notification, business_connection_id ) ​

ParameterTypeDescription
disable_notification?boolean
business_connection_id?string

Pins the message.

Returns: Promise<boolean>

asyncreply( pointer, payload, form_data ) ​

ParameterTypeDescription
pointerMessagePayloadMethodThe type or method of the message.
payloadPartial<MessagePayload>What the message will contain.
form_data?FormDataBuilderFormData for uploading a media with the message.

Replies a message to the current message.

Returns: Promise<boolean | Message>

asyncreplyInvoice( id ) ​

ParameterTypeDescription
idstringThe id of the invoice.

Replies an invoice message that must be an invoice and not a link to the currenct message.

Returns: Promise<boolean | Message>

asyncreplyText( text ) ​

ParameterTypeDescription
textstringWhat the text will contain.

Replies a text message to the current message.

Returns: Promise<boolean | Message>

asyncsetReaction( reaction, is_big ) ​

ParameterTypeDescription
reactionReactionsThe reactions.
is_big?booleanPass True to set the reaction with a big animation

Sets the reaction of the message.

Returns: Promise<boolean>

asyncunpin( business_connection_id ) ​

ParameterTypeDescription
business_connection_idstring

Unpins the message.

Returns: Promise<boolean>

A modern, powerful library for building your Telegram bots, with seamless support for both JavaScript and Typescript.