Last active
October 30, 2016 16:57
-
-
Save markphelps/246b821106359469b8aebd3f7c0d22a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run starts the run loop for the bot to listen/respond to messages | |
func (b *Bot) Run() { | |
go b.client.ManageConnection() | |
for { | |
select { | |
case msg := <-b.client.IncomingEvents: | |
switch ev := msg.Data.(type) { | |
case *slack.ConnectedEvent: | |
// do some stuff | |
case *slack.MessageEvent: | |
// do some more stuff | |
case *slack.RTMError: | |
// uh oh | |
//... tons of other Events | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment