Skip to content
This repository was archived by the owner on Oct 19, 2022. It is now read-only.

storz/golackbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GolackBot

GolackBot is simple slack bot like a Hubot.

Usage

Put config file

# config.tml
[bot]
token    = "xoxb-XXXXXXXXXXXXXXXXX"
id       = "@XXXXXXX"
name     = "Kan"
aka      = [ "GAMI" ]

Create main.go

// main.go
package main

import (
	"path/filepath"

	"github.com/storz/golackbot"
)

var (
	bot = golackbot.NewBot()
)

func main() {
	cfgPath, err := filepath.Abs("config.tml")
	if err != nil {
		panic(err)
	}
	bot.LoadConfig(cfgPath)
	bot.Listen()
}

Scripting

// goodcommunication.go
package main

import "github.com/nlopes/slack"

func init() {
    bot.Respond("ping", func(msg slack.Msg) { // React to mention
        // Some processes...
        // bot.Reply(msg, "pong") // Kan says "@your_name: pong"
    })

    // You can use regexp on 1st arg
    bot.Hear("^Yo$", func(msg, slack.Msg) { // React to any messages
        // Some processes...
        // bot.Say(msg, "pong")  // Kan says "Yo"
    }
}

About

ごらくぼっと

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages