plugins

package
v0.0.0-...-1fdd0bd Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2018 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPlugins

func GetPlugins(request slack.Request, config config.Config) map[string]IgorPlugin

GetPlugins retrieves all the plugins that are activated. It checks the config for a whitelist and blacklist as well.

Types

type HelpPlugin

type HelpPlugin struct {
	// contains filtered or unexported fields
}

HelpPlugin provides help functions

func (HelpPlugin) Config

func (plugin HelpPlugin) Config() IgorConfig

Config returns the plugin configuration

func (HelpPlugin) Describe

func (plugin HelpPlugin) Describe(language string) map[string]string

Describe provides the triggers HelpPlugin can handle

func (HelpPlugin) Description

func (plugin HelpPlugin) Description(language string) string

Description returns a global description of the plugin

func (HelpPlugin) Message

func (plugin HelpPlugin) Message() string

Message returns a formatted version of the original message

func (HelpPlugin) Name

func (plugin HelpPlugin) Name() string

Name returns the name of the plugin

func (HelpPlugin) Work

func (plugin HelpPlugin) Work() (slack.Response, error)

Work parses the request and ensures a request comes through if any triggers are matched. Handled triggers:

  • help
  • introduce yourself
  • tell me about yourself

type IgorConfig

type IgorConfig interface {
	Languages() map[string]config.LanguagePluginDetails
	ChosenLanguage() string
}

IgorConfig is the interface for all plugin Configuration

type IgorPlugin

type IgorPlugin interface {
	Work() (slack.Response, error)
	Describe(string) map[string]string
	Name() string
	Description(string) string
	Message() string
	Config() IgorConfig
}

IgorPlugin is the interface that needs to be followed by all plugins

func Help

func Help(request slack.Request) IgorPlugin

Help instantiates the HelpPlugin

func RandomTumblr

func RandomTumblr(request slack.Request) (IgorPlugin, error)

RandomTumblr instantiates a RandomTumblrPlugin

func Remember

func Remember(request slack.Request) (IgorPlugin, error)

Remember instantiates the RememberPlugin

func Status

func Status(request slack.Request) (IgorPlugin, error)

Status instantiates the StatusPlugin

func Weather

func Weather(request slack.Request) (IgorPlugin, error)

Weather instantiates a WeatherPlugin

func Xkcd

func Xkcd(request slack.Request) (IgorPlugin, error)

Xkcd is a plugin that returns XKCD comics

type NoMatchError

type NoMatchError struct {
	Message string
}

NoMatchError is an error type to indicate a plugin didn't find a match

func CreateNoMatchError

func CreateNoMatchError(message string) *NoMatchError

CreateNoMatchError creates a new NoMatchError instance

func (*NoMatchError) Error

func (e *NoMatchError) Error() string

Error returns a string interpretation of the NoMatchError

type RandomTumblrPlugin

type RandomTumblrPlugin struct {
	// contains filtered or unexported fields
}

RandomTumblrPlugin provides random entries from Tumblr blogs

func (RandomTumblrPlugin) Config

func (plugin RandomTumblrPlugin) Config() IgorConfig

Config returns the plugin configuration

func (RandomTumblrPlugin) Describe

func (plugin RandomTumblrPlugin) Describe(language string) map[string]string

Describe provides the triggers RandomTumblrPlugin can handle

func (RandomTumblrPlugin) Description

func (plugin RandomTumblrPlugin) Description(language string) string

Description returns a global description of the plugin

func (RandomTumblrPlugin) Message

func (plugin RandomTumblrPlugin) Message() string

Message returns a formatted version of the original message

func (RandomTumblrPlugin) Name

func (plugin RandomTumblrPlugin) Name() string

Name returns the name of the plugin

func (RandomTumblrPlugin) Work

func (plugin RandomTumblrPlugin) Work() (slack.Response, error)

Work parses the request and ensures a request comes through if any triggers are matched. Handled triggers:

* tumblr * tumblr [configured tumblr name]

