添加聊天功能

This commit is contained in:
liuwei
2025-05-29 16:28:22 +08:00
parent 57aee37813
commit a01b9e444e
2 changed files with 4 additions and 4 deletions

View File

@@ -280,7 +280,7 @@ class MessageMixin(WechatAPIClientBase):
else:
self.error_handler(json_resp)
async def send_voice_message(self, wxid: str, voice: Union[str, bytes, os.PathLike], format: str = "AMR") -> \
async def send_voice_message(self, wxid: str, voice: Union[str, bytes, os.PathLike], format: str = "amr") -> \
tuple[int, int, int]:
"""发送语音消息。
@@ -300,12 +300,12 @@ class MessageMixin(WechatAPIClientBase):
"""
return await self._queue_message(self._send_voice_message, wxid, voice, format)
async def _send_voice_message(self, wxid: str, voice: Union[str, bytes, os.PathLike], format: str = "AMR") -> \
async def _send_voice_message(self, wxid: str, voice: Union[str, bytes, os.PathLike], format: str = "mar") -> \
tuple[int, int, int]:
if not self.wxid:
raise UserLoggedOut("请先登录")
elif format not in ["AMR", "WAVE", "MP3", "SILK", "SPEEX"]:
elif format not in ["amr", "wave", "mp3", "silk", "speex"]:
raise ValueError("format must be one of amr, wav, mp3")
# read voice to byte