-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
spec.go
32 lines (26 loc) · 681 Bytes
/
spec.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Package onebot defines onebot protocol struct and some spec info.
package onebot
import "fmt"
//go:generate go run ./../../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,
}
// ConvertID 根据版本转换ID
func (s *Spec) ConvertID(id any) any {
if s.Version == 12 {
return fmt.Sprint(id)
}
return id
}