Skip to content

Commit

Permalink
fix: 处理b站解析获取卡片失败的问题 (#1089)
Browse files Browse the repository at this point in the history
Co-authored-by: hutiance <[email protected]>
  • Loading branch information
starim00 and hutiance authored Jan 6, 2025
1 parent 41d28b7 commit fcb01c2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions plugin/bilibili/card2msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,16 +306,18 @@ func videoCard2msg(card bz.Card) (msg []message.Segment, err error) {
var mCard bz.MemberCard
msg = make([]message.Segment, 0, 16)
mCard, err = bz.GetMemberCard(card.Owner.Mid)
if err != nil {
return
}
msg = append(msg, message.Text("标题: ", card.Title, "\n"))
if card.Rights.IsCooperation == 1 {
for i := 0; i < len(card.Staff); i++ {
msg = append(msg, message.Text(card.Staff[i].Title, ": ", card.Staff[i].Name, " 粉丝: ", bz.HumanNum(card.Staff[i].Follower), "\n"))
}
} else {
msg = append(msg, message.Text("UP主: ", card.Owner.Name, " 粉丝: ", bz.HumanNum(mCard.Fans), "\n"))
if err != nil {
err = nil
msg = append(msg, message.Text("UP主: ", card.Owner.Name, "\n"))
} else {
msg = append(msg, message.Text("UP主: ", card.Owner.Name, " 粉丝: ", bz.HumanNum(mCard.Fans), "\n"))
}
}
msg = append(msg, message.Text("播放: ", bz.HumanNum(card.Stat.View), " 弹幕: ", bz.HumanNum(card.Stat.Danmaku)))
msg = append(msg, message.Image(card.Pic))
Expand Down

0 comments on commit fcb01c2

Please sign in to comment.