sendRssUpdateMsg 发送Rss更新消息
(ctx *zero.Ctx, groupToFeedsMap map[int64][]*domain.RssClientView)
| 143 | |
| 144 | // sendRssUpdateMsg 发送Rss更新消息 |
| 145 | func 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 | } |
no test coverage detected