-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
52 lines (43 loc) · 906 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
42
43
44
45
46
47
48
49
50
51
52
/*
* mastercoderk@gmail.com
*/
package main
import (
"fmt"
"os"
"path/filepath"
"time"
"chloe/botservice"
"chloe/im"
"chloe/util"
log "github.com/jeanphorn/log4go"
)
func initLog() {
exe, err := os.Executable()
if err != nil {
panic(err)
}
exPath := filepath.Dir(exe)
logPath := filepath.Join(exPath, "log")
// init log
flw := log.NewFileLogWriter(filepath.Join(logPath, "chloe.log"), true, true)
flw.SetFormat("[%D %T] [%L] (%S) %M")
flw.SetRotate(true)
flw.SetRotateDaily(true)
flw.SetRotateSize(1024 * 1024 * 5)
flw.SetRotateMaxBackup(5)
log.AddFilter("DEFAULT", log.DEBUG, flw)
}
func main() {
initLog()
log.Info("openai bot Chloe Started.")
config := util.ReadConfig()
acl := util.ReadAccessList()
service := botservice.NewTgBotService(config, acl)
service.Run()
}
func main2() {
fmt.Println("hello grpc")
im.NewRemoteChatBot("2952")
time.Sleep(time.Hour)
}