matrix

package
v0.0.0-...-d23200b Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: 0BSD Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	// contains filtered or unexported fields
}

func NewBot

func NewBot(ctx context.Context, conf config.Matrix, logger *slog.Logger) (*Bot, error)

func (*Bot) BecomeOnline

func (b *Bot) BecomeOnline(ctx context.Context)

func (*Bot) BecomeUnavailable

func (b *Bot) BecomeUnavailable(ctx context.Context)

func (*Bot) Subscribe

func (b *Bot) Subscribe(ctx context.Context, queue chan<- printjob.Job)

type ImageMessage

type ImageMessage struct {
	// contains filtered or unexported fields
}

func (*ImageMessage) Caption

func (im *ImageMessage) Caption() (string, bool)

func (*ImageMessage) DownloadImage

func (im *ImageMessage) DownloadImage(ctx context.Context) (image.Image, error)

func (*ImageMessage) FileName

func (im *ImageMessage) FileName() string

func (*ImageMessage) ID

func (m *ImageMessage) ID() id.EventID

func (*ImageMessage) React

func (m *ImageMessage) React(ctx context.Context, reaction string) error

func (*ImageMessage) Reply

func (m *ImageMessage) Reply(ctx context.Context, reply string) error

func (*ImageMessage) Room

func (m *ImageMessage) Room() Room

func (*ImageMessage) SendReceipt

func (m *ImageMessage) SendReceipt(ctx context.Context) error

func (*ImageMessage) Sender

func (m *ImageMessage) Sender() id.UserID

func (*ImageMessage) Time

func (m *ImageMessage) Time() time.Time

type Invite

type Invite struct {
	Sender id.UserID
	RoomID id.RoomID
	// contains filtered or unexported fields
}

func (*Invite) Accept

func (i *Invite) Accept(ctx context.Context) error

func (*Invite) Decline

func (i *Invite) Decline(ctx context.Context) error

type InviteHandler

type InviteHandler func(ctx context.Context, i Invite)

type Matrix

type Matrix struct {
	Client *mautrix.Client
	// contains filtered or unexported fields
}

func NewMatrix

func NewMatrix(ctx context.Context, conf config.Matrix) (*Matrix, error)

func (*Matrix) JoinedRooms

func (m *Matrix) JoinedRooms(ctx context.Context) ([]Room, error)

func (*Matrix) OnInvite

func (m *Matrix) OnInvite(handler InviteHandler)

func (*Matrix) OnMessage

func (m *Matrix) OnMessage(handler MessageHandler)

func (*Matrix) ResolveAlias

func (m *Matrix) ResolveAlias(ctx context.Context, alias id.RoomAlias) (Room, error)

func (*Matrix) Room

func (m *Matrix) Room(id id.RoomID) Room

func (*Matrix) SetPresence

func (m *Matrix) SetPresence(ctx context.Context, status event.Presence)

type Message

type Message interface {
	ID() id.EventID
	Time() time.Time
	Sender() id.UserID
	Room() Room
	SendReceipt(ctx context.Context) error
	Reply(ctx context.Context, reply string) error
	React(ctx context.Context, reaction string) error
}

type MessageHandler

type MessageHandler func(ctx context.Context, m Message)

type Room

type Room struct {
	ID id.RoomID
	// contains filtered or unexported fields
}

func (Room) EnableEncryption

func (r Room) EnableEncryption(ctx context.Context) error

func (Room) GetAccountData

func (r Room) GetAccountData(ctx context.Context, name string, output any) error

func (Room) IsEncrypted

func (r Room) IsEncrypted(ctx context.Context) (bool, error)

func (Room) Send

func (r Room) Send(ctx context.Context, msg string) error

func (Room) SendEmote

func (r Room) SendEmote(ctx context.Context, msg string) error

func (Room) SetAccountData

func (r Room) SetAccountData(ctx context.Context, name string, data any) error

func (Room) StartTyping

func (r Room) StartTyping(ctx context.Context, timeout time.Duration) error

func (Room) StopTyping

func (r Room) StopTyping(ctx context.Context) error

type SlogHandler

type SlogHandler struct {
	slog.Handler
	// contains filtered or unexported fields
}

func NewSlogHandler

func NewSlogHandler(opts *slog.HandlerOptions) *SlogHandler

func (*SlogHandler) Attach

func (sh *SlogHandler) Attach(bot *Bot)

type TextMessage

type TextMessage struct {
	// contains filtered or unexported fields
}

func (*TextMessage) Body

func (tm *TextMessage) Body() string

func (*TextMessage) ID

func (m *TextMessage) ID() id.EventID

func (*TextMessage) React

func (m *TextMessage) React(ctx context.Context, reaction string) error

func (*TextMessage) Reply

func (m *TextMessage) Reply(ctx context.Context, reply string) error

func (*TextMessage) Room

func (m *TextMessage) Room() Room

func (*TextMessage) SendReceipt

func (m *TextMessage) SendReceipt(ctx context.Context) error

func (*TextMessage) Sender

func (m *TextMessage) Sender() id.UserID

func (*TextMessage) Time

func (m *TextMessage) Time() time.Time

Jump to

Keyboard shortcuts

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