feat: gateway
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/promote/production Build is passing

This commit is contained in:
vaalacat
2024-04-23 11:18:16 +00:00
parent a42fecfc63
commit 75944abbc2
13 changed files with 404 additions and 87 deletions

View File

@@ -1,18 +1,28 @@
package services
import (
"tg-mc/conf"
"tg-mc/services/gateway"
"tg-mc/services/mc"
"tg-mc/services/tgbot"
"tg-mc/services/utils"
)
func Run() {
go func() {
for {
if err := mc.Run(); err != nil {
utils.SendMsg("致命错误:" + err.Error())
}
settings := conf.GetBotSettings()
if settings.EnableGateway {
go gateway.StartGateway()
}
if settings.EnableBridge {
go mc.StartBridgeClient()
}
if settings.EnableBot {
if settings.EnableBridge {
tgbot.Run(mc.SendMsg, mc.SendCommand)
} else {
tgbot.Run(mc.SendMsg, func(s string) error { return nil })
}
}()
tgbot.Run(mc.SendMsg, mc.SendCommand)
}
}