LINEBot executes processing when it receives images, videos, and location information @Go

I played around with the LINE Bot that I made earlier to return the parrot. https://qiita.com/endo-yuki/items/1a0ddfe857674be6044b With reference to the document, we added a process to return a message when receiving images, videos, and location information. https://pkg.go.dev/github.com/line/line-bot-sdk-go/linebot#TemplateAction

Sample source code

main.go


~~~~~~~~~~~~~~ (omitted) ~~~~~~~~~~~~~~~~~~~~~~
			case *linebot.ImageMessage:
				if _, err = bot.ReplyMessage(event.ReplyToken, linebot.NewTextMessage("It's an image")).Do(); err != nil {
					log.Print(err)
				}
			case *linebot.VideoMessage:
				if _, err = bot.ReplyMessage(event.ReplyToken, linebot.NewTextMessage("It's a video")).Do(); err != nil {
					log.Print(err)
				}
			case *linebot.LocationMessage:
				if _, err = bot.ReplyMessage(event.ReplyToken, linebot.NewTextMessage("It's location information")).Do(); err != nil {
					log.Print(err)
				}

~~~~~~~~~~~~~~ (omitted) ~~~~~~~~~~~~~~~~~~~~~~

Impressions

When I was skipping posts recently, my wife accused me of being a three-day priest. In the future I would like to save the images sent to the bot to online storage.

Recommended Posts

LINEBot executes processing when it receives images, videos, and location information @Go