Skip to content

Instantly share code, notes, and snippets.

@markphelps
Last active October 30, 2016 16:57
Show Gist options
  • Save markphelps/246b821106359469b8aebd3f7c0d22a8 to your computer and use it in GitHub Desktop.
Save markphelps/246b821106359469b8aebd3f7c0d22a8 to your computer and use it in GitHub Desktop.
// 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