matrix

package
v1.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsurePrefix

func EnsurePrefix(prefix, input string) string

EnsurePrefix ensures that the given input string starts with the provided prefix.

Types

type APIClient

type APIClient interface {
	SendMessageEvent(ctx context.Context, roomID id.RoomID, eventType event.Type, contentJSON interface{}, extra ...mautrix.ReqSendEvent) (resp *mautrix.RespSendEvent, err error)
}

type Client

type Client struct {
	Message *Message
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, url, roomID, userID, token, username, password string) (*Client, error)

NewClient creates a new Matrix client with the given parameters and joins the specified room. It authenticates the user if the userID and token are not provided, and returns a Client struct that can be used to send messages to the room.

type Message

type Message struct {
	Opt MessageOptions
	// contains filtered or unexported fields
}

func (*Message) Send

func (m *Message) Send(ctx context.Context) error

Send sends a message to the specified room. It sanitizes the message content to remove potentially unsafe HTML.

type MessageOptions

type MessageOptions struct {
	RoomID         id.RoomID
	Message        string
	TemplateUnsafe bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL