summaryrefslogtreecommitdiff
path: root/bot
diff options
context:
space:
mode:
Diffstat (limited to 'bot')
-rw-r--r--bot/bot.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/bot/bot.go b/bot/bot.go
new file mode 100644
index 0000000..d3d8a8e
--- /dev/null
+++ b/bot/bot.go
@@ -0,0 +1,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)
+ }
+}