bot

package
v0.0.0-...-721782f Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

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

	WithConfig(BotConfig) Bot
}

func GetBot

func GetBot(api plugin.API, botUserID string) Bot

GetBot creates a new bot API instance.

type BotConfig

type BotConfig 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
}

type LogContext

type LogContext map[string]interface{}

type Logger

type Logger interface {
	With(LogContext) 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) 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(userID, format string, args ...interface{}) error

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

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

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