Documentation
¶
Overview ¶
Package room interfaces with matrix rooms.
Index ¶
Constants ¶
const MessageEventType = "m.room.message"
MessageEventType indicates a room event is a message.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventWithoutContent ¶
type EventWithoutContent struct { EventID string `json:"event_id"` OriginSenderTimestamp int `json:"origin_server_ts"` Sender string `json:"sender"` StateKey string `json:"state_key"` EventType string `json:"type"` }
EventWithoutContent represents a room event without the content field. This struct should be extended by more concrete types.
func (EventWithoutContent) IsRoomMessageEvent ¶
func (e EventWithoutContent) IsRoomMessageEvent() bool
IsRoomMessageEvent returns true if the event represents a message sent to a matrix room.
type MessageContent ¶
type MessageContent struct { MessageType string `json:"msgtype"` Body string `json:"body"` Format string `json:"format,omitempty"` FormattedBody string `json:"formatted_body,omitempty"` }
MessageContent represents the content of room message.
type MessageEvent ¶
type MessageEvent struct { EventWithoutContent Content MessageContent `struct:"content"` }
MessageEvent is a message sent to a room.
type OpaqueContent ¶
type OpaqueContent []byte
OpaqueContent is the marshalled form of a room event content.
func (*OpaqueContent) UnmarshalJSON ¶
func (o *OpaqueContent) UnmarshalJSON(b []byte) error
UnmarshalJSON tells the json unmarshaller to leave the content field as is.
type OpaqueEvent ¶
type OpaqueEvent struct { EventWithoutContent Content OpaqueContent `json:"content,string"` }
OpaqueEvent is a room event with opaque content.
func (OpaqueEvent) AsRoomMessageEvent ¶
func (r OpaqueEvent) AsRoomMessageEvent() (MessageEvent, error)
AsRoomMessageEvent converts this event to a MessageEvent. Panics if wrong type.
type Room ¶
type Room struct {
// contains filtered or unexported fields
}
Room represents a matrix room.
func (*Room) SendMessage ¶
SendMessage with the given text content to the room.
func (*Room) SyncEvents ¶
SyncEvents of this room and let all messages be handled by handler.