完善插件

This commit is contained in:
李寻欢
2023-12-11 10:44:23 +08:00
parent 7e545cef95
commit a1e3af7953
11 changed files with 317 additions and 69 deletions

View File

@@ -20,6 +20,7 @@ type Message struct {
Signature string `json:"signature"`
ToUser string `json:"toUser"`
Type types.MessageType `json:"type"`
Raw string `json:"raw"`
}
// systemMsgDataXml
@@ -89,3 +90,12 @@ func (m Message) IsNewUserJoin() bool {
func (m Message) IsAt() bool {
return strings.HasSuffix(m.DisplayFullContent, "在群聊中@了你")
}
// IsPrivateText
// @description: 是否是私聊消息
// @receiver m
// @return bool
func (m Message) IsPrivateText() bool {
// 发信人不以@chatroom结尾且消息类型为文本
return !strings.HasSuffix(m.FromUser, "chatroom") && m.Type == types.MsgTypeText
}