Skip to content

Commit

Permalink
feat: emojisが含まれなくなったのでoptionに移動 #MP-34
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Jan 17, 2023
1 parent e07ef93 commit 358232d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
12 changes: 11 additions & 1 deletion mipac/models/lite/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,17 @@ def avatar_blurhash(self) -> str:

@property
def emojis(self) -> list[ICustomEmojiLite]: # TODO: ちゃんとモデルにする
return self.__user['emojis']
"""
List of emoji included in nicknames, etc
Note: emojis have been abolished since misskey v13
Returns
-------
list[ICustomEmojiLite]
List of emoji included in nicknames, etc
"""

return self.__user.get('emojis', [])

@property
def instance(self) -> LiteInstance | None:
Expand Down
12 changes: 11 additions & 1 deletion mipac/models/note.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,17 @@ def replies_count(self) -> int:

@property
def emojis(self) -> list[ICustomEmojiLite]: # TODO: モデルに
return self.__note['emojis']
"""
Note text contains a list of emojis
Note: emojis have been abolished since misskey v13
Returns
-------
list[ICustomEmojiLite]
List of emojis contained in note text
"""

return self.__note.get('emojis', [])

@property
def renote(self) -> 'Note' | None:
Expand Down
2 changes: 1 addition & 1 deletion mipac/types/note.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class INoteRequired(TypedDict):
reactions: dict[str, int]
renote_count: int
replies_count: int
emojis: list[ICustomEmojiLite]


class INote(INoteRequired, total=False):
Expand All @@ -94,6 +93,7 @@ class INote(INoteRequired, total=False):
url: str
is_hidden: bool
poll: IPoll
emojis: list[ICustomEmojiLite]


class ICreatedNote(TypedDict):
Expand Down
2 changes: 1 addition & 1 deletion mipac/types/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ class IUserRequired(TypedDict):
online_status: Literal['online', 'active', 'offline', 'unknown']
avatar_url: str
avatar_blurhash: str
emojis: list[ICustomEmojiLite]


class ILiteUser(IUserRequired, total=False):
host: str
instance: IInstanceLite
emojis: list[ICustomEmojiLite]


class IUserDetailedField(TypedDict):
Expand Down

0 comments on commit 358232d

Please sign in to comment.