Skip to content

Commit

Permalink
feat: fetch_reactionsを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Nov 25, 2023
1 parent 835efe3 commit 8bdf3be
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mipac/actions/note.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,18 @@ async def get_reactions(
return await self._client.note.reaction.action.get_reactions(
reaction=reaction, note_id=note_id, limit=limit, since_id=since_id, until_id=until_id
)

async def fetch_reactions(
self,
note_id: str | None = None,
reaction: str | None = None,
*,
limit: int = 10,
since_id: str | None = None,
until_id: str | None = None,
) -> list[NoteReaction]:
return await self._client.note.reaction.action.fetch_reactions(
note_id=note_id, reaction=reaction, limit=limit, since_id=since_id, until_id=until_id
)

async def reply(
Expand Down
14 changes: 14 additions & 0 deletions mipac/actions/reaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,20 @@ async def get_reactions(
)
return [NoteReaction(i, client=self.__client) for i in res]

@cache(group="get_note_reaction", override=True)
async def fetch_reactions(
self,
reaction: str | None = None,
note_id: str | None = None,
*,
limit: int = 10,
since_id: str | None = None,
until_id: str | None = None,
) -> list[NoteReaction]:
return await self.get_reactions(
reaction, note_id, limit=limit, since_id=since_id, until_id=until_id
)

async def get_emoji_list(self) -> list[CustomEmoji]:
data: IPartialMeta = await self.__session.request(
Route("GET", "/api/meta"),
Expand Down

0 comments on commit 8bdf3be

Please sign in to comment.