cats

package
v0.0.0-...-821ef61 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package cats is a plugin that queries some cat API's and returns responses. It queries a cat fact API and a cat image/gif API

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

type Plugin struct{}

Plugin ...

func (Plugin) Command

func (p Plugin) Command() []string

Command returns a list of commands the plugin provides

func (Plugin) HandleMessage

func (p Plugin) HandleMessage(in message.Basic) (out message.Basic)

HandleMessage is responsible for handling the incoming message and returning a response based on the message provides

Example
fmt.Printf("%q\n", reCats.FindStringSubmatch("!cat"))
fmt.Printf("%q\n", reCatsType.FindStringSubmatch("!cat fact")[1])
fmt.Printf("%q\n", reCatsType.FindStringSubmatch("!cat gif"))
fmt.Printf("%q\n", reCats.FindStringSubmatch("cat"))
Output:

["!cat"]
"fact"
["!cat gif" "gif"]
[]

func (Plugin) Name

func (p Plugin) Name() string

Name is the name of the plugin

func (Plugin) OnInit

func (p Plugin) OnInit() error

OnInit returns an error if the plugin could not be started

func (Plugin) Regexp

func (p Plugin) Regexp() *regexp.Regexp

Regexp returns the regexp of a message that should be handled by this plugin

func (Plugin) Usage

func (p Plugin) Usage() string

Usage prints detailed usage instructions for the plugin

Jump to

Keyboard shortcuts

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