1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-05 19:43:49 +08:00
2023-02-15 21:49:05 +08:00

32 lines
666 B
Go

// Package onebot defines onebot protocol struct and some spec info.
package onebot
import "fmt"
//go:generate go run github.com/Mrs4s/go-cqhttp/cmd/api-generator -pkg onebot -path=./../../coolq/api.go,./../../coolq/api_v12.go -supported -o supported.go
// Spec OneBot Specification
type Spec struct {
Version int // must be 11 or 12
SupportedActions []string
}
// V11 OneBot V11
var V11 = &Spec{
Version: 11,
SupportedActions: supportedV11,
}
// V12 OneBot V12
var V12 = &Spec{
Version: 12,
SupportedActions: supportedV12,
}
func (s *Spec) ConvertID(id any) any {
if s.Version == 12 {
return fmt.Sprint(id)
}
return id
}