Get the input peer that this conversation is with
ID of the very last message in this conversation.
ID of the last incoming message in this conversation.
Note that before any messages were received since the start of the conversation, this will equal to lastMessage
Mark the conversation as read up to a certain point.
By default, reads until the last message.
You can pass message=null
to read the entire conversation,
or pass message ID to read up until that ID.
Optional
clearOptional
message?: null | numberSend a media to this conversation.
Wrapper over sendMedia
Rest
...params: [media: string | InputMediaLike, params?: CommonSendParams & { Send a media group to this conversation.
Wrapper over sendMediaGroup
Rest
...params: [medias: (string | InputMediaLike)[], params?: CommonSendParams & { Send a text message to this conversation.
Wrapper over sendText
Rest
...params: [text: InputText, params?: CommonSendParams & { Wait for a message to be edited in the conversation. By defaults wait for the last message sent by the other party (at the moment) to be edited.
Returns the edited message.
Optional
filter: ((msg: Message) => MaybePromise<boolean>)Filter for the handler. You can use any filter you can use for dispatcher
Optional
params: { Optional
message?: numberMessage for which to wait for reply for.
Optional
timeout?: null | numberTimeout for the handler in ms. Pass null
to disable.
When the timeout is reached, TimeoutError
is thrown.
Wait for a new message in the conversation
Optional
filter: ((msg: Message) => MaybePromise<boolean>)Filter for the handler. You can use any filter you can use for dispatcher
Optional
timeout: null | number = 15000Timeout for the handler in ms. Pass null
to disable.
When the timeout is reached, MtTimeoutError
is thrown.
Wait for the message to be read by the other party.
Note that reading the message doesn't mean the response was sent, and if the response was sent, it doesn't mean that the message was read.
Optional
message: numberMessage for which to wait for read for. Defaults to last message.
Timeout for the handler in ms, def. 15 sec. Pass null
to disable.
When the timeout is reached, TimeoutError
is thrown.
Wait for the reply for the given message' (def. the last one) in the conversation.
Optional
filter: ((msg: Message) => MaybePromise<boolean>)Filter for the handler. You can use any filter you can use for dispatcher
Optional
params: { Optional
message?: numberMessage for which to wait for reply for.
Optional
timeout?: null | numberTimeout for the handler in ms. Pass null
to disable.
When the timeout is reached, TimeoutError
is thrown.
Wait for a response for the given message (def. the last one) in the conversation.
A message is considered to be a response if it was sent after the given one.
Optional
filter: ((msg: Message) => MaybePromise<boolean>)Filter for the handler. You can use any filter you can use for dispatcher
Optional
params: { Optional
message?: numberMessage for which to wait for response for.
Optional
timeout?: null | numberTimeout for the handler in ms. Pass null
to disable.
When the timeout is reached, TimeoutError
is thrown.
Helper method that calls start, the provided function and then stop.
It is preferred that you use this function rather than manually starting and stopping the conversation.
If you don't stop the conversation when you're done, it will lead to memory leaks.
Static
handlePass the update to the conversation manager and all registered conversations on this client.
true
if the update was handled by some conversation
Represents a conversation inside some chat.
A conversation keeps track of any messages sent or edited since it was started and until it was stopped, and allows waiting for events in it.
If you need a conversation across multiple chats, you should use multiple Conversation objects and synchronize them manually.