bot

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: GPL-3.0 Imports: 9 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
}

Bot represents matrix bot

func New

func New(lp Linkpearl) *Bot

New creates a new matrix bot

func (*Bot) Error

func (b *Bot) Error(ctx context.Context, roomID id.RoomID, message string, args ...any)

Error message to the log and matrix room

func (*Bot) Send

func (b *Bot) Send(ctx context.Context, roomID id.RoomID, message string, attributes map[string]any) id.EventID

Send message to the room

func (*Bot) SendFile

func (b *Bot) SendFile(ctx context.Context, roomID id.RoomID, file *mautrix.ReqUploadMedia, relations ...*event.RelatesTo)

SendFile for the room

func (*Bot) Start

func (b *Bot) Start()

Start performs matrix /sync

func (*Bot) Stop

func (b *Bot) Stop()

Stop the bot

type Linkpearl

type Linkpearl interface {
	Send(ctx context.Context, roomID id.RoomID, content any) (id.EventID, error)
	SendFile(ctx context.Context, roomID id.RoomID, req *mautrix.ReqUploadMedia, msgtype event.MessageType, relations ...*event.RelatesTo) error
	SendNotice(ctx context.Context, roomID id.RoomID, message string, relates ...*event.RelatesTo)
	FindEventBy(ctx context.Context, roomID id.RoomID, fieldValue map[string]string, fromToken ...string) *event.Event
	Start(ctx context.Context, optionalStatusMsg ...string) error
	GetClient() *mautrix.Client
	Stop(ctx context.Context)
}

Linkpearl interface

Jump to

Keyboard shortcuts

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