github.com/Mrs4s/go-cqhttp@v1.2.0/pkg/onebot/spec.go (about) 1 // Package onebot defines onebot protocol struct and some spec info. 2 package onebot 3 4 import "fmt" 5 6 //go:generate go run ./../../cmd/api-generator -pkg onebot -path=./../../coolq/api.go,./../../coolq/api_v12.go -supported -o supported.go 7 8 // Spec OneBot Specification 9 type Spec struct { 10 Version int // must be 11 or 12 11 SupportedActions []string 12 } 13 14 // V11 OneBot V11 15 var V11 = &Spec{ 16 Version: 11, 17 SupportedActions: supportedV11, 18 } 19 20 // V12 OneBot V12 21 var V12 = &Spec{ 22 Version: 12, 23 SupportedActions: supportedV12, 24 } 25 26 // ConvertID 根据版本转换ID 27 func (s *Spec) ConvertID(id any) any { 28 if s.Version == 12 { 29 return fmt.Sprint(id) 30 } 31 return id 32 }