slack

package
v0.0.0-...-178acda Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2017 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "0.0.1"

Version is the current version of the Slack Bot.

Variables

ActiveCommands the commands that are enabled and ready to being used.

View Source
var GopherDatabaseTutorialCommand = Command{
	Name:        "database tutorial",
	Description: "tutorial about using sql databases",
	Handler: func(bot *Slack, c hanu.ConversationInterface) {
		c.Reply(gopherDatabaseTutorialReply)
	},
}

GopherDatabaseTutorialCommand shows tuts about sql databases.

View Source
var GopherLibraryForCommand = Command{
	Name:        "library for <name>",
	Description: "learn how to structure your Go package",
	Handler: func(bot *Slack, c hanu.ConversationInterface) {
		name, err := c.String("name")
		if err != nil {
			c.Reply("miss <name> ?")
			return
		}
		c.Reply(gopherLibraryForDynamicReply(name))
	},
}

GopherLibraryForCommand search a go package that matches <name>.

View Source
var GopherNewbieResourcesCommand = Command{
	Name:        "newbie resources",
	Description: "get a list of newbie resources",
	Handler: func(bot *Slack, c hanu.ConversationInterface) {
		c.Reply(gopherNewbieResourcesReply)
	},
}

GopherNewbieResourcesCommand shows the newbie resources.

View Source
var GopherPackageLayoutCommand = Command{
	Name:        "package layout",
	Description: "learn how to structure your Go package",
	Handler: func(bot *Slack, c hanu.ConversationInterface) {
		c.Reply(gopherDatabaseTutorialReply)
	},
}

GopherPackageLayoutCommand shows how to structure your Go package.

View Source
var GopherRecommendedChannelsCommand = Command{
	Name:        "recommended channels",
	Description: "get a list of recommended channels",
	Handler: func(bot *Slack, c hanu.ConversationInterface) {
		c.Reply(gopherRecommendedChannelsReply)
	},
}

GopherRecommendedChannelsCommand shows the recommended channels.

View Source
var VersionBotCommand = Command{
	Name:        "version bot",
	Description: "outputs the bot's current version",
	Handler: func(bot *Slack, c hanu.ConversationInterface) {
		c.Reply("bot's current version is: " + Version)
	},
}

VersionBotCommand "version bot" shows the bot's current version.

View Source
var VersionCommand = Command{
	Name:        "version",
	Description: "outputs the ion's current version",
	Handler: func(bot *Slack, c hanu.ConversationInterface) {
		c.Reply("ion's current version is: " + ion.Version)
	},
}

VersionCommand "version" shows the ion's current version.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name        string // hello
	Description string
	Args        string // <word>
	Handler     Handler
}

A Command describes a bot's command.

It's "Name" and "Handler" are required.

type Handler

type Handler func(bot *Slack, c hanu.ConversationInterface)

Handler is the handler signature for a Command.

type Slack

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

A Slack describes our slack integration bot service.

func New

func New() *Slack

New returns a new Slack bot.

func (*Slack) Listen

func (s *Slack) Listen(token string) error

Listen for message on underline socket.

func (*Slack) Name

func (s *Slack) Name() string

Name returns the slack bot's name.

func (*Slack) RegisterCommand

func (s *Slack) RegisterCommand(cmd Command)

RegisterCommand registers a Command to the underline bot service.

Should be called before `Listen`.

func (*Slack) Shutdown

func (s *Slack) Shutdown()

Shutdown does nothing here.

Jump to

Keyboard shortcuts

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