Skip to content

Commit

Permalink
✨ feat: PartialReaction クラスを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Dec 8, 2022
1 parent e36fad8 commit b3ba837
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mipac/models/lite/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .emoji import *
from .instance import *
from .user import *
21 changes: 21 additions & 0 deletions mipac/models/reaction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from __future__ import annotations

from mipac.models.lite.emoji import PartialCustomEmoji
from mipac.types.note import INoteUpdated, INoteUpdatedReaction


class PartialReaction:
def __init__(self, reaction: INoteUpdated[INoteUpdatedReaction]) -> None:
self.__reaction = reaction

@property
def reaction(self) -> str:
return self.__reaction['body']['body']['reaction']

@property
def emoji(self) -> PartialCustomEmoji:
return PartialCustomEmoji(self.__reaction['body']['body']['emoji'])

@property
def user_id(self) -> str:
return self.__reaction['body']['user_id']

0 comments on commit b3ba837

Please sign in to comment.