% tinyrox says don't edit this manually, but it can't stop you!
\name{mx_extract_text_events}
\alias{mx_extract_text_events}
\title{Extract text message events from a sync response}
\usage{
mx_extract_text_events(sync_resp, self_id, msgtypes = "m.text")
}
\arguments{
\item{sync_resp}{Parsed \code{/sync} response.}

\item{self_id}{Current user's Matrix id.}

\item{msgtypes}{Character vector of message types to include.}
}
\value{
List of normalized event records, each carrying
  \code{room_id}, \code{event_id}, \code{sender}, \code{is_self},
  \code{body}, \code{msgtype}, \code{ts} (the event's
  \code{origin_server_ts}, in milliseconds since the epoch, or NULL
  when the server omits it), and \code{mentions}.
}
\description{
Walks joined-room timeline events and returns normalized text-message
records. Self events are retained and tagged with \code{is_self}.
}
\examples{
sync_resp <- list(rooms = list(join = list("!room:example.org" = list(
    timeline = list(events = list(list(type = "m.room.message",
        event_id = "$1", sender = "@alice:example.org",
        content = list(msgtype = "m.text", body = "hello"))))))))
mx_extract_text_events(sync_resp, self_id = "@bot:example.org")
}
