Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta322 #325

Merged
merged 6 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions handlers/message_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ func parseMessageContent(paramsMessage callapi.ParamsContent, message callapi.Ac
base64RecordPattern := regexp.MustCompile(`\[CQ:record,file=base64://(.+?)\]`)
httpUrlRecordPattern := regexp.MustCompile(`\[CQ:record,file=http://(.+?)\]`)
httpsUrlRecordPattern := regexp.MustCompile(`\[CQ:record,file=https://(.+?)\]`)
httpUrlVideoPattern := regexp.MustCompile(`\[CQ:video,file=http://(.+?)\]`)
httpsUrlVideoPattern := regexp.MustCompile(`\[CQ:video,file=https://(.+?)\]`)
mdPattern := regexp.MustCompile(`\[CQ:markdown,data=base64://(.+?)\]`)
qqMusicPattern := regexp.MustCompile(`\[CQ:music,type=qq,id=(\d+)\]`)

Expand All @@ -267,6 +269,8 @@ func parseMessageContent(paramsMessage callapi.ParamsContent, message callapi.Ac
{"url_records", httpsUrlRecordPattern},
{"markdown", mdPattern},
{"qqmusic", qqMusicPattern},
{"url_video", httpUrlVideoPattern},
{"url_videos", httpsUrlVideoPattern},
}

foundItems := make(map[string][]string)
Expand Down
20 changes: 20 additions & 0 deletions handlers/send_group_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,26 @@ func generateGroupMessage(id string, foundItems map[string][]string, messageText
MsgType: 2,
}
}
} else if videoURL, ok := foundItems["url_video"]; ok && len(videoURL) > 0 {
newvideolink := "http://" + videoURL[0]
// 发链接视频 http
return &dto.RichMediaMessage{
EventID: id,
FileType: 2, // 2代表视频
URL: newvideolink, // 新图片链接
Content: "", // 这个字段文档没有了
SrvSendMsg: false,
}
} else if videoURLs, ok := foundItems["url_videos"]; ok && len(videoURLs) > 0 {
newvideolink := "https://" + videoURLs[0]
// 发链接视频 https
return &dto.RichMediaMessage{
EventID: id,
FileType: 2, // 2代表视频
URL: newvideolink, // 新图片链接
Content: "", // 这个字段文档没有了
SrvSendMsg: false,
}
} else {
// 返回文本信息
return &dto.MessageToCreate{
Expand Down
Loading