From 30e5abba263c6b7a599f69b6cc93f59a320a6e6a Mon Sep 17 00:00:00 2001 From: yupix Date: Mon, 31 Oct 2022 22:31:26 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20chat=E3=83=A2=E3=83=87=E3=83=AB?= =?UTF-8?q?=E3=81=ABaction=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mipac/models/chat.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/mipac/models/chat.py b/mipac/models/chat.py index 1db686d..21cd451 100644 --- a/mipac/models/chat.py +++ b/mipac/models/chat.py @@ -8,6 +8,7 @@ from mipac.models.lite.user import LiteUser if TYPE_CHECKING: from mipac.manager.client import ClientActions from mipac.types.chat import IChatGroup, IChatMessage + from mipac.actions.chat import BaseChatAction __all__ = ['ChatGroup', 'ChatMessage'] @@ -100,5 +101,15 @@ class ChatMessage: return self.__chat['reads'] @property - def group(self) -> ChatGroup: - return ChatGroup(self.__chat['group'], client=self.__client) + def group(self) -> ChatGroup | None: + return ( + ChatGroup(self.__chat['group'], client=self.__client) + if self.__chat['group'] + else None + ) + + @property + def action(self) -> BaseChatAction: + return self.__client.chat.custom_base_chat_action( + user_id=self.user.id, message_id=self.id + )