Documentation ¶
Index ¶
- Variables
- func CleanExpiredCQMessages()
- func EscapeCQCodeText(str string) string
- func EscapeCQText(str string) string
- func ExtractCQMessages(message string) (string, []string, error)
- func RestoreCQMessages(cleanedMessage string, placeholders []string) string
- func UnescapeCQCodeText(str string) string
- func UnescapeCQText(str string) string
- type CQCoder
- type Message
- type MessageID
- type MessageSegment
- func At(qq int64) MessageSegment
- func AtAll() MessageSegment
- func CustomMusic(url, audio, title string) MessageSegment
- func CustomNode(nickname string, userID int64, content interface{}) MessageSegment
- func Face(id int) MessageSegment
- func File(file, name string) MessageSegment
- func Forward(id string) MessageSegment
- func Gift(userID string, giftID string) MessageSegmentdeprecated
- func Image(file string, summary ...interface{}) MessageSegment
- func ImageBytes(data []byte) MessageSegment
- func JSON(data string) MessageSegment
- func Music(mType string, id int64) MessageSegment
- func Node(id int64) MessageSegment
- func Poke(userID int64) MessageSegment
- func Record(file string) MessageSegment
- func Reply(id interface{}) MessageSegment
- func TTS(text string) MessageSegment
- func Text(text ...interface{}) MessageSegment
- func Video(file string) MessageSegment
- func XML(data string) MessageSegment
Constants ¶
This section is empty.
Variables ¶
var Emoji = map[int]rune{
0: 128558,
1: 128556,
2: 128525,
4: 128526,
5: 128557,
6: 129402,
7: 129296,
8: 128554,
9: 128557,
10: 128517,
11: 128545,
12: 128539,
13: 128513,
14: 128578,
15: 128577,
16: 128526,
19: 129326,
20: 129325,
21: 128522,
23: 128533,
24: 128523,
25: 129393,
26: 128561,
27: 128531,
28: 128516,
29: 128524,
30: 128170,
31: 129324,
32: 129300,
33: 129323,
34: 128565,
35: 128547,
37: 128128,
38: 128296,
39: 128075,
41: 129398,
42: 128147,
46: 128055,
49: 129303,
53: 127874,
59: 128169,
60: 9749,
63: 127801,
66: 10084,
67: 128148,
69: 127873,
74: 127774,
75: 127772,
76: 128077,
78: 129309,
79: 9996,
85: 128536,
89: 127817,
96: 128517,
99: 128079,
104: 129393,
106: 129401,
109: 128535,
110: 128562,
111: 129402,
116: 128536,
120: 128074,
122: 128536,
123: 10060,
124: 128076,
129: 128587,
144: 128079,
147: 127853,
171: 127861,
172: 128539,
173: 128557,
174: 128558,
175: 128539,
182: 128514,
187: 128123,
201: 128077,
214: 128536,
222: 129303,
227: 128079,
247: 128567,
264: 129318,
272: 128579,
320: 129395,
325: 128561,
}
Functions ¶
func CleanExpiredCQMessages ¶ added in v1.2.1
func CleanExpiredCQMessages()
CleanExpiredCQMessages 定期清理过期的 CQ 消息
func EscapeCQCodeText ¶
EscapeCQCodeText escapes special characters in a cqcode value.
https://github.com/botuniverse/onebot-11/tree/master/message/string.md#%E8%BD%AC%E4%B9%89
cq码字符转换
func ExtractCQMessages ¶ added in v1.2.1
ExtractCQMessages 替换CQ消息为占位符,方便进行其他操作
func RestoreCQMessages ¶ added in v1.2.1
RestoreCQMessages 通过占位符还原CQ消息
func UnescapeCQCodeText ¶
UnescapeCQCodeText unescapes special characters in a cqcode value. https://github.com/botuniverse/onebot-11/tree/master/message/string.md#%E8%BD%AC%E4%B9%89
cq码反解析
func UnescapeCQText ¶
UnescapeCQText unescapes special characters in a non-media plain message.
CQ码反解析
Types ¶
type Message ¶
type Message []MessageSegment
Message impl the array form of message https://github.com/botuniverse/onebot-11/tree/master/message/array.md#%E6%95%B0%E7%BB%84%E6%A0%BC%E5%BC%8F
func ParseMessage ¶
ParseMessage parses msg, which might have 2 types, string or array, depending on the configuration of cqhttp, to a Message. msg is the value of key "message" of the data unmarshalled from the API response JSON.
func ParseMessageFromArray ¶
ParseMessageFromArray parses msg as type array to a Message. msg is the value of key "message" of the data unmarshalled from the API response JSON. ParseMessageFromArray cq字符串转化为json对象
func ParseMessageFromString ¶
ParseMessageFromString parses msg as type string to a sort of MessageSegment. msg is the value of key "message" of the data unmarshalled from the API response JSON.
CQ字符串转为消息
func ReplyWithMessage ¶
func ReplyWithMessage(messageID interface{}, m ...MessageSegment) Message
ReplyWithMessage returns a reply message
func (Message) ExtractPlainText ¶
ExtractPlainText 提取消息中的纯文本
type MessageID ¶
type MessageID struct {
// contains filtered or unexported fields
}
MessageID 对于 qq 消息, i 与 s 相同 对于 guild 消息, i 为 s 的 ISO crc64
func NewMessageIDFromInteger ¶
func NewMessageIDFromString ¶
func (MessageID) MarshalJSON ¶
type MessageSegment ¶
MessageSegment impl the single message MessageSegment 消息数组 https://github.com/botuniverse/onebot-11/tree/master/message/array.md#%E6%95%B0%E7%BB%84%E6%A0%BC%E5%BC%8F
func At ¶
func At(qq int64) MessageSegment
At @某人 https://github.com/botuniverse/onebot-11/tree/master/message/segment.md#%E6%9F%90%E4%BA%BA
func AtAll ¶
func AtAll() MessageSegment
AtAll @全体成员 https://github.com/botuniverse/onebot-11/tree/master/message/segment.md#%E6%9F%90%E4%BA%BA
func CustomMusic ¶
func CustomMusic(url, audio, title string) MessageSegment
CustomMusic 音乐自定义分享 https://github.com/botuniverse/onebot-11/tree/master/message/segment.md#%E9%9F%B3%E4%B9%90%E8%87%AA%E5%AE%9A%E4%B9%89%E5%88%86%E4%BA%AB-
func CustomNode ¶
func CustomNode(nickname string, userID int64, content interface{}) MessageSegment
CustomNode 自定义合并转发节点 https://github.com/botuniverse/onebot-11/tree/master/message/segment.md#%E5%90%88%E5%B9%B6%E8%BD%AC%E5%8F%91%E8%87%AA%E5%AE%9A%E4%B9%89%E8%8A%82%E7%82%B9
func Face ¶
func Face(id int) MessageSegment
Face QQ表情 https://github.com/botuniverse/onebot-11/tree/master/message/segment.md#qq-%E8%A1%A8%E6%83%85
func File ¶
func File(file, name string) MessageSegment
File 文件 https://llonebot.github.io/zh-CN/develop/extends_api
func Forward ¶
func Forward(id string) MessageSegment
Forward 合并转发 https://github.com/botuniverse/onebot-11/tree/master/message/segment.md#%E5%90%88%E5%B9%B6%E8%BD%AC%E5%8F%91-
func Gift
deprecated
func Gift(userID string, giftID string) MessageSegment
Gift 群礼物 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E7%A4%BC%E7%89%A9
Deprecated: 群礼物改版
func Image ¶
func Image(file string, summary ...interface{}) MessageSegment
Image 普通图片
https://github.com/botuniverse/onebot-11/tree/master/message/segment.md#%E5%9B%BE%E7%89%87
https://llonebot.github.io/zh-CN/develop/extends_api
summary: LLOneBot的扩展字段:图片预览文字
func ImageBytes ¶
func ImageBytes(data []byte) MessageSegment
ImageBytes 普通图片 https://github.com/botuniverse/onebot-11/tree/master/message/segment.md#%E5%9B%BE%E7%89%87
func JSON ¶
func JSON(data string) MessageSegment
JSON 消息 https://github.com/botuniverse/onebot-11/tree/master/message/segment.md#xml-%E6%B6%88%E6%81%AF
func Music ¶
func Music(mType string, id int64) MessageSegment
func Node ¶
func Node(id int64) MessageSegment
func Poke ¶
func Poke(userID int64) MessageSegment
Poke 戳一戳 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E6%88%B3%E4%B8%80%E6%88%B3
func Record ¶
func Record(file string) MessageSegment
Record 语音 https://github.com/botuniverse/onebot-11/tree/master/message/segment.md#%E8%AF%AD%E9%9F%B3
func Reply ¶
func Reply(id interface{}) MessageSegment
Reply 回复 https://github.com/botuniverse/onebot-11/tree/master/message/segment.md#%E5%9B%9E%E5%A4%8D
func TTS ¶
func TTS(text string) MessageSegment
func Text ¶
func Text(text ...interface{}) MessageSegment
Text 纯文本 https://github.com/botuniverse/onebot-11/tree/master/message/segment.md#%E7%BA%AF%E6%96%87%E6%9C%AC
func Video ¶
func Video(file string) MessageSegment
Video 短视频 https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E7%9F%AD%E8%A7%86%E9%A2%91
func XML ¶
func XML(data string) MessageSegment
XML 消息 https://github.com/botuniverse/onebot-11/tree/master/message/segment.md#xml-%E6%B6%88%E6%81%AF
func (MessageSegment) Add ¶
func (m MessageSegment) Add(key string, val interface{}) MessageSegment
Add 为 MessageSegment 的 Data 增加一个字段
func (MessageSegment) CQCode ¶
func (m MessageSegment) CQCode() string
CQCode 将数组消息转换为CQ码 与 String 不同之处在于,对于 base64 的图片消息会将其哈希 方便 log 打印,不可用作发送
func (MessageSegment) Chain ¶
func (m MessageSegment) Chain(data map[string]string) MessageSegment
Chain 将两个 Data 合并
func (MessageSegment) String ¶
func (m MessageSegment) String() string
String impls the interface fmt.Stringer