Documentation
¶
Index ¶
- Constants
- func EventContains[T comparable](evt *event.Event, field string, value T) bool
- func EventField[T comparable](content *event.Content, field string) T
- type Bot
- func (b *Bot) CanceledHook(r *models.Run) (bool, string)
- func (b *Bot) Error(roomID id.RoomID, message string, args ...interface{})
- func (b *Bot) FindThreadBy(ctx context.Context, roomID id.RoomID, field, value string, ...) *event.Event
- func (b *Bot) InstalledHook(r *models.Run) (bool, string)
- func (b *Bot) Notice(roomID id.RoomID, threadID id.EventID, message string, args ...interface{})
- func (b *Bot) SendAlert(admin, message string)
- func (b *Bot) SendPM(userID id.UserID, content event.MessageEventContent) id.RoomID
- func (b *Bot) Start() error
- func (b *Bot) Stop()
- func (b *Bot) Threads(ctx context.Context, roomID id.RoomID, fromToken ...string) (*RespThreads, error)
- type RespThreads
Constants ¶
View Source
const ( MaxNotifications = 10 MaxInvites = 10 )
Variables ¶
This section is empty.
Functions ¶
func EventContains ¶
func EventContains[T comparable](evt *event.Event, field string, value T) bool
EventContains checks if raw event content contains specified field with specified values
func EventField ¶
func EventField[T comparable](content *event.Content, field string) T
EventField returns field value from raw event content
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
Bot represents matrix bot
func New ¶
func New(cfg *config.Config, repo *bolt.Repo, psd botPSD, exe botExecutor, log *zerolog.Logger) (*Bot, error)
New creates a new matrix bot
func (*Bot) CanceledHook ¶
CanceledHook is called when an order is canceled it marks the order message as canceled
func (*Bot) FindThreadBy ¶
func (b *Bot) FindThreadBy(ctx context.Context, roomID id.RoomID, field, value string, fromToken ...string) *event.Event
FindThreadBy tries to find thread message event by field and value
func (*Bot) InstalledHook ¶
InstalledHook is called when a new homeserver is successfully installed it marks the order message as completed
type RespThreads ¶
type RespThreads struct { Chunk []*event.Event `json:"chunk"` NextBatch string `json:"next_batch"` }
RespThreads is response of https://spec.matrix.org/v1.8/client-server-api/#get_matrixclientv1roomsroomidthreads
Click to show internal directories.
Click to hide internal directories.