feat: 支持一次输出同一个rss 5min 内的多个消息

This commit is contained in:
lixiangwuxian 2025-08-08 18:16:05 +08:00
parent 3299e0a3bf
commit 94beb84d6d

View File

@ -60,24 +60,28 @@ func CheckNewRss() {
}
//比较最新的rss数据与订阅信息中的last_item_hash若有更新则向对应群发送消息并更新订阅信息中的last_item_hash
log.Println("localHash:", group.LastItemHash, "remoteHash:", items[0].Hash)
if items[0].Hash != group.LastItemHash {
db.Model(&group).Update("last_item_hash", items[0].Hash)
action.ActionManager.SendMsg(&model.Reply{
FromMsg: model.Message{
GroupInfo: model.GroupInfo{
GroupId: int64(group.GroupID),
IsGroupMsg: true,
},
},
ReplyMsg: []qq_message.QQMessage{
&qq_message.TextMessage{
Type: qq_message.TypeText,
Data: qq_message.TextMessageData{
Text: fmt.Sprintf("您订阅的%s发布了新的文章: %s\n%s", title, items[0].Title, items[0].Link),
db.Model(&group).Update("last_item_hash", items[0].Hash)
for _, item := range items {
if item.Hash != group.LastItemHash {
action.ActionManager.SendMsg(&model.Reply{
FromMsg: model.Message{
GroupInfo: model.GroupInfo{
GroupId: int64(group.GroupID),
IsGroupMsg: true,
},
},
},
})
ReplyMsg: []qq_message.QQMessage{
&qq_message.TextMessage{
Type: qq_message.TypeText,
Data: qq_message.TextMessageData{
Text: fmt.Sprintf("您订阅的%s发布了新的文章: %s\n%s", title, items[0].Title, items[0].Link),
},
},
},
})
} else {
break
}
}
}
}