🐛 fix message segment getitem

This commit is contained in:
yanyongyu 2020-10-09 00:10:50 +08:00
parent ce758a2231
commit f164d85c5c

View File

@ -282,6 +282,9 @@ class BaseMessageSegment(abc.ABC):
def __add__(self, other): def __add__(self, other):
raise NotImplementedError raise NotImplementedError
def __getitem__(self, key):
return getattr(self, key)
@classmethod @classmethod
@abc.abstractmethod @abc.abstractmethod
def text(cls, text: str) -> "BaseMessageSegment": def text(cls, text: str) -> "BaseMessageSegment":