matrix

package
v0.0.0-...-f571ccf Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ThreadRelation uses hardcoded value of element clients, should be replaced to m.thread after the MSC3440 release,
	// ref: https://github.com/matrix-org/matrix-doc/pull/3440/files#diff-113727ce0257b4dc0ad6f1087b6402f2cfcb6ff93272757b947bf1ce444056aeR296
	ThreadRelation = "io.element.thread"

	// TypingTimeout in milliseconds, used to avoid stuck typing status
	TypingTimeout = 5_000
)

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 NewBot

func NewBot(cfg *Config) (*Bot, error)

NewBot creates a new matrix bot

func (*Bot) Start

func (b *Bot) Start() error

Start performs matrix /sync

func (*Bot) Stop

func (b *Bot) Stop()

Stop the bot

func (*Bot) WithStore

func (b *Bot) WithStore() error

WithStore adds persistent storage to the bot. Right now it uses account data store, but will be changed in future

type Config

type Config struct {
	// Homeserver url
	Homeserver string
	// Login is a localpart (honoroit - OK, @honoroit:example.com - wrong)
	Login string
	// Password for login/password auth only
	Password string
	// Token for access token auth only (not implemented yet)
	Token string
	// RoomID where threads will be created
	RoomID string
	// LogLevel for logger
	LogLevel string

	// Text messages
	Text *Text
}

Config represents matrix config

type Text

type Text struct {
	// Greetings message sent to customer on first contact
	Greetings string
	// Error message sent to customer if something goes wrong
	Error string
	// EmptyRoom message sent to backoffice/threads room when customer left his room
	EmptyRoom string
	// Done message sent to customer when request marked as done in the threads room
	Done string
}

Text messages

Jump to

Keyboard shortcuts

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