Documentation - v0.27.1
    Preparing search index...

    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.

    Index

    Constructors

    Properties

    Accessors

    Methods

    • 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.

      Parameters

      • __namedParameters: { clearMentions?: boolean; message?: number | null } = {}

      Returns Promise<void>

    • Send a media group to this conversation.

      Wrapper over sendMediaGroup

      Parameters

      • ...params: [
            medias: (string | InputMediaLike)[],
            params?: CommonSendParams & {
                invertMedia?: boolean;
                progressCallback?: (
                    index: number,
                    uploaded: number,
                    total: number,
                ) => void;
            },
        ]

      Returns Promise<Message[]>

    • 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.

      Parameters

      • Optionalfilter: (msg: Message) => MaybePromise<boolean>

        Filter for the handler. You can use any filter you can use for dispatcher

      • Optionalparams: { message?: number; timeout?: number | null }
        • Optionalmessage?: number

          Message for which to wait for reply for.

          last received message
          
        • Optionaltimeout?: number | null

          Timeout for the handler in ms. Pass null to disable.

          When the timeout is reached, TimeoutError is thrown.

          15000 (15 sec)

      Returns Promise<Message>

    • Wait for a new message in the conversation

      Parameters

      • Optionalfilter: (msg: Message) => MaybePromise<boolean>

        Filter for the handler. You can use any filter you can use for dispatcher

      • Optionaltimeout: number | null = 15000

        Timeout for the handler in ms. Pass null to disable. When the timeout is reached, MtTimeoutError is thrown.

      Returns Promise<Message>

    • 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.

      Parameters

      • Optionalmessage: number

        Message for which to wait for read for. Defaults to last message.

      • timeout: number | null = 15000

        Timeout for the handler in ms, def. 15 sec. Pass null to disable. When the timeout is reached, TimeoutError is thrown.

      Returns Promise<void>

    • Wait for the reply for the given message' (def. the last one) in the conversation.

      Parameters

      • Optionalfilter: (msg: Message) => MaybePromise<boolean>

        Filter for the handler. You can use any filter you can use for dispatcher

      • Optionalparams: { message?: number; timeout?: number | null }
        • Optionalmessage?: number

          Message for which to wait for reply for.

          last sent/received message
          
        • Optionaltimeout?: number | null

          Timeout for the handler in ms. Pass null to disable.

          When the timeout is reached, TimeoutError is thrown.

          15000 (15 sec)

      Returns Promise<Message>

    • 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.

      Parameters

      • Optionalfilter: (msg: Message) => MaybePromise<boolean>

        Filter for the handler. You can use any filter you can use for dispatcher

      • Optionalparams: { message?: number; timeout?: number | null }
        • Optionalmessage?: number

          Message for which to wait for response for.

          last sent/received message
          
        • Optionaltimeout?: number | null

          Timeout for the handler in ms. Pass null to disable.

          When the timeout is reached, TimeoutError is thrown.

          15000 (15 sec)

      Returns Promise<Message>