Skip to content

Commit

Permalink
✨ feat(biliClient): CommentReport
Browse files Browse the repository at this point in the history
  • Loading branch information
iyear committed Nov 8, 2021
1 parent 7b117ee commit cd9360e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
25 changes: 25 additions & 0 deletions bili_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1573,6 +1573,31 @@ func (b *BiliClient) CommentSetTop(oid int64, tp int, rpid int64, top bool) erro
return err
}

// CommentReport 举报评论
//
// oid,tp: 同 BiliClient.CommentSend
//
// rpid: 评论ID
//
// reason: 参考 https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/comment/action.md#%E4%B8%BE%E6%8A%A5%E8%AF%84%E8%AE%BA
//
// content: 其他举报备注 reason=0时有效 不需要时留空
func (b *BiliClient) CommentReport(oid int64, tp int, rpid int64, reason int, content string) error {
_, err := b.RawParse(
BiliApiURL,
"x/v2/reply/report",
"POST",
map[string]string{
"oid": strconv.FormatInt(oid, 10),
"type": strconv.Itoa(tp),
"rpid": strconv.FormatInt(rpid, 10),
"reason": strconv.Itoa(reason),
"content": content,
},
)
return err
}

// DanmakuGetHistoryIndex
//
// 获取历史弹幕日期,返回的日期代表有历史弹幕,用于请求历史弹幕
Expand Down
14 changes: 14 additions & 0 deletions bili_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -987,3 +987,17 @@ func TestBiliClient_CommentSetTop2(t *testing.T) {
t.FailNow()
}
}
func TestBiliClient_CommentReport(t *testing.T) {
err := testBiliClient.CommentReport(634118491, 1, 5730216001, 4, "")
if err != nil {
t.Error(err)
t.FailNow()
}
}
func TestBiliClient_CommentReport2(t *testing.T) {
err := testBiliClient.CommentReport(634118491, 1, 5730221753, 0, "test")
if err != nil {
t.Error(err)
t.FailNow()
}
}

0 comments on commit cd9360e

Please sign in to comment.