diff --git a/README.md b/README.md index 7add439..eb8e1c4 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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") diff --git a/bot.go b/bot.go index 42e0556..641f7f1 100644 --- a/bot.go +++ b/bot.go @@ -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) @@ -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") @@ -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 ( @@ -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 } @@ -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 { diff --git a/context.go b/context.go index 7bedb1a..b092b10 100644 --- a/context.go +++ b/context.go @@ -1,7 +1,7 @@ package slackbot import ( - "github.com/nlopes/slack" + "github.com/essentialkaos/slack" "golang.org/x/net/context" ) diff --git a/examples/simple/simple.go b/examples/simple/simple.go index 97c6006..f267515 100644 --- a/examples/simple/simple.go +++ b/examples/simple/simple.go @@ -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() { diff --git a/examples/wit/wit.go b/examples/wit/wit.go index 54385f7..927799e 100644 --- a/examples/wit/wit.go +++ b/examples/wit/wit.go @@ -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() { diff --git a/types.go b/types.go index 2c39062..317bc82 100644 --- a/types.go +++ b/types.go @@ -3,7 +3,7 @@ package slackbot import ( "golang.org/x/net/context" - "github.com/nlopes/slack" + "github.com/essentialkaos/slack" ) type MessageType string diff --git a/utils.go b/utils.go index 56dbe46..e35f070 100644 --- a/utils.go +++ b/utils.go @@ -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 diff --git a/utils_test.go b/utils_test.go index 58c29cf..5ff7c25 100644 --- a/utils_test.go +++ b/utils_test.go @@ -3,7 +3,7 @@ package slackbot import ( "testing" - "github.com/nlopes/slack" + "github.com/essentialkaos/slack" "github.com/stretchr/testify/assert" )