MCPcopy Create free account
hub / github.com/FloatTech/ZeroBot-Plugin-Playground / sendRssUpdateMsg

Function sendRssUpdateMsg

plugin/rsshub/main.go:145–164  ·  view source on GitHub ↗

sendRssUpdateMsg 发送Rss更新消息

(ctx *zero.Ctx, groupToFeedsMap map[int64][]*domain.RssClientView)

Source from the content-addressed store, hash-verified

143
144// sendRssUpdateMsg 发送Rss更新消息
145func sendRssUpdateMsg(ctx *zero.Ctx, groupToFeedsMap map[int64][]*domain.RssClientView) {
146 for groupID, views := range groupToFeedsMap {
147 logrus.Infof("RssHub插件在群 %d 触发推送检查", groupID)
148 for _, view := range views {
149 if view == nil || len(view.Contents) == 0 {
150 continue
151 }
152 msg, err := newRssDetailsMsg(ctx, view)
153 if len(msg) == 0 || err != nil {
154 ctx.SendPrivateMessage(zero.BotConfig.SuperUsers[0], message.Text(rssHubPushErrMsg, err))
155 continue
156 }
157 logrus.Infof("RssHub插件在群 %d 开始推送 %s", groupID, view.Source.Title)
158 ctx.SendGroupMessage(groupID, message.Text(fmt.Sprintf("%s\n该RssHub频道下有更新了哦~", view.Source.Title)))
159 if res := ctx.SendGroupForwardMessage(groupID, msg); !res.Exists() {
160 ctx.SendPrivateMessage(zero.BotConfig.SuperUsers[0], message.Text(rssHubPushErrMsg))
161 }
162 }
163 }
164}

Callers 1

initFunction · 0.85

Calls 1

newRssDetailsMsgFunction · 0.85

Tested by

no test coverage detected