mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
coolq: make linter happy
This commit is contained in:
parent
296668441f
commit
7dbda5cec7
@ -93,6 +93,8 @@ func replyID(r *message.ReplyElement, source message.Source) int32 {
|
||||
}
|
||||
|
||||
// toElements 将消息元素数组转为MSG数组以用于消息上报
|
||||
//
|
||||
// nolint:govet
|
||||
func toElements(e []message.IMessageElement, source message.Source, raw bool) (r []cqcode.Element) {
|
||||
type pair = cqcode.Pair // simplify code
|
||||
type pairs = []pair
|
||||
|
@ -7,16 +7,19 @@ import (
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
)
|
||||
|
||||
// Element single message
|
||||
type Element struct {
|
||||
Type string
|
||||
Data []Pair
|
||||
}
|
||||
|
||||
// Pair key value pair
|
||||
type Pair struct {
|
||||
K string
|
||||
V string
|
||||
}
|
||||
|
||||
// CQCode convert to cqcode
|
||||
func (e *Element) CQCode() string {
|
||||
if e.Type == "text" {
|
||||
return EscapeText(e.Data[0].V) // must be {"text": value}
|
||||
@ -34,6 +37,7 @@ func (e *Element) CQCode() string {
|
||||
return sb.String()
|
||||
}
|
||||
|
||||
// MarshalJSON see encoding/json.Marshaler
|
||||
func (e *Element) MarshalJSON() ([]byte, error) {
|
||||
buf := global.NewBuffer()
|
||||
defer global.PutBuffer(buf)
|
||||
|
Loading…
x
Reference in New Issue
Block a user