Created
April 6, 2021 03:34
-
-
Save xNok/3f8e9f1274ab4522958daadc85ea71ae 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
func GreetingMessage(user string) []slack.Block { | |
// we need a stuct to hold template arguments | |
type args struct { | |
User string | |
} | |
tpl := renderTemplate(greetingAssets, "greetingViews/greeting.json", args{User: user}) | |
// we convert the view into a message struct | |
view := slack.Msg{} | |
str, _ := ioutil.ReadAll(&tpl) | |
json.Unmarshal(str, &view) | |
// We only return the block because of the way the PostEphemeral function works | |
// we are going to use slack.MsgOptionBlocks in the controller | |
return view.Blocks.BlockSet | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment