Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active August 11, 2021 06:21
Show Gist options
  • Save percybolmer/be659f4614ed2aa1a85a72f73091af95 to your computer and use it in GitHub Desktop.
Save percybolmer/be659f4614ed2aa1a85a72f73091af95 to your computer and use it in GitHub Desktop.
// Handle Slash Commands
case socketmode.EventTypeSlashCommand:
// Just like before, type cast to the correct event type, this time a SlashEvent
command, ok := event.Data.(slack.SlashCommand)
if !ok {
log.Printf("Could not type cast the message to a SlashCommand: %v\n", command)
continue
}
// handleSlashCommand will take care of the command
payload, err := handleSlashCommand(command, client)
if err != nil {
log.Fatal(err)
}
// Dont forget to acknowledge the request and send the payload
// The payload is the response
socketClient.Ack(*event.Request, payload)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment