-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmsg.go
57 lines (49 loc) · 982 Bytes
/
msg.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package pbbot
import (
"strconv"
"github.com/ProtobufBot/go-pbbot/proto_gen/onebot"
)
type Msg struct {
MessageList []*onebot.Message
}
func NewMsg() *Msg {
return &Msg{
MessageList: make([]*onebot.Message, 0),
}
}
func (msg *Msg) Text(text string) *Msg {
msg.MessageList = append(msg.MessageList, &onebot.Message{
Type: "text",
Data: map[string]string{
"text": text,
},
})
return msg
}
func (msg *Msg) Face(id int) *Msg {
msg.MessageList = append(msg.MessageList, &onebot.Message{
Type: "face",
Data: map[string]string{
"id": strconv.Itoa(id),
},
})
return msg
}
func (msg *Msg) Image(url string) *Msg {
msg.MessageList = append(msg.MessageList, &onebot.Message{
Type: "image",
Data: map[string]string{
"url": url,
},
})
return msg
}
func (msg *Msg) At(qq int64) *Msg {
msg.MessageList = append(msg.MessageList, &onebot.Message{
Type: "at",
Data: map[string]string{
"qq": strconv.FormatInt(qq, 10),
},
})
return msg
}