Skip to content

Commit

Permalink
feat(bot): format rss list message
Browse files Browse the repository at this point in the history
  • Loading branch information
indes committed Jan 14, 2019
1 parent 4bc79c2 commit acb699c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bot/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ func makeHandle() {
B.Handle("/list", func(m *tb.Message) {
sources, _ := model.GetSourcesByUserID(m.Sender.ID)
log.Println(sources)
message := "目前的订阅源:\n"
for index, source := range sources {
_, _ = B.Send(m.Sender, fmt.Sprintf("%d - %s", index+1, source.Title))

message = message + fmt.Sprintf("%d - [%s](%s)\n", index+1, source.Title, source.Link)
}
_, _ = B.Send(m.Sender, message, &tb.SendOptions{
ParseMode: tb.ModeMarkdown,
})

})

B.Handle("/unsub", func(m *tb.Message) {
Expand Down

0 comments on commit acb699c

Please sign in to comment.