reywechat 1.0.71__py3-none-any.whl → 1.0.73__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/rclient.py +9 -0
- reywechat/rreceive.py +11 -7
- reywechat/rtrigger.py +3 -3
- {reywechat-1.0.71.dist-info → reywechat-1.0.73.dist-info}/METADATA +1 -1
- {reywechat-1.0.71.dist-info → reywechat-1.0.73.dist-info}/RECORD +7 -7
- {reywechat-1.0.71.dist-info → reywechat-1.0.73.dist-info}/WHEEL +0 -0
- {reywechat-1.0.71.dist-info → reywechat-1.0.73.dist-info}/licenses/LICENSE +0 -0
reywechat/rclient.py
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
|
12
12
|
from typing import Any, TypedDict, Literal, Final
|
13
13
|
from os.path import abspath as os_abspath
|
14
|
+
from reykit.rbase import throw
|
14
15
|
from reykit.rdll import inject_dll
|
15
16
|
from reykit.rnet import request as reykit_request
|
16
17
|
from reykit.ros import find_relpath
|
@@ -678,6 +679,10 @@ class WeChatClient(WeChatBase):
|
|
678
679
|
text : Message text.
|
679
680
|
"""
|
680
681
|
|
682
|
+
# Check.
|
683
|
+
if text == '':
|
684
|
+
throw(ValueError, text)
|
685
|
+
|
681
686
|
# Handle parameter.
|
682
687
|
api = 'sendTextMsg'
|
683
688
|
data = {
|
@@ -708,6 +713,10 @@ class WeChatClient(WeChatBase):
|
|
708
713
|
text : Message text.
|
709
714
|
"""
|
710
715
|
|
716
|
+
# Check.
|
717
|
+
if text == '':
|
718
|
+
throw(ValueError, text)
|
719
|
+
|
711
720
|
# Handle parameter.
|
712
721
|
api = 'sendAtText'
|
713
722
|
if type(user_id) != str:
|
reywechat/rreceive.py
CHANGED
@@ -133,10 +133,10 @@ class WeChatMessage(WeChatBase):
|
|
133
133
|
self.data = data
|
134
134
|
self.window = window
|
135
135
|
self.file: MessageParametersFile | None = None
|
136
|
-
self.
|
136
|
+
self.triggering_rule: TriggerRule | None = None
|
137
|
+
self.replied_rule: TriggerRule | None = None
|
137
138
|
self.trigger_continue = self.receiver.trigger.continue_
|
138
139
|
self.trigger_break = self.receiver.trigger.break_
|
139
|
-
self.replied: bool = False
|
140
140
|
self.exc_reports: list[str] = []
|
141
141
|
self.is_test: bool = False
|
142
142
|
|
@@ -202,7 +202,7 @@ class WeChatMessage(WeChatBase):
|
|
202
202
|
|
203
203
|
|
204
204
|
@property
|
205
|
-
def user_name(self) -> str:
|
205
|
+
def user_name(self) -> str | None:
|
206
206
|
"""
|
207
207
|
Message sender user name.
|
208
208
|
|
@@ -211,6 +211,10 @@ class WeChatMessage(WeChatBase):
|
|
211
211
|
User name.
|
212
212
|
"""
|
213
213
|
|
214
|
+
# Break.
|
215
|
+
if self.user is None:
|
216
|
+
return
|
217
|
+
|
214
218
|
# Cache.
|
215
219
|
if 'user_name' in self._cache:
|
216
220
|
return self._cache['user_name']
|
@@ -1580,11 +1584,11 @@ class WeChatMessage(WeChatBase):
|
|
1580
1584
|
|
1581
1585
|
# Check.
|
1582
1586
|
if (
|
1583
|
-
self.
|
1584
|
-
or not self.
|
1587
|
+
self.triggering_rule is None
|
1588
|
+
or not self.triggering_rule['is_reply']
|
1585
1589
|
):
|
1586
1590
|
text = 'can only be used by reply trigger'
|
1587
|
-
throw(WeChatTriggerError, self.
|
1591
|
+
throw(WeChatTriggerError, self.triggering_rule, text=text)
|
1588
1592
|
|
1589
1593
|
# Test.
|
1590
1594
|
if (
|
@@ -1602,7 +1606,7 @@ class WeChatMessage(WeChatBase):
|
|
1602
1606
|
params['is_test'] = True
|
1603
1607
|
|
1604
1608
|
# Status.
|
1605
|
-
self.
|
1609
|
+
self.replied_rule = self.triggering_rule
|
1606
1610
|
|
1607
1611
|
# Send.
|
1608
1612
|
self.receiver.wechat.sender.send(
|
reywechat/rtrigger.py
CHANGED
@@ -76,11 +76,11 @@ class WeChatTrigger(WeChatBase):
|
|
76
76
|
|
77
77
|
# Loop.
|
78
78
|
for rule in self.rules:
|
79
|
-
message.
|
79
|
+
message.triggering_rule = rule
|
80
80
|
|
81
81
|
# Replied.
|
82
82
|
if (
|
83
|
-
message.
|
83
|
+
message.replied_rule is not None
|
84
84
|
and rule['is_reply']
|
85
85
|
):
|
86
86
|
continue
|
@@ -107,7 +107,7 @@ class WeChatTrigger(WeChatBase):
|
|
107
107
|
message.exc_reports.append(exc_text)
|
108
108
|
|
109
109
|
finally:
|
110
|
-
message.
|
110
|
+
message.triggering_rule = None
|
111
111
|
|
112
112
|
|
113
113
|
# Add handler.
|
@@ -2,15 +2,15 @@ reywechat/__init__.py,sha256=FXc3XSiPLLmz9bgZdiYKxeWX-7VT9RqPc_EkXp3Kk0I,476
|
|
2
2
|
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=5FIa8UB3VsLHT_EXHHmFP62a5AeS22anJCJXC8t4tWw,908
|
5
|
-
reywechat/rclient.py,sha256=
|
5
|
+
reywechat/rclient.py,sha256=ayOtQ0CaF8ydXjirLdVed8FbpfdQVTKVSd0x4grs-pQ,22712
|
6
6
|
reywechat/rdb.py,sha256=R3ZySPsLM5g0hChFBMxtG9MRZCZ433aMYa_LuggKK90,51010
|
7
7
|
reywechat/rlog.py,sha256=TSA-_5pwlq0sUND2cnLDqXvdmAdMAkC7tXIz3WfJ7Xw,5259
|
8
|
-
reywechat/rreceive.py,sha256=
|
8
|
+
reywechat/rreceive.py,sha256=X39wYeD1LSW4XRD2zxjT-xCpWIqWaeox3VHB7cAuhwc,50732
|
9
9
|
reywechat/rsend.py,sha256=BB42r24x37V1tb27HLhnB_2tILv-DW26F9QbhqiNes8,20101
|
10
|
-
reywechat/rtrigger.py,sha256=
|
10
|
+
reywechat/rtrigger.py,sha256=c0peI208K2k2sOxtuszD8UMrhMrTGp0LMi_XE5ksJKg,4989
|
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.
|
14
|
-
reywechat-1.0.
|
15
|
-
reywechat-1.0.
|
16
|
-
reywechat-1.0.
|
13
|
+
reywechat-1.0.73.dist-info/METADATA,sha256=au9PMuWjTAEc0NOChSMeGd9mWM71HlsZN2iqUxAFNwA,1551
|
14
|
+
reywechat-1.0.73.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
15
|
+
reywechat-1.0.73.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
16
|
+
reywechat-1.0.73.dist-info/RECORD,,
|
File without changes
|
File without changes
|