Skip to content

Commit

Permalink
feat(bot): import report
Browse files Browse the repository at this point in the history
  • Loading branch information
indes committed Jul 9, 2019
1 parent 5dd5c80 commit 00f5438
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions bot/bot.go
Expand Up @@ -625,7 +625,29 @@ func makeHandle() {
}

importReport := fmt.Sprintf("<b>导入成功:%d,导入失败:%d</b>", len(successImportList), len(failImportList))
if len(successImportList) != 0 {
successReport := "\n\n<b>以下订阅源导入成功:</b>"
for i, line := range successImportList {
if line.Text != "" {
successReport += fmt.Sprintf("\n[%d] <a href=\"%s\">%s</a>", i+1, line.XMLURL, line.Text)
} else {
successReport += fmt.Sprintf("\n[%d] %s", i+1, line.XMLURL)
}
}
importReport += successReport
}

if len(failImportList) != 0 {
failReport := "\n\n<b>以下订阅源导入失败:</b>"
for i, line := range failImportList {
if line.Text != "" {
failReport += fmt.Sprintf("\n[%d] <a href=\"%s\">%s</a>", i+1, line.XMLURL, line.Text)
} else {
failReport += fmt.Sprintf("\n[%d] %s", i+1, line.XMLURL)
}
}
importReport += failReport
}
_, err = B.Edit(message, importReport, &tb.SendOptions{
DisableWebPagePreview: true,
ParseMode: tb.ModeHTML,
Expand Down

0 comments on commit 00f5438

Please sign in to comment.