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

Class TextReply

wechat_sdk/reply.py:25–47  ·  view source on GitHub ↗

回复文字消息

Source from the content-addressed store, hash-verified

23
24
25class TextReply(WechatReply):
26 """
27 回复文字消息
28 """
29 TEMPLATE = u"""
30 <xml>
31 <ToUserName><![CDATA[{target}]]></ToUserName>
32 <FromUserName><![CDATA[{source}]]></FromUserName>
33 <CreateTime>{time}</CreateTime>
34 <MsgType><![CDATA[text]]></MsgType>
35 <Content><![CDATA[{content}]]></Content>
36 </xml>
37 """
38
39 def __init__(self, message, content):
40 """
41 :param message: WechatMessage 对象
42 :param content: 文字回复内容
43 """
44 super(TextReply, self).__init__(message=message, content=content)
45
46 def render(self):
47 return TextReply.TEMPLATE.format(**self._args)
48
49
50class ImageReply(WechatReply):

Callers 1

response_textMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected