Skip to content

Commit

Permalink
Merge pull request BeepBoopHQ#5 from adampointer/essentialkaos
Browse files Browse the repository at this point in the history
Use essentialkaos
  • Loading branch information
adampointer authored Dec 15, 2017
2 parents b350918 + 4722c7b commit 5c6b26d
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## go-slackbot - Build Slackbots in Go

The go-slackbot project hopes to ease development of Slack bots by adding helpful
methods and a mux-router style interface to the github.com/nlopes/slack package.
methods and a mux-router style interface to the github.com/essentialkaos/slack package.

Incoming Slack RTM events are mapped to a handler in the following form:

Expand Down Expand Up @@ -30,7 +30,7 @@ In addition to several useful functions in the utils.go file, the slackbot.Bot s
bot.ReplyWithAttachments(evt, attachments, slackbot.WithTyping)
}

But wait, there's more! Well, until there's more, the slackbot package exposes github.com/nlopes/slack RTM and Client objects enabling a consumer to interact with the lower level package directly:
But wait, there's more! Well, until there's more, the slackbot package exposes github.com/essentialkaos/slack RTM and Client objects enabling a consumer to interact with the lower level package directly:

func HowAreYouHandler(ctx context.Context, bot *slackbot.Bot, evt *slack.MessageEvent) {
bot.RTM.NewOutgoingMessage("Hello", "#random")
Expand Down
12 changes: 9 additions & 3 deletions bot.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Package slackbot hopes to ease development of Slack bots by adding helpful
// methods and a mux-router style interface to the github.com/nlopes/slack package.
// methods and a mux-router style interface to the github.com/essentialkaos/slack package.
//
// Incoming Slack RTM events are mapped to a handler in the following form:
// bot.Hear("(?i)how are you(.*)").MessageHandler(HowAreYouHandler)
Expand All @@ -25,7 +25,7 @@
// bot.ReplyWithAttachments(evt, attachments, slackbot.WithTyping)
// }
//
// The slackbot package exposes github.com/nlopes/slack RTM and Client objects
// The slackbot package exposes github.com/essentialkaos/slack RTM and Client objects
// enabling a consumer to interact with the lower level package directly:
// func HowAreYouHandler(ctx context.Context, bot *slackbot.Bot, evt *slack.MessageEvent) {
// bot.RTM.NewOutgoingMessage("Hello", "#random")
Expand All @@ -37,11 +37,13 @@ package slackbot

import (
"fmt"
"log"
"os"
"time"

"golang.org/x/net/context"

"github.com/nlopes/slack"
"github.com/essentialkaos/slack"
)

const (
Expand All @@ -54,6 +56,9 @@ const (
// New constructs a new Bot using the slackToken to authorize against the Slack service.
func New(slackToken string) *Bot {
b := &Bot{Client: slack.New(slackToken)}
logger := log.New(os.Stdout, "slack-bot: ", log.Lshortfile|log.LstdFlags)
b.Client.SetDebug(true)
slack.SetLogger(logger)
return b
}

Expand All @@ -71,6 +76,7 @@ type Bot struct {
// Run listens for incoming slack RTM events, matching them to an appropriate handler.
func (b *Bot) Run() {
b.RTM = b.Client.NewRTM()
fmt.Printf("%v", b.RTM.GetInfo())
go b.RTM.ManageConnection()
for {
select {
Expand Down
2 changes: 1 addition & 1 deletion context.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package slackbot

import (
"github.com/nlopes/slack"
"github.com/essentialkaos/slack"
"golang.org/x/net/context"
)

Expand Down
2 changes: 1 addition & 1 deletion examples/simple/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"golang.org/x/net/context"

slackbot "github.com/adampointer/go-slackbot"
"github.com/nlopes/slack"
"github.com/essentialkaos/slack"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/wit/wit.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

slackbot "github.com/adampointer/go-slackbot"
"github.com/chris-skud/go-wit"
"github.com/nlopes/slack"
"github.com/essentialkaos/slack"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package slackbot
import (
"golang.org/x/net/context"

"github.com/nlopes/slack"
"github.com/essentialkaos/slack"
)

type MessageType string
Expand Down
2 changes: 1 addition & 1 deletion utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package slackbot
import (
"regexp"

"github.com/nlopes/slack"
"github.com/essentialkaos/slack"
)

// StripDirectMention removes a leading mention (aka direct mention) from a message string
Expand Down
2 changes: 1 addition & 1 deletion utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package slackbot
import (
"testing"

"github.com/nlopes/slack"
"github.com/essentialkaos/slack"
"github.com/stretchr/testify/assert"
)

Expand Down

0 comments on commit 5c6b26d

Please sign in to comment.