reywechat 1.0.55__py3-none-any.whl → 1.0.56__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
reywechat/rdb.py CHANGED
@@ -318,8 +318,8 @@ class WeChatDatabase(WeChatBase):
318
318
  '50 is voice call or video call invitation message, '
319
319
  '51 is system synchronize data message, '
320
320
  '56 is real time position data message, '
321
- '1000 is system message, '
322
- '1002 is pat or recall message, '
321
+ '10000 is system message, '
322
+ '10002 is pat or recall message, '
323
323
  'other omit.'
324
324
  )
325
325
  },
reywechat/rreceive.py CHANGED
@@ -185,7 +185,8 @@ class WeChatMessage(WeChatBase):
185
185
  self._is_call_next: bool | None = None
186
186
  self._is_last_call: bool | None = None
187
187
  self._is_pat: bool | None = None
188
- self.pat_text: str | None = None
188
+ self._is_pat_me: bool | None = None
189
+ self._pat_text: str | None = None
189
190
  self._is_recall: bool | None = None
190
191
  self._is_new_user: bool | None = None
191
192
  self._is_new_room: bool | None = None
@@ -461,19 +462,16 @@ class WeChatMessage(WeChatBase):
461
462
  self._text = '[实时地图位置分享中]'
462
463
 
463
464
  ## System.
464
- case 1000:
465
+ case 10000:
465
466
  self._text = '[系统信息]'
466
467
 
467
- ## Recall.
468
- case 1002:
469
-
470
- ### Pat.
471
- if self.is_pat:
472
- self._text = f'[{self.pat_text}]'
468
+ ## Pat.
469
+ case 10002 if self.is_pat:
470
+ self._text = f'[{self.pat_text}]'
473
471
 
474
- ### Recall.
475
- elif self.is_recall:
476
- self._text = '[撤回了一条消息]'
472
+ ## Recall.
473
+ case 10002 if self.is_recall:
474
+ self._text = '[撤回了一条消息]'
477
475
 
478
476
  case _:
479
477
  self._text = '[消息]'
@@ -992,7 +990,7 @@ class WeChatMessage(WeChatBase):
992
990
  return self._is_call
993
991
 
994
992
  # Text.
995
- if self.type in (1, 3, 34, 42, 43, 47, 48, 49, 50, 56, 1002):
993
+ if self.type in (1, 3, 34, 42, 43, 47, 48, 49, 50, 56, 10002):
996
994
  text = self.text
997
995
  text = text.strip()
998
996
  else:
@@ -1027,6 +1025,9 @@ class WeChatMessage(WeChatBase):
1027
1025
  ## Private chat.
1028
1026
  or self.room is None
1029
1027
 
1028
+ ## Pat me.
1029
+ or self.is_pat_me
1030
+
1030
1031
  ## At self.
1031
1032
  or is_at_me
1032
1033
 
@@ -1152,6 +1153,30 @@ class WeChatMessage(WeChatBase):
1152
1153
  return self._is_pat
1153
1154
 
1154
1155
 
1156
+ @property
1157
+ def is_pat_me(self) -> bool:
1158
+ """
1159
+ Whether if is message of pat me.
1160
+
1161
+ Returns
1162
+ -------
1163
+ Judge result.
1164
+ """
1165
+
1166
+ # Cache.
1167
+ if self._is_pat_me is not None:
1168
+ return self._is_pat_me
1169
+
1170
+ # Judge.
1171
+ pattern = r'<template><!\[CDATA\["\$\{[\da-z_]+\}" 拍了拍我\]\]></template>'
1172
+ self._is_pat_me = (
1173
+ self.is_pat
1174
+ and search(pattern, self.data) is not None
1175
+ )
1176
+
1177
+ return self._is_pat_me
1178
+
1179
+
1155
1180
  @property
1156
1181
  def pat_text(self) -> str:
1157
1182
  """
@@ -1177,7 +1202,7 @@ class WeChatMessage(WeChatBase):
1177
1202
  text: str = search(pattern, self.data)
1178
1203
 
1179
1204
  ## User name.
1180
- pattern = r'"\$\{([a-z_\d]+)\}"'
1205
+ pattern = r'"\$\{([\da-z_]+)\}"'
1181
1206
  users_id: list[str] = findall(pattern, text)
1182
1207
  for user_id in users_id:
1183
1208
  user_name = self.receiver.wechat.client.get_contact_name(user_id)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reywechat
3
- Version: 1.0.55
3
+ Version: 1.0.56
4
4
  Summary: WeChat method set.
5
5
  Project-URL: homepage, https://github.com/reyxbo/reywechat/
6
6
  Author-email: Rey <reyxbo@163.com>
@@ -3,14 +3,14 @@ reywechat/rall.py,sha256=5J_X-XMOyb1Vp1jyS9-oRFXGOtp2vRPX1g3tJot_Eck,371
3
3
  reywechat/rbase.py,sha256=hbxn5spvcl_C_Bw8A9teulOXT9GMlxUw145_YbXIOzc,1124
4
4
  reywechat/rcache.py,sha256=7UsHHfgFOgxuSqlTSAO6CprgUUOeBCXYus0kxmRBQxk,908
5
5
  reywechat/rclient.py,sha256=lc1CPle9h08mwP8NlJN0ybzcNJxtpV0ma6q6cz1RIxk,22518
6
- reywechat/rdb.py,sha256=SVW_tWaMDUaQH2nmD9Dyq-6QB2GV_ECKYbwwyGAwH3g,48349
6
+ reywechat/rdb.py,sha256=4or5HV_U4mZwRSiK1fa1wZkhh_KfdtkYoWkEdBDov_Q,48351
7
7
  reywechat/rlog.py,sha256=4EsTgrgC05JvWeKAucUaWGga638CRRJISJN6qncBCAw,5249
8
- reywechat/rreceive.py,sha256=53U262MdMoDcJfJ08CBW2c2SRGghNnjergF9ZNXFshM,50993
8
+ reywechat/rreceive.py,sha256=sdTxF6g4094AZu1lLswcZki21ZfmKIcjZ0520UWLq54,51584
9
9
  reywechat/rsend.py,sha256=aTmc1ycL8bon4KXoX7VpRWQKTsVER6f6bRLKWWvPspY,18049
10
10
  reywechat/rtrigger.py,sha256=WdOQwobPdGPyyE9J-qtQFPd60713T0aWqKk02PLdCRE,4966
11
11
  reywechat/rwechat.py,sha256=g0pbprMPv_qWb_lGFrPDAWsJO4vPSIgFLkw0Y28CZUo,4751
12
12
  reywechat/data/client_api.dll,sha256=H9uj-x9Ztg0jFZK0yY6NsnyH5_119dQRFfoVVMidxRs,592384
13
- reywechat-1.0.55.dist-info/METADATA,sha256=reH-YZ5i9VYDO--neT_f2oSWj6RoG5nPWFd3JKF30Fs,1551
14
- reywechat-1.0.55.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- reywechat-1.0.55.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
16
- reywechat-1.0.55.dist-info/RECORD,,
13
+ reywechat-1.0.56.dist-info/METADATA,sha256=kXh3hk31yQmrqGSTMO1qP5SFuh8cgEofH7X17eJQVxk,1551
14
+ reywechat-1.0.56.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
+ reywechat-1.0.56.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
16
+ reywechat-1.0.56.dist-info/RECORD,,