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
|
package main
import (
"log"
"os"
"github.com/neonxp/rutina"
"transport/lib"
"transport/plugins"
)
func main() {
tamtamToken := os.Getenv("TAMTAM")
telegramToken := os.Getenv("TELEGRAM")
r := rutina.New()
routes := []lib.Routing{
{TgID: -1001046507545, TTID: -69062921115159},
}
tt2tg := make(chan lib.Message, 1)
tg2tt := make(chan lib.Message, 1)
tg := plugins.NewTelegram(telegramToken, tt2tg, tg2tt, routes)
tt := plugins.NewTamTam(tamtamToken, tg2tt, tt2tg, routes)
r.Go(tg.Run, rutina.ShutdownIfDone, rutina.RestartIfFail)
r.Go(tt.Run, rutina.ShutdownIfDone, rutina.RestartIfFail)
r.ListenOsSignals()
if err := r.Wait(); err != nil {
log.Fatal(err)
}
}
|