Created
August 10, 2021 13:12
-
-
Save percybolmer/ba2c4d9e2a5745d7b83b725e0b88d721 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// handleEventMessage will take an event and handle it properly based on the type of event | |
func handleEventMessage(event slackevents.EventsAPIEvent) error { | |
switch event.Type { | |
// First we check if this is an CallbackEvent | |
case slackevents.CallbackEvent: | |
innerEvent := event.InnerEvent | |
// Yet Another Type switch on the actual Data to see if its an AppMentionEvent | |
switch ev := innerEvent.Data.(type) { | |
case *slackevents.AppMentionEvent: | |
// The application has been mentioned since this Event is a Mention event | |
log.Println(ev) | |
} | |
default: | |
return errors.New("unsupported event type") | |
} | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment