From e44161bf42090645fb9a1d52c2aa0cdc7aebf72f Mon Sep 17 00:00:00 2001 From: lanvent Date: Fri, 21 Apr 2023 03:28:31 +0800 Subject: [PATCH] fix: voice_reply_voice not work --- channel/wechatmp/active_reply.py | 6 +++--- channel/wechatmp/passive_reply.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/channel/wechatmp/active_reply.py b/channel/wechatmp/active_reply.py index 68d1e02..c322b4e 100644 --- a/channel/wechatmp/active_reply.py +++ b/channel/wechatmp/active_reply.py @@ -4,6 +4,7 @@ import web from channel.wechatmp.wechatmp_message import WeChatMPMessage from bridge.context import * +from bridge.reply import * from channel.wechatmp.common import * from channel.wechatmp.wechatmp_channel import WechatMPChannel from wechatpy import parse_message @@ -47,10 +48,9 @@ class Query: content, ) ) - if (msg.type == "voice" and wechatmp_msg.ctype == ContextType.TEXT): - origin_ctype = ContextType.VOICE + if msg.type == "voice" and wechatmp_msg.ctype == ContextType.TEXT and conf().get("voice_reply_voice", False): context = channel._compose_context( - wechatmp_msg.ctype, content, isgroup=False, origin_ctype=origin_ctype, msg=wechatmp_msg + wechatmp_msg.ctype, content, isgroup=False, desire_rtype=ReplyType.VOICE, msg=wechatmp_msg ) else: context = channel._compose_context( diff --git a/channel/wechatmp/passive_reply.py b/channel/wechatmp/passive_reply.py index 572f075..60e0304 100644 --- a/channel/wechatmp/passive_reply.py +++ b/channel/wechatmp/passive_reply.py @@ -5,6 +5,7 @@ import web from channel.wechatmp.wechatmp_message import WeChatMPMessage from bridge.context import * +from bridge.reply import * from channel.wechatmp.common import * from channel.wechatmp.wechatmp_channel import WechatMPChannel from common.log import logger @@ -53,10 +54,9 @@ class Query: and message_id not in channel.request_cnt # insert the godcmd ): # The first query begin - if (msg.type == "voice" and wechatmp_msg.ctype == ContextType.TEXT): - origin_ctype = ContextType.VOICE + if msg.type == "voice" and wechatmp_msg.ctype == ContextType.TEXT and conf().get("voice_reply_voice", False): context = channel._compose_context( - wechatmp_msg.ctype, content, isgroup=False, origin_ctype=origin_ctype, msg=wechatmp_msg + wechatmp_msg.ctype, content, isgroup=False, desire_rtype=ReplyType.VOICE, msg=wechatmp_msg ) else: context = channel._compose_context(