MessageBehaviour
What you can do to a message you are holding.
Mixed into the generated Message part, so the chat id, message id, and business connection are read off the message instead of being threaded through every call. Each method is a thin pass to the Bot API method of the same job, and returns its promise.
Tags
Table of Contents
Methods
- copy() : PromiseInterface<string|int, MessageId>
- Copies this message to another chat, without a link back to the original.
- delete() : PromiseInterface<string|int, bool>
- Deletes this message.
- edit() : PromiseInterface<string|int, Message|bool>
- Edits this message's text. Only messages the bot sent can be edited.
- editCaption() : PromiseInterface<string|int, Message|bool>
- Edits this message's caption.
- editReplyMarkup() : PromiseInterface<string|int, Message|bool>
- Replaces the buttons under this message.
- forward() : PromiseInterface<string|int, Message>
- Forwards this message to another chat.
- getChatId() : int|string|null
- The id of the chat this message belongs to.
- pin() : PromiseInterface<string|int, bool>
- Pins this message in its chat.
- react() : PromiseInterface<string|int, bool>
- Reacts to this message. Passing no emoji clears the bot's reaction.
- reply() : PromiseInterface<string|int, Message>
- Replies to this message.
- replyWithDocument() : PromiseInterface<string|int, Message>
- Replies with a document.
- replyWithPhoto() : PromiseInterface<string|int, Message>
- Replies with a photo.
- say() : PromiseInterface<string|int, Message>
- Sends a message to this chat without quoting this one.
- unpin() : PromiseInterface<string|int, bool>
- Unpins this message.
Methods
copy()
Copies this message to another chat, without a link back to the original.
public
copy(int|string $chatId[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, MessageId>
Parameters
- $chatId : int|string
- $options : array<string, mixed> = []
-
Any other
copyMessagefield.
Return values
PromiseInterface<string|int, MessageId>delete()
Deletes this message.
public
delete() : PromiseInterface<string|int, bool>
Return values
PromiseInterface<string|int, bool>edit()
Edits this message's text. Only messages the bot sent can be edited.
public
edit(string $text[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message|bool>
Parameters
- $text : string
- $options : array<string, mixed> = []
-
Any other
editMessageTextfield.
Return values
PromiseInterface<string|int, Message|bool>editCaption()
Edits this message's caption.
public
editCaption([?string $caption = null ][, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message|bool>
Parameters
- $caption : ?string = null
- $options : array<string, mixed> = []
-
Any other
editMessageCaptionfield.
Return values
PromiseInterface<string|int, Message|bool>editReplyMarkup()
Replaces the buttons under this message.
public
editReplyMarkup([array<string, mixed>|JsonSerializable|null $replyMarkup = null ]) : PromiseInterface<string|int, Message|bool>
Parameters
- $replyMarkup : array<string, mixed>|JsonSerializable|null = null
Return values
PromiseInterface<string|int, Message|bool>forward()
Forwards this message to another chat.
public
forward(int|string $chatId[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message>
Parameters
- $chatId : int|string
- $options : array<string, mixed> = []
-
Any other
forwardMessagefield.
Return values
PromiseInterface<string|int, Message>getChatId()
The id of the chat this message belongs to.
public
getChatId() : int|string|null
Return values
int|string|nullpin()
Pins this message in its chat.
public
pin([bool $disableNotification = false ]) : PromiseInterface<string|int, bool>
Parameters
- $disableNotification : bool = false
Return values
PromiseInterface<string|int, bool>react()
Reacts to this message. Passing no emoji clears the bot's reaction.
public
react([array<int, string>|string|null $emoji = null ][, bool $isBig = false ]) : PromiseInterface<string|int, bool>
Parameters
- $emoji : array<int, string>|string|null = null
-
One or more reaction emoji.
- $isBig : bool = false
Return values
PromiseInterface<string|int, bool>reply()
Replies to this message.
public
reply(string $text[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message>
Parameters
- $text : string
- $options : array<string, mixed> = []
-
Any other
sendMessagefield.
Return values
PromiseInterface<string|int, Message>replyWithDocument()
Replies with a document.
public
replyWithDocument(InputFile|string $document[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message>
Parameters
- $document : InputFile|string
- $options : array<string, mixed> = []
-
Any other
sendDocumentfield.
Return values
PromiseInterface<string|int, Message>replyWithPhoto()
Replies with a photo.
public
replyWithPhoto(InputFile|string $photo[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message>
Parameters
- $photo : InputFile|string
- $options : array<string, mixed> = []
-
Any other
sendPhotofield.
Return values
PromiseInterface<string|int, Message>say()
Sends a message to this chat without quoting this one.
public
say(string $text[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message>
Parameters
- $text : string
- $options : array<string, mixed> = []
-
Any other
sendMessagefield.
Return values
PromiseInterface<string|int, Message>unpin()
Unpins this message.
public
unpin() : PromiseInterface<string|int, bool>