Skip to content

Commit

Permalink
feat: Add join_topic and leave_topic method
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Dec 18, 2024
1 parent 6d8832d commit 3a26e14
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions genshin/client/components/hoyolab.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,3 +453,18 @@ async def get_replies(self, *, size: int = 15) -> typing.Sequence[models.Reply]:
params=dict(size=size),
)
return [models.Reply(**i["reply"]) for i in data["list"]]

async def _request_join(self, topic_id: int, *, is_cancel: bool) -> None:
await self.request_bbs(
"community/topic/wapi/join",
data=dict(topic_id=topic_id, is_cancel=is_cancel),
method="POST",
)

async def join_topic(self, topic_id: int) -> None:
"""Join a topic."""
await self._request_join(topic_id, is_cancel=False)

async def leave_topic(self, topic_id: int) -> None:
"""Leave a topic."""
await self._request_join(topic_id, is_cancel=True)

0 comments on commit 3a26e14

Please sign in to comment.