Skip to content

Commit

Permalink
✨ fix version 0.51.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Aug 6, 2024
1 parent c6a5c3f commit d09416c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions src/nonebot_plugin_alconna/uniseg/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,22 @@ async def export(self, source: Sequence[Segment], bot: Union[Bot, None], fallbac
for seg in source:
seg_type = seg.__class__
if seg_type in self._mapping:
res = await self._mapping[seg_type](seg, bot)
if isinstance(res, list):
message.extend(res)
else:
message.append(res)
elif res := await custom.export(self, seg, bot, fallback): # type: ignore
try:
res = await self._mapping[seg_type](seg, bot)
if isinstance(res, list):
message.extend(res)
else:
message.append(res)
continue
except (SerializeFailed, NotImplementedError):
pass
if res := await custom.export(self, seg, bot, fallback): # type: ignore
if isinstance(res, list):
message.extend(res)
else:
message.append(res)
elif isinstance(seg, Other):
continue
if isinstance(seg, Other):
message.append(seg.origin) # type: ignore
elif bot and bot.adapter.get_name() == SupportAdapter.nonebug:
message += str(seg)
Expand Down
2 changes: 1 addition & 1 deletion src/nonebot_plugin_alconna/uniseg/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ def template(cls, format_string: Union[str, "UniMessage"]) -> UniMessageTemplate
返回:
消息格式化器
"""
return UniMessageTemplate(format_string, cls)
return UniMessageTemplate(format_string, cls) # type: ignore

def __merge_text__(self) -> Self:
if not self:
Expand Down

0 comments on commit d09416c

Please sign in to comment.