Skip to content

Commit

Permalink
fix #search_result
Browse files Browse the repository at this point in the history
  • Loading branch information
juzeon committed Dec 8, 2023
1 parent 5f2ce85 commit 981050c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions sydney/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,14 @@ func (o *Sydney) AskStream(options AskStreamOptions) <-chan Message {
arr := gjson.Parse(messageText).Array()
for _, group := range arr {
srIndex := 1
for _, subGroup := range group.Array() {
links = append(links, fmt.Sprintf("[^%d^][%s](%s)",
srIndex, subGroup.Get("title").String(), subGroup.Get("url").String()))
srIndex++
}
group.ForEach(func(key, value gjson.Result) bool {
for _, subGroup := range value.Array() {
links = append(links, fmt.Sprintf("[^%d^][%s](%s)",
srIndex, subGroup.Get("title").String(), subGroup.Get("url").String()))
srIndex++
}
return true
})
}
out <- Message{
Type: MessageTypeSearchResult,
Expand Down

0 comments on commit 981050c

Please # to comment.