Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrRetriesExceeded = errors.New("amount of retries exceeded")
)
Errors returned by the messenger
Functions ¶
This section is empty.
Types ¶
type ChannelResponse ¶
ChannelResponse holds information about a channel
type MatrixClient ¶
type MatrixClient interface { SendMessageEvent(roomID id.RoomID, eventType event.Type, contentJSON interface{}, extra ...mautrix.ReqSendEvent) (resp *mautrix.RespSendEvent, err error) RedactEvent(roomID id.RoomID, eventID id.EventID, extra ...mautrix.ReqRedact) (resp *mautrix.RespSendEvent, err error) JoinedMembers(roomID id.RoomID) (resp *mautrix.RespJoinedMembers, err error) CreateRoom(req *mautrix.ReqCreateRoom) (resp *mautrix.RespCreateRoom, err error) }
MatrixClient defines an interface to wrap the matrix API
type Message ¶
type Message struct { Body string // Plain text message use \n for newlines BodyHTML string // HTML formatted message - optional ResponseToMessage string // ID of a message to respond to - optional ChannelExternalIdentifier string // Channel ID to send the message to }
Message holds information about a message
func HTMLMessage ¶
HTMLMessage constructs a simple HTML message with a plaintext fallback
func PlainTextMessage ¶
PlainTextMessage constructs a simple plain text message
type MessageResponse ¶
type Messenger ¶
type Messenger interface { SendMessageAsync(message *Message) error SendMessage(message *Message) (*MessageResponse, error) SendReactionAsync(reaction *Reaction) error SendResponseAsync(response *Response) error SendResponse(response *Response) (*MessageResponse, error) SendRedactAsync(redact *Redact) error CreateChannel(userID string) (*ChannelResponse, error) DeleteMessageAsync(deleteAction *Delete) error }
Messenger provides an interface for sending and handling matrix events The Queue... methods work asynchronous but do not provide any information about the sent message The Send... methods work snchronous and provide more detailed feedback, they can be used asynchronous
func NewMessenger ¶
func NewMessenger(debug bool, config *configuration.Config, db types.Database, cryptoStore crypto.Store, stateStore *encryption.StateStore, matrixClient *mautrix.Client) (Messenger, error)
Click to show internal directories.
Click to hide internal directories.