reywechat 1.0.59__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,39 +989,8 @@ class WeChatMessage(WeChatBase):
989
989
  if self._is_call is not None:
990
990
  return self._is_call
991
991
 
992
- # Text.
993
- if (
994
- self.type in (1, 3, 34, 42, 43, 47, 48, 49, 50, 56)
995
- or self.is_pat
996
- or self.is_recall
997
- ):
998
- text = self.text
999
- text = text.strip()
1000
- else:
1001
- self._is_call = False
1002
- self._call_text = None
1003
- return self._is_call
1004
- text = text.strip()
1005
-
1006
- ## At me.
1007
- at_me_keyword = '@%s\u2005' % self.receiver.wechat.client.login_info['name']
1008
- if at_me_keyword in text:
1009
- is_at_me = True
1010
- text = text.replace(at_me_keyword, '')
1011
- else:
1012
- is_at_me = False
1013
-
1014
- ## Call me.
1015
- pattern = fr'^{self.receiver.call_name}[\s,,]*(.*)$'
1016
- result: str | None = search(pattern, text)
1017
- if result is not None:
1018
- is_call_name = True
1019
- text = result or None
1020
- else:
1021
- is_call_name = False
1022
-
1023
992
  # Judge.
1024
- if (
993
+ self._is_call = (
1025
994
 
1026
995
  ## Last call.
1027
996
  self.is_last_call
@@ -1036,37 +1005,16 @@ class WeChatMessage(WeChatBase):
1036
1005
  or self.is_pat_me
1037
1006
 
1038
1007
  ## At self.
1039
- or is_at_me
1008
+ or '@%s\u2005' % self.receiver.wechat.client.login_info['name'] in self.data
1040
1009
 
1041
1010
  ## Call self.
1042
- or is_call_name
1011
+ or self.data.lstrip().startswith(self.receiver.call_name)
1043
1012
 
1044
1013
  ## Quote me.
1045
1014
  or self.is_quote_me
1046
1015
 
1047
- ):
1048
- is_call = True
1049
- call_text = text
1050
- else:
1051
- is_call = False
1052
- call_text = None
1053
-
1054
- ## Call next.
1055
- is_call_next = (
1056
- self.room is not None
1057
- and is_call
1058
- and call_text is None
1059
1016
  )
1060
1017
 
1061
- ### Mark.
1062
- if is_call_next:
1063
- call_next_mark_value = f'{self.user}_{self.room}'
1064
- self.receiver.mark(call_next_mark_value, 'is_call_next')
1065
-
1066
- self._is_call = is_call
1067
- self._call_text = call_text
1068
- self._is_call_next = is_call_next
1069
-
1070
1018
  return self._is_call
1071
1019
 
1072
1020
 
@@ -1088,6 +1036,23 @@ class WeChatMessage(WeChatBase):
1088
1036
  if not self.is_call:
1089
1037
  throw(AssertionError, self._is_call)
1090
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
+
1091
1056
  return self._call_text
1092
1057
 
1093
1058
 
@@ -1106,7 +1071,16 @@ class WeChatMessage(WeChatBase):
1106
1071
  return self._is_call_next
1107
1072
 
1108
1073
  # Judge.
1109
- 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')
1110
1084
 
1111
1085
  return self._is_call_next
1112
1086
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reywechat
3
- Version: 1.0.59
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=vzE2MmWOFK2usVGaOf7mtNkyb6evstDkFOjTMhfKFwY,51812
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.59.dist-info/METADATA,sha256=XyWnYRmTKu--BIZhMsH2_U6g-oUVPCf6azo_yXRa1Mk,1551
14
- reywechat-1.0.59.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- reywechat-1.0.59.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
16
- reywechat-1.0.59.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,,