bot

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const Elapsed = "Elapsed"

Variables

This section is empty.

Functions

This section is empty.

Types

type Admin

type Admin interface {
	IsUserAdmin(mattermostUserID string) bool
}

type Bot

type Bot interface {
	Poster
	Logger
	Admin
	FlowController

	Ensure(stored *model.Bot, iconPath string) error
	WithConfig(Config) Bot
	MattermostUserID() string
	RegisterFlow(flow.Flow, flow.Store)
}

func New

func New(api plugin.API, helpers plugin.Helpers, pluginURL string) Bot

type Config added in v1.2.0

type Config struct {
	// AdminUserIDs contains a comma-separated list of user IDs that are allowed
	// to administer plugin functions, even if not Mattermost sysadmins.
	AdminUserIDs string

	// AdminLogLevel is "debug", "info", "warn", or "error".
	AdminLogLevel string

	// AdminLogVerbose: set to include full context with admin log messages.
	AdminLogVerbose bool
}

func (Config) ToStorableConfig added in v1.2.0

func (c Config) ToStorableConfig(configMap map[string]interface{}) map[string]interface{}

type FlowController

type FlowController interface {
	Start(userID string) error
	NextStep(userID string, from int, value bool) error
	Cancel(userID string) error
}

type LogContext

type LogContext map[string]interface{}

type Logger

type Logger interface {
	With(LogContext) Logger
	Timed() Logger
	Debugf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
}

type NilLogger

type NilLogger struct{}

func (*NilLogger) Debugf

func (l *NilLogger) Debugf(format string, args ...interface{})

func (*NilLogger) Errorf

func (l *NilLogger) Errorf(format string, args ...interface{})

func (*NilLogger) Infof

func (l *NilLogger) Infof(format string, args ...interface{})

func (*NilLogger) Timed

func (l *NilLogger) Timed() Logger

func (*NilLogger) Warnf

func (l *NilLogger) Warnf(format string, args ...interface{})

func (*NilLogger) With

func (l *NilLogger) With(logContext LogContext) Logger

type Poster

type Poster interface {
	// DM posts a simple Direct Message to the specified user
	DM(mattermostUserID, format string, args ...interface{}) (string, error)

	// DMWithAttachments posts a Direct Message that contains Slack attachments.
	// Often used to include post actions.
	DMWithAttachments(mattermostUserID string, attachments ...*model.SlackAttachment) (string, error)

	// Ephemeral sends an ephemeral message to a user
	Ephemeral(mattermostUserID, channelID, format string, args ...interface{})

	// DMPUpdate updates the postID with the formatted message
	DMUpdate(postID, format string, args ...interface{}) error

	// DeletePost deletes a single post
	DeletePost(postID string) error

	// DMUpdatePost substitute one post with another
	UpdatePost(post *model.Post) error
}

type TestLogger

type TestLogger struct {
	testing.TB
	// contains filtered or unexported fields
}

func (*TestLogger) Debugf

func (l *TestLogger) Debugf(format string, args ...interface{})

func (*TestLogger) Errorf

func (l *TestLogger) Errorf(format string, args ...interface{})

func (*TestLogger) Infof

func (l *TestLogger) Infof(format string, args ...interface{})

func (*TestLogger) Timed

func (l *TestLogger) Timed() Logger

func (*TestLogger) Warnf

func (l *TestLogger) Warnf(format string, args ...interface{})

func (*TestLogger) With

func (l *TestLogger) With(logContext LogContext) Logger

Directories

Path Synopsis
Package mock_bot is a generated GoMock package.
Package mock_bot is a generated GoMock package.

Jump to

Keyboard shortcuts

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