Popularity
5.0
Growing
Activity
0.0
Stable
153
8
25

Description

The Go framework hanu is your best friend to create Slack bots! hanu uses platzhalter for easy command parsing (e.g. whisper ) and runs fine as a Heroku worker. All you need is a Slack API token and you can create your first bot within seconds! Just have a look at the hanu-example bot …

Programming language: Go
License: MIT License
Latest version: v0.1.0

hanu alternatives and similar packages

Based on the "Third-party APIs" category.
Alternatively, view hanu alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of hanu or a related project?

Add another 'Third-party APIs' Package

README

hanu - Go for Slack Bots!

Current Release MIT License Read Tutorial Code Example

The Go framework hanu is your best friend to create Slack bots! hanu uses allot for easy command and request parsing (e.g. whisper <word>) and runs fine as a Heroku worker. All you need is a Slack API token and you can create your first bot within seconds! Just have a look at the hanu-example bot or read my tutorial

Features

  • Respond to mentions
  • Respond to direct messages
  • Auto-Generated command list for help
  • Works fine as a worker on Heroku

Usage

Use the following example code or the hanu-example bot to get started.

package main

import (
    "log"
    "strings"

    "github.com/sbstjn/hanu"
)

func main() {
    slack, err := hanu.New("SLACK_BOT_API_TOKEN")

    if err != nil {
        log.Fatal(err)
    }

    Version := "0.0.1"

    slack.Command("shout <word>", func(conv hanu.ConversationInterface) {
        str, _ := conv.String("word")
        conv.Reply(strings.ToUpper(str))
    })

    slack.Command("whisper <word>", func(conv hanu.ConversationInterface) {
        str, _ := conv.String("word")
        conv.Reply(strings.ToLower(str))
    })

    slack.Command("version", func(conv hanu.ConversationInterface) {
        conv.Reply("Thanks for asking! I'm running `%s`", Version)
    })

    slack.Listen()
}

The example code above connects to Slack using SLACK_BOT_API_TOKEN as the bot's token and can respond to direct messages and mentions for the commands shout <word> , whisper <word> and version.

You don't have to care about help requests, hanu has it built in and will respond with a list of all defined commands on direct messages like this:

/msg @hanu help

Of course this works fine with mentioning you bot's username as well:

@hanu help

Slack

Use direct messages for communication:

/msg @hanu version

Or use the bot in a public channel:

@hanu version

Dependencies

Credits


*Note that all licence references and agreements mentioned in the hanu README section above are relevant to that project's source code only.