mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-07 20:45:53 +08:00
feat: onebot 12 style mention [disabled]
This commit is contained in:
parent
250c96f2c9
commit
029d3a2c18
@ -748,8 +748,16 @@ func (bot *CQBot) ToElement(t string, d map[string]string, isGroup bool) (m inte
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return message.NewFace(int32(id)), nil
|
return message.NewFace(int32(id)), nil
|
||||||
|
case "mention":
|
||||||
|
if !base.AcceptOneBot12Message {
|
||||||
|
return nil, errors.New("unsupported onebot 12 style")
|
||||||
|
}
|
||||||
|
fallthrough
|
||||||
case "at":
|
case "at":
|
||||||
qq := d["qq"]
|
qq := d["qq"]
|
||||||
|
if base.AcceptOneBot12Message && qq == "" {
|
||||||
|
qq = d["user_id"]
|
||||||
|
}
|
||||||
if qq == "all" {
|
if qq == "all" {
|
||||||
return message.AtAll(), nil
|
return message.AtAll(), nil
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,10 @@ func nocheck(_ io.ReadSeeker) (bool, string) {
|
|||||||
return true, ""
|
return true, ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: enable in v1.1.0
|
// todo: enable all in v1.1.0
|
||||||
// onebot v12 feature
|
|
||||||
|
// onebot 12 feature
|
||||||
const (
|
const (
|
||||||
AcceptOneBotV12HTTPEndPoint = false
|
AcceptOneBot12HTTPEndPoint = false
|
||||||
|
AcceptOneBot12Message = false
|
||||||
)
|
)
|
||||||
|
@ -118,7 +118,7 @@ func (s *httpServer) ServeHTTP(writer http.ResponseWriter, request *http.Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
var response global.MSG
|
var response global.MSG
|
||||||
if base.AcceptOneBotV12HTTPEndPoint && request.URL.Path == "/" {
|
if base.AcceptOneBot12HTTPEndPoint && request.URL.Path == "/" {
|
||||||
action := strings.TrimSuffix(ctx.Get("action").Str, "_async")
|
action := strings.TrimSuffix(ctx.Get("action").Str, "_async")
|
||||||
log.Debugf("HTTPServer接收到API调用: %v", action)
|
log.Debugf("HTTPServer接收到API调用: %v", action)
|
||||||
response = s.api.callAPI(action, ctx.Get("params"))
|
response = s.api.callAPI(action, ctx.Get("params"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user