type RememberPlugin

type RememberPlugin struct {
	// contains filtered or unexported fields
}

RememberPlugin provides remember functions

func (RememberPlugin) Config

func (plugin RememberPlugin) Config() IgorConfig

Config returns the plugin configuration

func (RememberPlugin) Describe

func (plugin RememberPlugin) Describe(language string) map[string]string

Describe provides the triggers RememberPlugin can handle

func (RememberPlugin) Description

func (plugin RememberPlugin) Description(language string) string

Description returns a global description of the plugin

func (RememberPlugin) Message

func (plugin RememberPlugin) Message() string

Message returns a formatted version of the original message

func (RememberPlugin) Name

func (plugin RememberPlugin) Name() string

Name returns the name of the plugin

func (RememberPlugin) Work

func (plugin RememberPlugin) Work() (slack.Response, error)

Work parses the request and ensures a request comes through if any triggers are matched. Handled triggers:

  • remember
  • remember2

type StatusPlugin

type StatusPlugin struct {
	Checks     map[string]func() (slack.Attachment, error)
	MainChecks map[string]func() (slack.Attachment, error)
	// contains filtered or unexported fields
}

StatusPlugin provides status reports for various services

func (StatusPlugin) Config

func (plugin StatusPlugin) Config() IgorConfig

Config returns the plugin configuration

func (StatusPlugin) Describe

func (plugin StatusPlugin) Describe(language string) map[string]string

Describe provides the triggers StatusPlugin can handle

func (StatusPlugin) Description

func (plugin StatusPlugin) Description(language string) string

Description returns a global description of the plugin

func (StatusPlugin) Message

func (plugin StatusPlugin) Message() string

Message returns a formatted version of the original message

func (StatusPlugin) Name

func (plugin StatusPlugin) Name() string

Name returns the name of the plugin

func (StatusPlugin) Work

func (plugin StatusPlugin) Work() (slack.Response, error)

Work parses the request and ensures a request comes through if any triggers are matched. Handled triggers:

type WeatherPlugin

type WeatherPlugin struct {
	Source string
	// contains filtered or unexported fields
}

WeatherPlugin provides weather information for the city you specify

func (WeatherPlugin) Config

func (plugin WeatherPlugin) Config() IgorConfig

Config returns the plugin configuration

func (WeatherPlugin) Describe

func (plugin WeatherPlugin) Describe(language string) map[string]string

Describe provides the triggers WeatherPlugin can handle

func (WeatherPlugin) Description

func (plugin WeatherPlugin) Description(language string) string

Description returns a global description of the plugin

func (WeatherPlugin) Message

func (plugin WeatherPlugin) Message() string

Message returns the request sent

func (WeatherPlugin) Name

func (plugin WeatherPlugin) Name() string

Name returns the name of the plugin

func (WeatherPlugin) Work

func (plugin WeatherPlugin) Work() (slack.Response, error)

Work parses the request and ensures a request comes through if any triggers are matched. Handled triggers:

* weather * forecast

type XkcdPlugin

type XkcdPlugin struct {
	// contains filtered or unexported fields
}

XkcdPlugin provides access to XKCD comics

func (XkcdPlugin) Config

func (plugin XkcdPlugin) Config() IgorConfig

Config returns the plugin configuration

func (XkcdPlugin) Describe

func (plugin XkcdPlugin) Describe(language string) map[string]string

Describe provides the triggers the plugin can handle

func (XkcdPlugin) Description

func (plugin XkcdPlugin) Description(language string) string

Description returns a global description of the plugin

func (XkcdPlugin) Message

func (plugin XkcdPlugin) Message() string

Message returns the original request message

func (XkcdPlugin) Name

func (plugin XkcdPlugin) Name() string

Name returns the name of the plugin

func (XkcdPlugin) Work

func (plugin XkcdPlugin) Work() (slack.Response, error)

Work parses the request and ensures a request comes through if any triggers are matched.

Jump to

Keyboard shortcuts

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