mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
feat(server): allow post without http server
This commit is contained in:
parent
a5314f0b6d
commit
d36d7aa2ed
@ -51,8 +51,12 @@ func RunHTTPServerAndClients(bot *coolq.CQBot, conf *config.HTTPServer) {
|
|||||||
var (
|
var (
|
||||||
s = new(httpServer)
|
s = new(httpServer)
|
||||||
authToken = conf.AccessToken
|
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)
|
gin.SetMode(gin.ReleaseMode)
|
||||||
s.engine = gin.New()
|
s.engine = gin.New()
|
||||||
s.bot = bot
|
s.bot = bot
|
||||||
@ -126,7 +130,7 @@ func RunHTTPServerAndClients(bot *coolq.CQBot, conf *config.HTTPServer) {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
client:
|
||||||
for _, c := range conf.Post {
|
for _, c := range conf.Post {
|
||||||
if c.URL != "" {
|
if c.URL != "" {
|
||||||
go newHTTPClient().Run(c.URL, c.Secret, conf.Filter, conf.Timeout, bot)
|
go newHTTPClient().Run(c.URL, c.Secret, conf.Filter, conf.Timeout, bot)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user