reywechat 1.0.46__py3-none-any.whl → 1.0.47__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 +22 -3
- reywechat/rsend.py +11 -1
- {reywechat-1.0.46.dist-info → reywechat-1.0.47.dist-info}/METADATA +1 -1
- {reywechat-1.0.46.dist-info → reywechat-1.0.47.dist-info}/RECORD +6 -6
- {reywechat-1.0.46.dist-info → reywechat-1.0.47.dist-info}/WHEEL +0 -0
- {reywechat-1.0.46.dist-info → reywechat-1.0.47.dist-info}/licenses/LICENSE +0 -0
reywechat/rreceive.py
CHANGED
@@ -23,7 +23,7 @@ from reykit.rnet import listen_socket
|
|
23
23
|
from reykit.ros import File, os_exists
|
24
24
|
from reykit.rre import search, search_batch, findall
|
25
25
|
from reykit.rtask import ThreadPool
|
26
|
-
from reykit.rtime import sleep, wait
|
26
|
+
from reykit.rtime import now, sleep, wait, to_time, time_to
|
27
27
|
from reykit.rwrap import wrap_thread, wrap_exc
|
28
28
|
|
29
29
|
from .rbase import BaseWeChat, WeChatTriggerError
|
@@ -94,6 +94,10 @@ class WeChatMessage(BaseWeChat):
|
|
94
94
|
display : Message description text.
|
95
95
|
data : Message source data.
|
96
96
|
window : Message sende window ID.
|
97
|
+
|
98
|
+
Attributes
|
99
|
+
----------
|
100
|
+
is_test : Whether add test text to before reply text.
|
97
101
|
"""
|
98
102
|
|
99
103
|
# Import.
|
@@ -114,6 +118,7 @@ class WeChatMessage(BaseWeChat):
|
|
114
118
|
self.trigger_break = self.receiver.trigger.break_
|
115
119
|
self.replied: bool = False
|
116
120
|
self.exc_reports: list[str] = []
|
121
|
+
self.is_test: bool = False
|
117
122
|
|
118
123
|
## Room and user.
|
119
124
|
if self.window.endswith('chatroom'):
|
@@ -127,7 +132,6 @@ class WeChatMessage(BaseWeChat):
|
|
127
132
|
self.user = self.window
|
128
133
|
|
129
134
|
## Cache.
|
130
|
-
self._window: str | None = None
|
131
135
|
self._user_name: str | None = None
|
132
136
|
self._room_name: str | None = None
|
133
137
|
self._window_name: str | None = None
|
@@ -1060,10 +1064,25 @@ class WeChatMessage(BaseWeChat):
|
|
1060
1064
|
text = 'can only be used by reply trigger'
|
1061
1065
|
throw(WeChatTriggerError, self.trigger_rule, text=text)
|
1062
1066
|
|
1067
|
+
# Test.
|
1068
|
+
if (
|
1069
|
+
self.is_test
|
1070
|
+
and send_type in (WeChatSendTypeEnum.TEXT, WeChatSendTypeEnum.TEXT_AT)
|
1071
|
+
):
|
1072
|
+
message_time = time_to(to_time(self.time).time())
|
1073
|
+
receive_time = now('time_str')
|
1074
|
+
send_time = ':time:'
|
1075
|
+
test_text = f'{message_time} M\n{receive_time} R\n{send_time} S'
|
1076
|
+
if params['text'] == '':
|
1077
|
+
params['text'] = test_text
|
1078
|
+
else:
|
1079
|
+
params['text'] = f'{test_text}\n\n{params['text']}'
|
1080
|
+
params['is_test'] = True
|
1081
|
+
|
1063
1082
|
# Status.
|
1064
1083
|
self.replied = True
|
1065
1084
|
|
1066
|
-
#
|
1085
|
+
# Send.
|
1067
1086
|
self.receiver.wechat.sender.send(
|
1068
1087
|
send_type,
|
1069
1088
|
receive_id=self.window,
|
reywechat/rsend.py
CHANGED
@@ -18,7 +18,7 @@ from queue import Queue
|
|
18
18
|
from re import escape as re_escape
|
19
19
|
from reykit.rbase import throw, catch_exc
|
20
20
|
from reykit.rre import sub
|
21
|
-
from reykit.rtime import sleep
|
21
|
+
from reykit.rtime import now, sleep
|
22
22
|
from reykit.rwrap import wrap_thread, wrap_exc
|
23
23
|
|
24
24
|
from .rbase import BaseWeChat, WeChatTriggerContinueExit, WeChatTriggerBreakExit
|
@@ -290,6 +290,16 @@ class WeChatSender(BaseWeChat):
|
|
290
290
|
send_param : `WeChatSendParameter` instance.
|
291
291
|
"""
|
292
292
|
|
293
|
+
# Test.
|
294
|
+
if (
|
295
|
+
send_param.params.get('is_test')
|
296
|
+
and send_param.send_type in (WeChatSendTypeEnum.TEXT, WeChatSendTypeEnum.TEXT_AT)
|
297
|
+
):
|
298
|
+
text: str = send_param.params['text']
|
299
|
+
now_time = now('time_str')
|
300
|
+
modify_text = text.replace(':time:', now_time, 1)
|
301
|
+
send_param.params['text'] = modify_text
|
302
|
+
|
293
303
|
# Send.
|
294
304
|
match send_param.send_type:
|
295
305
|
|
@@ -5,13 +5,13 @@ reywechat/rcache.py,sha256=Hh_HE-t_KUMlrz4gEFPh1AjmhnrSgH520IFJPumWb7A,908
|
|
5
5
|
reywechat/rclient.py,sha256=MEvQB3pHb5ORukKbKntalRtFcKIOP9BGtDsMt5ihQfM,22524
|
6
6
|
reywechat/rdb.py,sha256=akIQsx4CZIt-H6kXWn2vpUYjo5MgD8MluzBMnSdmLaM,40051
|
7
7
|
reywechat/rlog.py,sha256=IJL2WquiOYfB9iEai9xjojkuxPxiRHkdzZ5vCeaSA98,5261
|
8
|
-
reywechat/rreceive.py,sha256=
|
8
|
+
reywechat/rreceive.py,sha256=dr_it4xJpohzoy0HJfcPheVBqgJcUZAksH-t6zaXT6U,36187
|
9
9
|
reywechat/rschedule.py,sha256=X9kreXdClTeItJHmNPJNqb_lct-BiLCyusMQxsj5hWU,1865
|
10
|
-
reywechat/rsend.py,sha256=
|
10
|
+
reywechat/rsend.py,sha256=U2YQx0bqmQwzWogbXxjaATh_2TvjnbLd4O3dkCQhaIg,17993
|
11
11
|
reywechat/rtrigger.py,sha256=n8kUNovh62r7crlXrp33uaKvbILT-wcfvUqeyGt7YhM,4956
|
12
12
|
reywechat/rwechat.py,sha256=OcElINAi9jM-eDb_OTtseBW3kyG_3jD4V4QmltR6MeE,4874
|
13
13
|
reywechat/data/client_api.dll,sha256=H9uj-x9Ztg0jFZK0yY6NsnyH5_119dQRFfoVVMidxRs,592384
|
14
|
-
reywechat-1.0.
|
15
|
-
reywechat-1.0.
|
16
|
-
reywechat-1.0.
|
17
|
-
reywechat-1.0.
|
14
|
+
reywechat-1.0.47.dist-info/METADATA,sha256=nDuY1qNlRvga5LFUJEhWB0offK0UlWA5OP5KjeRDXWU,1551
|
15
|
+
reywechat-1.0.47.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
16
|
+
reywechat-1.0.47.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
17
|
+
reywechat-1.0.47.dist-info/RECORD,,
|
File without changes
|
File without changes
|