-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
41 lines (37 loc) · 866 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"context"
"log"
"net"
"net/http"
"os"
"connectrpc.com/connect"
"github.com/izumin5210-sandbox/custom-jsx-runtimes/go/proto/tskaigikansai"
"github.com/izumin5210-sandbox/custom-jsx-runtimes/go/proto/tskaigikansai/tskaigikansaiconnect"
)
func main() {
httpClient := &http.Client{
Transport: &http.Transport{
DialContext: func(_ context.Context, _, _ string) (net.Conn, error) {
return net.Dial("unix", "./tmp/server.sock")
},
},
}
client := tskaigikansaiconnect.NewLineServiceClient(
httpClient,
"http://unix",
)
_, err := client.SendHelloMessage(
context.Background(),
connect.NewRequest(&tskaigikansai.SendHelloMessageRequest{
ToId: os.Getenv("LINE_MESSAGE_TO"),
MentionedUser: &tskaigikansai.User{
Id: os.Getenv("LINE_USER_ID"),
},
}),
)
if err != nil {
log.Println(err)
return
}
}