1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-04 19:17:37 +08:00

feat(server): allow post without http server

This commit is contained in:
wdvxdr 2021-04-20 18:44:00 +08:00
parent a5314f0b6d
commit d36d7aa2ed
No known key found for this signature in database
GPG Key ID: 55FF1414A69CEBA6

View File

@ -51,8 +51,12 @@ func RunHTTPServerAndClients(bot *coolq.CQBot, conf *config.HTTPServer) {
var (
s = new(httpServer)
authToken = conf.AccessToken
addr = fmt.Sprintf("%s:%d", conf.Host, conf.Port)
addr string
)
if conf.Host == "" || conf.Port == 0 {
goto client
}
addr = fmt.Sprintf("%s:%d", conf.Host, conf.Port)
gin.SetMode(gin.ReleaseMode)
s.engine = gin.New()
s.bot = bot
@ -126,7 +130,7 @@ func RunHTTPServerAndClients(bot *coolq.CQBot, conf *config.HTTPServer) {
os.Exit(1)
}
}()
client:
for _, c := range conf.Post {
if c.URL != "" {
go newHTTPClient().Run(c.URL, c.Secret, conf.Filter, conf.Timeout, bot)