-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
56 lines (44 loc) · 875 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
53
54
55
56
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
"github.com/gender-equality-community/types"
_ "github.com/mattn/go-sqlite3"
"go.mau.fi/whatsmeow/store/sqlstore"
waLog "go.mau.fi/whatsmeow/util/log"
)
var (
LogLevel = "DEBUG"
dbLog = waLog.Stdout("Database", LogLevel, true)
mChan = make(chan types.Message)
boottime time.Time
)
func init() {
boottime = time.Now()
}
func main() {
container, err := sqlstore.New("sqlite3",
fmt.Sprintf("file:.%s?_foreign_keys=on", db),
dbLog,
)
if err != nil {
panic(err)
}
r, err := NewRedis(redisAddr, "gec-responses", "gec")
if err != nil {
panic(err)
}
client, err := New(container, r)
if err != nil {
panic(err)
}
go r.Process(mChan)
go client.ResponseQueue(mChan)
c := make(chan os.Signal)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
<-c
client.disconnect()
}