bot

package module
v0.0.0-...-a66a8d9 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: MIT Imports: 9 Imported by: 7

README

Modular Slack Bot

This wil be a basic slack bot that allows you to easily add modules containing responses

Documentation

see this page

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

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

func New

func New(slackBotToken string) *Bot

func (*Bot) AddModule

func (bot *Bot) AddModule(module *Module)

func (*Bot) GetChannels

func (bot *Bot) GetChannels() []slack.Channel

func (*Bot) MockMessage

func (bot *Bot) MockMessage(event *slack.MessageEvent, isBot checkFunc, isIM checkFunc, isMentioned checkFunc) *Message

func (*Bot) OpenIMChannel

func (bot *Bot) OpenIMChannel(user string) string

func (*Bot) SendMessage

func (bot *Bot) SendMessage(channel string, message string)

func (*Bot) SetDebug

func (bot *Bot) SetDebug(value bool)

func (*Bot) SetLogger

func (bot *Bot) SetLogger(logger *log.Logger)

func (*Bot) Start

func (bot *Bot) Start()

type Message

type Message struct {
	*slack.MessageEvent
	// contains filtered or unexported fields
}

func (*Message) GetChannel

func (message *Message) GetChannel() *slack.Channel

func (*Message) GetUser

func (message *Message) GetUser() *slack.User

func (*Message) IsBot

func (message *Message) IsBot() bool

func (*Message) IsIM

func (message *Message) IsIM() bool

func (*Message) IsMentioned

func (message *Message) IsMentioned() bool

func (*Message) OpenIMChannel

func (message *Message) OpenIMChannel(user string) string

func (*Message) Respond

func (message *Message) Respond(messageString string)

func (*Message) ToJson

func (message *Message) ToJson() string

type MessageMock

type MessageMock interface {
	GetUser() *slack.User
	GetChannel() *slack.Channel
	OpenIMChannel() string
}

type Module

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

func NewModule

func NewModule(name string, version string) *Module

func (*Module) AcceptBotMessages

func (module *Module) AcceptBotMessages()

func (*Module) AcceptsBotMessages

func (module *Module) AcceptsBotMessages() bool

func (*Module) AddTrigger

func (module *Module) AddTrigger(regex string, handler TriggerFunc)

func (*Module) HandleInput

func (module *Module) HandleInput(message *Message)

func (*Module) Help

func (module *Module) Help() string

func (*Module) Info

func (module *Module) Info()

func (*Module) Name

func (module *Module) Name() string

func (*Module) SetBot

func (module *Module) SetBot(bot *Bot)

func (*Module) SetVersion

func (module *Module) SetVersion(version string)

func (*Module) Status

func (module *Module) Status() bool

func (*Module) Version

func (module *Module) Version() string

type Trigger

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

type TriggerFunc

type TriggerFunc func(message *Message)

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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