Ver Fonte

support red envelope

Yuxin Wu há 9 anos atrás
pai
commit
91ac3126f8
1 ficheiros alterados com 5 adições e 0 exclusões
  1. 5 0
      wechat/msg.py

+ 5 - 0
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