Skip to content

Commit

Permalink
Beta322 (#325)
Browse files Browse the repository at this point in the history
* beta318

* beta319

* beta320

* beata321

* beta322
  • Loading branch information
Hoshinonyaruko authored Feb 14, 2024
1 parent 74b93f8 commit c97bfe2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
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

0 comments on commit c97bfe2

Please sign in to comment.