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
for _, event := range events { | |
if event.Type == linebot.EventTypeMessage { | |
switch message := event.Message.(type) { | |
....... | |
case *linebot.VideoMessage: | |
//Get Video binary from LINE server based on message ID. | |
content, err := bot.GetMessageContent(message.ID).Do() | |
if err != nil { | |
log.Println("Got GetMessageContent err:", err) | |
} |
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 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{ |
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
// Refer https://github.com/kkdai/linebot-video-gcp for more detail. | |
// Must use "apiv1p1beta1" version to enable support on Chinese and MP3 | |
speech "cloud.google.com/go/speech/apiv1p1beta1" //v1p1beta1 | |
speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1" //v1p1beta1 | |
func (c *ClientUploader) SpeachToText() (error, string) { | |
ctx := context.Background() |
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
var cl *storage.Client | |
func UploadFileToGCS(file io.ReadCloser, object string) error { | |
ctx := context.Background() | |
ctx, cancel := context.WithTimeout(ctx, time.Second*50) | |
defer cancel() | |
// Upload an object with storage.Writer. | |
wc := cl.Bucket(c.bucketName).Object(object).NewWriter(ctx) | |
if _, err := io.Copy(wc, file); err != nil { |
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 testGCP() err { | |
client, err := storage.NewClient(context.Background()) | |
if err != nil { | |
fmt.Fatalf("Failed to create client: %v", err) | |
return err | |
} | |
defer client.Close() | |
fmt.Println("GCP connection succeessed!") | |
return nil | |
} |
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
package main | |
import ( | |
"cloud.google.com/go/storage" | |
"context" | |
"log" | |
) | |
const ( | |
projectID = "your-project-id" // FILL IN WITH YOURS |
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
Magic = 64-bit MachO | |
Type = Exec | |
CPU = Amd64, x86_64 | |
Commands = 13 (Size: 2560) | |
Flags = None | |
000: LC_SEGMENT_64 sz=0x00000000 off=0x00000000-0x00000000 addr=0x000000000-0x001000000 ---/--- __PAGEZERO | |
001: LC_SEGMENT_64 sz=0x00718000 off=0x00000000-0x00718000 addr=0x001000000-0x001718000 r-x/rwx __TEXT | |
sz=0x003d2f6a off=0x00001000-0x003d3f6a addr=0x001001000-0x0013d3f6a __TEXT.__text PureInstructions|SomeInstructions | |
sz=0x0000029a off=0x003d3f80-0x003d421a addr=0x0013d3f80-0x0013d421a __TEXT.__symbol_stub1 PureInstructions|SomeInstructions (SymbolStubs) | |
sz=0x0016d980 off=0x003d4220-0x00541ba0 addr=0x0013d4220-0x001541ba0 __TEXT.__rodata |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"github.com/blacktop/go-macho" | |
) | |
func main() { |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"github.com/adlio/trello" | |
) | |
func main() { |
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
# .goreleaser.yml | |
builds: | |
# You can have multiple builds defined as a yaml list | |
- | |
# ID of the build. | |
# Defaults to the project name. | |
id: "my-build" | |
# Path to project's (sub)directory containing Go code. | |
# This is the working directory for the Go build command(s). |