From 98cc7c7fc8938e8190154a71b01ccd6a47e0df96 Mon Sep 17 00:00:00 2001 From: Yuxin Wu Date: Fri, 17 Jun 2016 23:20:08 -0700 Subject: [PATCH] support red envelope --- wechat/msg.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wechat/msg.py b/wechat/msg.py index 586c194..46a63b6 100644 --- a/wechat/msg.py +++ b/wechat/msg.py @@ -15,6 +15,7 @@ TYPE_VOIP = 50 TYPE_WX_VIDEO = 62 # video took by wechat TYPE_SYSTEM = 10000 TYPE_CUSTOM_EMOJI = 1048625 +TYPE_REDENVELOPE = 436207665 TYPE_LOCATION_SHARING = -1879048186 TYPE_APP_MSG = 16777265 @@ -88,6 +89,10 @@ class WeChatMsg(object): elif self.type == TYPE_EMOJI: # TODO add emoji name return self.content + elif self.type == TYPE_REDENVELOPE: + pq = PyQuery(self.content_xml_ready, parser='xml') + title = pq('sendertitle').text() + return u"[RED ENVELOPE]\n{}".format(title) else: # TODO replace smiley with text return self.content