Created
March 21, 2020 13:27
-
-
Save kkdai/4bc54cfe0557adc35ce21008c2e224ee 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
//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