🐛 fix message segment mapping error

This commit is contained in:
yanyongyu 2021-08-04 19:11:59 +08:00
parent e18b3d04fb
commit 3564228183

View File

@ -275,10 +275,10 @@ class MessageSegment(Mapping, abc.ABC, Generic[TM]):
return self.get_message_class()(other) + self # type: ignore return self.get_message_class()(other) + self # type: ignore
def __getitem__(self, key: str): def __getitem__(self, key: str):
return self.data[key] return getattr(self, key)
def __setitem__(self, key: str, value: Any): def __setitem__(self, key: str, value: Any):
self.data[key] = value return setattr(self, key, value)
def __iter__(self): def __iter__(self):
yield from self.data.__iter__() yield from self.data.__iter__()