//BroadNews send new contents message to subscriber
BroadNews send new contents message to subscriber
// BroadNews send new contents message to subscriber
func BroadNews(source *model.Source, subs []model.Subscribe, contents []model.Content) {
	log.Printf("Source Title: <%s> Subscriber: %d New Contents: %d", source.Title, len(subs), len(contents))
	var u telebot.User
	for _, content := range contents {
		for _, sub := range subs {
			u.ID = int(sub.UserID)
			message := `
*%s*
%s
[原文](%s)
%s
`
			message = fmt.Sprintf(message, source.Title, content.Title, content.RawLink, content.TelegraphUrl)
			_, err := B.Send(&u, message, &telebot.SendOptions{
				ParseMode: telebot.ModeMarkdown,
			})
			if err != nil {
				log.Println(err)
			}
		}
	}
}
func BroadNews ( source * model . Source , subs [ ] model . Subscribe , contents [ ] model . Content ) { log . Printf ( " " , source . Title , len ( subs ) , len ( contents ) ) var u telebot . User for _ , content := range contents { for _ , sub := range subs { u . ID = int ( sub . UserID ) message := `
*%s*
%s
[原文](%s)
%s
` message = fmt . Sprintf ( message , source . Title , content . Title , content . RawLink , content . TelegraphUrl ) _ , err := B . Send ( & u , message , & telebot . SendOptions { ParseMode : telebot . ModeMarkdown , } ) if err != nil { log . Println ( err ) } } } }
BroadNews send new contents message to subscriber
BroadNews send new contents message to subscriber