reywechat 1.0.58__py3-none-any.whl → 1.0.60__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/rreceive.py CHANGED
@@ -201,8 +201,8 @@ class WeChatMessage(WeChatBase):
201
201
  self._is_xml: bool | None = None
202
202
  self._valid: bool | None = None
203
203
 
204
- ## Update call.
205
- self.is_call
204
+ ## Update call next.
205
+ self.is_call_next
206
206
 
207
207
 
208
208
  @property
@@ -989,77 +989,32 @@ class WeChatMessage(WeChatBase):
989
989
  if self._is_call is not None:
990
990
  return self._is_call
991
991
 
992
- # Text.
993
- if self.type in (1, 3, 34, 42, 43, 47, 48, 49, 50, 56, 10002):
994
- text = self.text
995
- text = text.strip()
996
- else:
997
- self._is_call = False
998
- self._call_text = None
999
- return self._is_call
1000
- text = text.strip()
1001
-
1002
- ## At me.
1003
- at_me_keyword = '@%s\u2005' % self.receiver.wechat.client.login_info['name']
1004
- if at_me_keyword in text:
1005
- is_at_me = True
1006
- text = text.replace(at_me_keyword, '')
1007
- else:
1008
- is_at_me = False
1009
-
1010
- ## Call me.
1011
- pattern = fr'^{self.receiver.call_name}[\s,,]*(.*)$'
1012
- result: str | None = search(pattern, text)
1013
- if result is not None:
1014
- is_call_name = True
1015
- text = result or None
1016
- else:
1017
- is_call_name = False
1018
-
1019
992
  # Judge.
1020
- if (
993
+ self._is_call = (
1021
994
 
1022
995
  ## Last call.
1023
996
  self.is_last_call
1024
997
 
1025
998
  ## Private chat.
1026
- or self.room is None
999
+ or (
1000
+ self.room is None
1001
+ and self.user is not None
1002
+ )
1027
1003
 
1028
1004
  ## Pat me.
1029
1005
  or self.is_pat_me
1030
1006
 
1031
1007
  ## At self.
1032
- or is_at_me
1008
+ or '@%s\u2005' % self.receiver.wechat.client.login_info['name'] in self.data
1033
1009
 
1034
1010
  ## Call self.
1035
- or is_call_name
1011
+ or self.data.lstrip().startswith(self.receiver.call_name)
1036
1012
 
1037
1013
  ## Quote me.
1038
1014
  or self.is_quote_me
1039
1015
 
1040
- ):
1041
- is_call = True
1042
- call_text = text
1043
- else:
1044
- is_call = False
1045
- call_text = None
1046
-
1047
- ## Call next.
1048
- is_call_next = (
1049
- self.room is not None
1050
- and is_call
1051
- and call_text is None
1052
1016
  )
1053
1017
 
1054
- ### Mark.
1055
- if is_call_next:
1056
- call_next_mark_value = f'{self.user}_{self.room}'
1057
- self.receiver.mark(call_next_mark_value, 'is_call_next')
1058
-
1059
- self._is_call = is_call
1060
- self._call_text = call_text
1061
- self._is_call_next = is_call_next
1062
-
1063
1018
  return self._is_call
1064
1019
 
1065
1020
 
@@ -1081,6 +1036,23 @@ class WeChatMessage(WeChatBase):
1081
1036
  if not self.is_call:
1082
1037
  throw(AssertionError, self._is_call)
1083
1038
 
1039
+ # Get.
1040
+ text = self.text
1041
+
1042
+ ## Replace.
1043
+
1044
+ ### At.
1045
+ at_me_keyword = '@%s\u2005' % self.receiver.wechat.client.login_info['name']
1046
+ text = text.replace(at_me_keyword, '')
1047
+
1048
+ ### Call.
1049
+ pattern = fr'^\s*{self.receiver.call_name}[\s,,]*(.*)$'
1050
+ result: str | None = search(pattern, text)
1051
+ if result is not None:
1052
+ text = result
1053
+
1054
+ text = text.strip()
1055
+
1084
1056
  return self._call_text
1085
1057
 
1086
1058
 
@@ -1099,7 +1071,16 @@ class WeChatMessage(WeChatBase):
1099
1071
  return self._is_call_next
1100
1072
 
1101
1073
  # Judge.
1102
- self.is_call
1074
+ self._is_call_next = (
1075
+ self.room is not None
1076
+ and self.is_call
1077
+ and self.call_text == ''
1078
+ )
1079
+
1080
+ ### Mark.
1081
+ if self._is_call_next:
1082
+ call_next_mark_value = f'{self.user}_{self.room}'
1083
+ self.receiver.mark(call_next_mark_value, 'is_call_next')
1103
1084
 
1104
1085
  return self._is_call_next
1105
1086
 
@@ -1257,6 +1238,7 @@ class WeChatMessage(WeChatBase):
1257
1238
  and (
1258
1239
  self.data == '以上是打招呼的内容'
1259
1240
  or self.data.startswith('你已添加了')
1241
+ or self.data.endswith(',现在可以开始聊天了。')
1260
1242
  )
1261
1243
  )
1262
1244
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reywechat
3
- Version: 1.0.58
3
+ Version: 1.0.60
4
4
  Summary: WeChat method set.
5
5
  Project-URL: homepage, https://github.com/reyxbo/reywechat/
6
6
  Author-email: Rey <reyxbo@163.com>
@@ -5,12 +5,12 @@ reywechat/rcache.py,sha256=7UsHHfgFOgxuSqlTSAO6CprgUUOeBCXYus0kxmRBQxk,908
5
5
  reywechat/rclient.py,sha256=lc1CPle9h08mwP8NlJN0ybzcNJxtpV0ma6q6cz1RIxk,22518
6
6
  reywechat/rdb.py,sha256=PBEg_9Ig07vwqH3RNLaIWZZD7Joe6MQceiNB21hGAj0,48654
7
7
  reywechat/rlog.py,sha256=4EsTgrgC05JvWeKAucUaWGga638CRRJISJN6qncBCAw,5249
8
- reywechat/rreceive.py,sha256=nNSBDfCwFUK2eiDRgLey1o6uQ4GaaQLGpwrsHjB6nbU,51581
8
+ reywechat/rreceive.py,sha256=OW27boLq8UL8ugSXlsu4DGvVLN701FL4QuVB5Lk90BU,51180
9
9
  reywechat/rsend.py,sha256=yrJf9GzWVCDptUHHazhWSVW0nm2LCIbb0sz2EII63bY,20049
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.58.dist-info/METADATA,sha256=lrpYILANeibxRcXZMs10akTvzbvg6d69l4xKDvv0Fvk,1551
14
- reywechat-1.0.58.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- reywechat-1.0.58.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
16
- reywechat-1.0.58.dist-info/RECORD,,
13
+ reywechat-1.0.60.dist-info/METADATA,sha256=WDe_gDEIGMG7ljiwCP0mXwsQOKvkoUJJkSvcJl3JrBM,1551
14
+ reywechat-1.0.60.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
+ reywechat-1.0.60.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
16
+ reywechat-1.0.60.dist-info/RECORD,,