victor

package module
v0.0.0-...-53a7d71 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2012 License: MIT Imports: 8 Imported by: 0

README

Victor is a 37Signals Campfire bot written in Go (http://golang.org); inspired by Github's Hubot (http://github.com/github/hubot).

We run Victor within our team Campfire at Virb (http://virb.com).

Making Him Your Own

Victor is more of a framework for constructing your own Campfire bot so he doesn't do a whole lot out-of-the-box. I'll be adding more default behavior to him as time progresses, but you might want him to do something specific to your team's needs. You can use the programs located in examples/ as starting points to create your own robot executable.

Function Overview

Listening for Actions

  • Hear: Trigger an action based on some criteria heard anywhere in the channel.
  • Respond: Respond to a direct statement at the robot (e.g. "victor diff live")

Responding

  • Send: Send a bit of text to the channel.
  • Reply: Reply directly to the person that triggered the action (e.g. "Brett: Yo yo yo. Howdy?")
  • Paste: Paste text to the channel.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Brain

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

func NewBrain

func NewBrain(name string) *Brain

func (*Brain) Hear

func (self *Brain) Hear(expStr string, callback func(*TextMessage))

func (*Brain) Receive

func (self *Brain) Receive(msg *TextMessage)

func (*Brain) RememberUser

func (self *Brain) RememberUser(user *User)

func (*Brain) Respond

func (self *Brain) Respond(expStr string, callback func(*TextMessage))

func (*Brain) Shutdown

func (self *Brain) Shutdown()

func (*Brain) UserForId

func (self *Brain) UserForId(id int) *User

type Campfire

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

func NewCampfire

func NewCampfire(name string, account string, token string, rooms []int) *Campfire

func (*Campfire) Hear

func (self *Campfire) Hear(expStr string, callback func(*TextMessage))

func (*Campfire) Respond

func (self *Campfire) Respond(expStr string, callback func(*TextMessage))

func (*Campfire) Run

func (self *Campfire) Run()

type Listener

type Listener struct {
	Exp      *regexp.Regexp
	Callback func(*TextMessage)
}

func NewListener

func NewListener(exp *regexp.Regexp, callback func(*TextMessage)) *Listener

func (*Listener) Test

func (self *Listener) Test(msg *TextMessage) bool

type RobotAdapter

type RobotAdapter interface {
	Hear(string, func(*TextMessage))
	Respond(string, func(*TextMessage))
	Run()
}

type Shell

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

func NewShell

func NewShell(name string) *Shell

func (*Shell) Hear

func (self *Shell) Hear(expStr string, callback func(*TextMessage))

func (*Shell) Respond

func (self *Shell) Respond(expStr string, callback func(*TextMessage))

func (*Shell) Run

func (self *Shell) Run()

type TextMessage

type TextMessage struct {
	Id        int
	Body      string
	CreatedAt string

	Send  func(text string)
	Reply func(text string)
	Paste func(text string)
	// contains filtered or unexported fields
}

func (*TextMessage) Matches

func (self *TextMessage) Matches() []string

func (*TextMessage) RandomString

func (self *TextMessage) RandomString(strings []string) string

func (*TextMessage) SetMatches

func (self *TextMessage) SetMatches(matches []string)

type User

type User struct {
	Id   int
	Name string
}

Directories

Path Synopsis
examples
bot
utils

Jump to

Keyboard shortcuts

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