MCPcopy Create free account
hub / github.com/doraemonext/wechat-python-sdk / VoiceReply

Class VoiceReply

wechat_sdk/reply.py:77–101  ·  view source on GitHub ↗

回复语音消息

Source from the content-addressed store, hash-verified

75
76
77class VoiceReply(WechatReply):
78 """
79 回复语音消息
80 """
81 TEMPLATE = u"""
82 <xml>
83 <ToUserName><![CDATA[{target}]]></ToUserName>
84 <FromUserName><![CDATA[{source}]]></FromUserName>
85 <CreateTime>{time}</CreateTime>
86 <MsgType><![CDATA[voice]]></MsgType>
87 <Voice>
88 <MediaId><![CDATA[{media_id}]]></MediaId>
89 </Voice>
90 </xml>
91 """
92
93 def __init__(self, message, media_id):
94 """
95 :param message: WechatMessage 对象
96 :param media_id: 语音的 MediaID
97 """
98 super(VoiceReply, self).__init__(message=message, media_id=media_id)
99
100 def render(self):
101 return VoiceReply.TEMPLATE.format(**self._args)
102
103
104class VideoReply(WechatReply):

Callers 1

response_voiceMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected