bot

package
v2.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2015 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingFeedChannel is used when the feed channel is not configured.
	ErrMissingFeedChannel = errors.New("Missing feed channel")
)

Functions

This section is empty.

Types

type Bot

type Bot struct {
	Slacker *SlackService
	Factory *factories.GonduitFactory
	// contains filtered or unexported fields
}

Bot represents the state of the bot. It also contains functions related to the interactive portion of Phabulous.

func NewBot

func NewBot(
	slacker *SlackService,
	slackRTM *slack.RTM,
	slackInfo *slack.Info,
) *Bot

NewBot creates a new instance of a Bot.

func (*Bot) Excuse

func (b *Bot) Excuse(ev *slack.MessageEvent, err error)

Excuse comes up with an excuse of why something failed.

func (*Bot) HandleHelp

func (b *Bot) HandleHelp(ev *slack.MessageEvent, matches []string)

HandleHelp shows help.

func (*Bot) HandleLookup

func (b *Bot) HandleLookup(ev *slack.MessageEvent, matches []string)

HandleLookup looks up information about a Phabricator object.

func (*Bot) HandleSummon

func (b *Bot) HandleSummon(ev *slack.MessageEvent, matches []string)

HandleSummon shows usage tip.

func (*Bot) HandleUsage

func (b *Bot) HandleUsage(ev *slack.MessageEvent, matches []string)

HandleUsage shows usage tip.

func (*Bot) ProcessIMOpen

func (b *Bot) ProcessIMOpen(ev *slack.IMOpenEvent)

ProcessIMOpen handles IM open events.

func (*Bot) ProcessMessage

func (b *Bot) ProcessMessage(ev *slack.MessageEvent)

ProcessMessage processes incoming messages events and calls the appropriate handlers.

type SlackService

type SlackService struct {
	Config  *confer.Config            `inject:""`
	Logger  *logrus.Logger            `inject:""`
	Factory *factories.GonduitFactory `inject:""`

	Slack *slack.Client
	Bot   *Bot
}

SlackService provides access to the Slack service.

func (*SlackService) BootRTM

func (s *SlackService) BootRTM()

BootRTM handles RTM events in Slack.

func (*SlackService) FeedPost

func (s *SlackService) FeedPost(storyText string) error

FeedPost posts a message to Slack on the default bot channel.

func (*SlackService) GetFeedChannel

func (s *SlackService) GetFeedChannel() string

GetFeedChannel returns the default channel for the bot.

func (*SlackService) SimplePost

func (s *SlackService) SimplePost(
	channelName string,
	storyText string,
	icon messages.Icon,
	asUser bool,
)

SimplePost posts a simple message to Slack. Most parameters are set to defaults.

Jump to

Keyboard shortcuts

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