feat: 优化表情包插件和 TTS 插件的异步调用,简化错误处理逻辑

This commit is contained in:
DrSmoothl
2026-03-13 16:31:59 +08:00
parent 26ba33ff74
commit 262efa2302
7 changed files with 192 additions and 41 deletions

View File

@@ -84,10 +84,7 @@ class HelloWorldPlugin(MaiBotPlugin):
@Command("random_emojis", description="发送多张随机表情包", pattern=r"^/random_emojis$")
async def handle_random_emojis(self, stream_id: str = "", **kwargs):
"""发送多张随机表情包"""
result = await self.ctx.emoji.get_random(5)
if not result or not result.get("success"):
return False, "未找到表情包", False
emojis = result.get("emojis", [])
emojis = await self.ctx.emoji.get_random(5)
if not emojis:
return False, "未找到表情包", False
# 用转发消息发送多张图片