Skip to content

Instantly share code, notes, and snippets.

@kkdai
Created April 18, 2022 05:37
Show Gist options
  • Save kkdai/5adc799f47a4644123be5c5aac80d724 to your computer and use it in GitHub Desktop.
Save kkdai/5adc799f47a4644123be5c5aac80d724 to your computer and use it in GitHub Desktop.
func newVideoFlexMsg(video, text string) linebot.FlexContainer {
flex4 := 4
flex1 := 1
return &linebot.BubbleContainer{
Type: linebot.FlexContainerTypeBubble,
Hero: &linebot.VideoComponent{
Type: linebot.FlexComponentTypeVideo,
URL: video,
PreviewURL: "https://scdn.line-apps.com/n/channel_devcenter/img/fx/01_1_cafe.png",
AltContent: &linebot.ImageComponent{
Type: linebot.FlexComponentTypeImage,
URL: "https://scdn.line-apps.com/n/channel_devcenter/img/fx/01_1_cafe.png",
Size: linebot.FlexImageSizeTypeFull,
AspectRatio: linebot.FlexImageAspectRatioType20to13,
AspectMode: linebot.FlexImageAspectModeTypeCover,
},
Action: &linebot.URIAction{
Label: "More information",
URI: "https://github.com/kkdai/linebot-video-gcp",
},
AspectRatio: linebot.FlexVideoAspectRatioType20to13,
},
Body: &linebot.BoxComponent{
Type: linebot.FlexComponentTypeBox,
Layout: linebot.FlexBoxLayoutTypeVertical,
Spacing: linebot.FlexComponentSpacingTypeMd,
Contents: []linebot.FlexComponent{
&linebot.TextComponent{
Type: linebot.FlexComponentTypeText,
Wrap: true,
Weight: linebot.FlexTextWeightTypeBold,
Gravity: linebot.FlexComponentGravityTypeCenter,
Text: "翻譯後的文字如下",
},
&linebot.BoxComponent{
Type: linebot.FlexComponentTypeBox,
Layout: linebot.FlexBoxLayoutTypeBaseline,
Spacing: linebot.FlexComponentSpacingTypeSm,
Contents: []linebot.FlexComponent{
&linebot.TextComponent{
Type: linebot.FlexComponentTypeText,
Wrap: true,
Size: linebot.FlexTextSizeTypeSm,
Color: "#AAAAAA",
Text: "內容",
Flex: &flex1,
},
&linebot.TextComponent{
Type: linebot.FlexComponentTypeText,
Wrap: true,
Size: linebot.FlexTextSizeTypeSm,
Color: "#666666",
Text: text,
Flex: &flex4,
}},
},
},
},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment