Skip to content

Instantly share code, notes, and snippets.

@kkdai
Created March 21, 2020 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkdai/4bc54cfe0557adc35ce21008c2e224ee to your computer and use it in GitHub Desktop.
Save kkdai/4bc54cfe0557adc35ce21008c2e224ee to your computer and use it in GitHub Desktop.
//If user already select the sender feedback, prepare user nick name and icon here.
switch {
case strings.EqualFold(message.Text, "Brown"):
sendr = linebot.NewSender("Brown", BrownImage)
case strings.EqualFold(message.Text, "Cony"):
sendr = linebot.NewSender("Cony", ConyImage)
case strings.EqualFold(message.Text, "Sally"):
sendr = linebot.NewSender("Sally", SallyImage)
default:
//User input other than our provide range, notify user by quick reply.
if _, err = bot.ReplyMessage(event.ReplyToken, linebot.NewTextMessage("Please select following LINE Friends to reply you: Brown, Cony and Sally.")).Do(); err != nil {
log.Print(err)
}
}
if sendr != nil {
//Send message with switched sender.
if _, err = bot.ReplyMessage(event.ReplyToken, linebot.NewTextMessage("Hi, this is "+message.Text+", Nice to meet you.").WithSender(sendr)).Do(); err != nil {
log.Print(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment