Skip to content

Commit

Permalink
feat: Add get_replies method
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Dec 16, 2024
1 parent 1c5fcb5 commit 8a651e1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions genshin/client/components/hoyolab.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,3 +445,11 @@ async def delete_reply(self, *, reply_id: int, post_id: int) -> None:
data=dict(reply_id=reply_id, post_id=post_id),
method="POST",
)

async def get_replies(self, *, size: int = 15) -> typing.Sequence[typing.Tuple[int, str]]:
"""Get the latest replies as a list of tuples, where the first element is the reply ID and the second is the content."""
data = await self.request_bbs(
"community/post/wapi/userReply",
params=dict(size=size),
)
return [(int(i["reply"]["reply_id"]), i["reply"]["content"]) for i in data["list"]]

0 comments on commit 8a651e1

Please sign in to comment.