reywechat 1.0.31__py3-none-any.whl → 1.0.33__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 +24 -29
- reywechat/rdb.py +3 -3
- reywechat/rlog.py +1 -1
- reywechat/rreceive.py +37 -7
- reywechat/rschedule.py +1 -1
- reywechat/rsend.py +1 -1
- reywechat/rtrigger.py +1 -1
- reywechat/rwechat.py +1 -1
- {reywechat-1.0.31.dist-info → reywechat-1.0.33.dist-info}/METADATA +1 -1
- reywechat-1.0.33.dist-info/RECORD +17 -0
- reywechat-1.0.31.dist-info/RECORD +0 -17
- {reywechat-1.0.31.dist-info → reywechat-1.0.33.dist-info}/WHEEL +0 -0
- {reywechat-1.0.31.dist-info → reywechat-1.0.33.dist-info}/licenses/LICENSE +0 -0
reywechat/rclient.py
CHANGED
@@ -211,7 +211,7 @@ class WeChatClient(BaseWeChat):
|
|
211
211
|
Inject DLL file of start API into the WeChat client process.
|
212
212
|
"""
|
213
213
|
|
214
|
-
#
|
214
|
+
# Handle parameter.
|
215
215
|
dll_file_relpath = './data/client_api.dll'
|
216
216
|
dll_file_path = find_relpath(__file__, dll_file_relpath)
|
217
217
|
|
@@ -250,10 +250,9 @@ class WeChatClient(BaseWeChat):
|
|
250
250
|
Client response content dictionary.
|
251
251
|
"""
|
252
252
|
|
253
|
-
#
|
253
|
+
# Handle parameter.
|
254
254
|
url = f'http://127.0.0.1:{self.client_api_port}/api/{api}'
|
255
|
-
|
256
|
-
data = {}
|
255
|
+
data = data or {}
|
257
256
|
if type(success_code) == int:
|
258
257
|
success_code = [success_code]
|
259
258
|
if type(fail_code) == int:
|
@@ -299,7 +298,7 @@ class WeChatClient(BaseWeChat):
|
|
299
298
|
Check result.
|
300
299
|
"""
|
301
300
|
|
302
|
-
#
|
301
|
+
# Handle parameter.
|
303
302
|
api = 'checkLogin'
|
304
303
|
|
305
304
|
# Request.
|
@@ -352,7 +351,7 @@ class WeChatClient(BaseWeChat):
|
|
352
351
|
- `Key 'decrypt_key'`: WeChatDatabase decrypt key.
|
353
352
|
"""
|
354
353
|
|
355
|
-
#
|
354
|
+
# Handle parameter.
|
356
355
|
api = 'userInfo'
|
357
356
|
|
358
357
|
# Request.
|
@@ -402,7 +401,7 @@ class WeChatClient(BaseWeChat):
|
|
402
401
|
timeout : Request timeout seconds.
|
403
402
|
"""
|
404
403
|
|
405
|
-
#
|
404
|
+
# Handle parameter.
|
406
405
|
api = 'hookSyncMsg'
|
407
406
|
port = str(port)
|
408
407
|
timeout_ms_str = str(int(timeout * 1000))
|
@@ -440,7 +439,7 @@ class WeChatClient(BaseWeChat):
|
|
440
439
|
Unhook the message.
|
441
440
|
"""
|
442
441
|
|
443
|
-
#
|
442
|
+
# Handle parameter.
|
444
443
|
api = 'unhookSyncMsg'
|
445
444
|
|
446
445
|
# Request.
|
@@ -462,7 +461,7 @@ class WeChatClient(BaseWeChat):
|
|
462
461
|
id\\_ : Message ID.
|
463
462
|
"""
|
464
463
|
|
465
|
-
#
|
464
|
+
# Handle parameter.
|
466
465
|
api = 'downloadAttach'
|
467
466
|
data = {'msgId': id_}
|
468
467
|
|
@@ -484,7 +483,7 @@ class WeChatClient(BaseWeChat):
|
|
484
483
|
dir\\_ : Save directory.
|
485
484
|
"""
|
486
485
|
|
487
|
-
#
|
486
|
+
# Handle parameter.
|
488
487
|
api = 'getVoiceByMsgId'
|
489
488
|
dir_ = os_abspath(dir_)
|
490
489
|
data = {
|
@@ -517,7 +516,7 @@ class WeChatClient(BaseWeChat):
|
|
517
516
|
- `Key 'name'`: User nickname or chat room name.
|
518
517
|
"""
|
519
518
|
|
520
|
-
#
|
519
|
+
# Handle parameter.
|
521
520
|
api = 'getContactList'
|
522
521
|
filter_names = {
|
523
522
|
'filehelper': '朋友推荐消息',
|
@@ -586,7 +585,7 @@ class WeChatClient(BaseWeChat):
|
|
586
585
|
User nickname or chat room name.
|
587
586
|
"""
|
588
587
|
|
589
|
-
#
|
588
|
+
# Handle parameter.
|
590
589
|
api = 'getContactProfile'
|
591
590
|
data = {'wxid': id_}
|
592
591
|
|
@@ -619,7 +618,7 @@ class WeChatClient(BaseWeChat):
|
|
619
618
|
List of chat room member user ID.
|
620
619
|
"""
|
621
620
|
|
622
|
-
#
|
621
|
+
# Handle parameter.
|
623
622
|
api = 'getMemberFromChatRoom'
|
624
623
|
data = {'chatRoomId': room_id}
|
625
624
|
|
@@ -679,7 +678,7 @@ class WeChatClient(BaseWeChat):
|
|
679
678
|
text : Message text.
|
680
679
|
"""
|
681
680
|
|
682
|
-
#
|
681
|
+
# Handle parameter.
|
683
682
|
api = 'sendTextMsg'
|
684
683
|
data = {
|
685
684
|
'wxid': receive_id,
|
@@ -709,7 +708,7 @@ class WeChatClient(BaseWeChat):
|
|
709
708
|
text : Message text.
|
710
709
|
"""
|
711
710
|
|
712
|
-
#
|
711
|
+
# Handle parameter.
|
713
712
|
api = 'sendAtText'
|
714
713
|
if type(user_id) != str:
|
715
714
|
user_id = ','.join(user_id)
|
@@ -737,7 +736,7 @@ class WeChatClient(BaseWeChat):
|
|
737
736
|
path : Message file path.
|
738
737
|
"""
|
739
738
|
|
740
|
-
#
|
739
|
+
# Handle parameter.
|
741
740
|
api = 'sendFileMsg'
|
742
741
|
data = {
|
743
742
|
'wxid': receive_id,
|
@@ -762,7 +761,7 @@ class WeChatClient(BaseWeChat):
|
|
762
761
|
path : Message image file path.
|
763
762
|
"""
|
764
763
|
|
765
|
-
#
|
764
|
+
# Handle parameter.
|
766
765
|
api = 'sendImagesMsg'
|
767
766
|
data = {
|
768
767
|
'wxid': receive_id,
|
@@ -787,7 +786,7 @@ class WeChatClient(BaseWeChat):
|
|
787
786
|
path : Message emotion file path.
|
788
787
|
"""
|
789
788
|
|
790
|
-
#
|
789
|
+
# Handle parameter.
|
791
790
|
api = 'sendCustomEmotion'
|
792
791
|
data = {
|
793
792
|
'wxid': receive_id,
|
@@ -812,7 +811,7 @@ class WeChatClient(BaseWeChat):
|
|
812
811
|
user_id : User ID of pat.
|
813
812
|
"""
|
814
813
|
|
815
|
-
#
|
814
|
+
# Handle parameter.
|
816
815
|
api = 'sendPatMsg'
|
817
816
|
data = {
|
818
817
|
'wxid': receive_id,
|
@@ -847,15 +846,11 @@ class WeChatClient(BaseWeChat):
|
|
847
846
|
public_id : Control public account ID.
|
848
847
|
"""
|
849
848
|
|
850
|
-
#
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
if public_name is None:
|
856
|
-
public_name = ''
|
857
|
-
if public_id is None:
|
858
|
-
public_id = ''
|
849
|
+
# Handle parameter.
|
850
|
+
text = text or ''
|
851
|
+
image_url = image_url or ''
|
852
|
+
public_name = public_name or ''
|
853
|
+
public_id = public_id or ''
|
859
854
|
api = 'forwardPublicMsg'
|
860
855
|
data = {
|
861
856
|
'wxid': receive_id,
|
@@ -885,7 +880,7 @@ class WeChatClient(BaseWeChat):
|
|
885
880
|
message_id : Forward message ID.
|
886
881
|
"""
|
887
882
|
|
888
|
-
#
|
883
|
+
# Handle parameter.
|
889
884
|
api = 'sendImagesMsg'
|
890
885
|
data = {
|
891
886
|
'wxid': receive_id,
|
reywechat/rdb.py
CHANGED
@@ -934,7 +934,7 @@ class WeChatDatabase(BaseWeChat):
|
|
934
934
|
sendparam : `WeChatSendParameter` instance.
|
935
935
|
"""
|
936
936
|
|
937
|
-
#
|
937
|
+
# Handle parameter.
|
938
938
|
if sendparam.exc_reports == []:
|
939
939
|
status = 2
|
940
940
|
else:
|
@@ -1001,7 +1001,7 @@ class WeChatDatabase(BaseWeChat):
|
|
1001
1001
|
Read record from table `message_send`, put send queue.
|
1002
1002
|
"""
|
1003
1003
|
|
1004
|
-
#
|
1004
|
+
# Handle parameter.
|
1005
1005
|
conn = self.rdatabase_wechat.connect()
|
1006
1006
|
|
1007
1007
|
# Read.
|
@@ -1220,7 +1220,7 @@ class WeChatDatabase(BaseWeChat):
|
|
1220
1220
|
params : Send parameters.
|
1221
1221
|
"""
|
1222
1222
|
|
1223
|
-
#
|
1223
|
+
# Handle parameter.
|
1224
1224
|
data = {
|
1225
1225
|
'status': 0,
|
1226
1226
|
'type': send_type,
|
reywechat/rlog.py
CHANGED
reywechat/rreceive.py
CHANGED
@@ -20,7 +20,7 @@ from reykit.rbase import throw
|
|
20
20
|
from reykit.rimage import decode_qrcode
|
21
21
|
from reykit.rnet import listen_socket
|
22
22
|
from reykit.ros import File, os_exists
|
23
|
-
from reykit.rre import search, findall
|
23
|
+
from reykit.rre import search, search_batch, findall
|
24
24
|
from reykit.rtask import ThreadPool
|
25
25
|
from reykit.rtime import sleep, wait
|
26
26
|
from reykit.rwrap import wrap_thread, wrap_exc
|
@@ -166,7 +166,7 @@ class WeChatMessage(BaseWeChat):
|
|
166
166
|
Parameters dictionary.
|
167
167
|
"""
|
168
168
|
|
169
|
-
#
|
169
|
+
# Handle parameter.
|
170
170
|
params: MessageParameter = {
|
171
171
|
'time': self.time,
|
172
172
|
'id': self.id,
|
@@ -889,7 +889,6 @@ class WeChatMessage(BaseWeChat):
|
|
889
889
|
return self._valid
|
890
890
|
|
891
891
|
|
892
|
-
@property
|
893
892
|
def check_call(self) -> None:
|
894
893
|
"""
|
895
894
|
Check if is call self name, if not, throw exception `WeChatTriggerContinueExit`.
|
@@ -900,6 +899,39 @@ class WeChatMessage(BaseWeChat):
|
|
900
899
|
self.trigger_continue()
|
901
900
|
|
902
901
|
|
902
|
+
def check_search_text(self, *patterns: str, text: str | None = None) -> str | tuple[str | None, ...]:
|
903
|
+
"""
|
904
|
+
Regular search text, return first successful match.
|
905
|
+
When no match, then throw exception `WeChatTriggerContinueExit`.
|
906
|
+
|
907
|
+
Parameters
|
908
|
+
----------
|
909
|
+
pattern : Regular pattern, period match any character.
|
910
|
+
text : Match text.
|
911
|
+
- `None`: Use `self.data`.
|
912
|
+
|
913
|
+
Returns
|
914
|
+
-------
|
915
|
+
Matching result.
|
916
|
+
- When match to and not use `group`, then return `str`.
|
917
|
+
- When match to and use `group`, then return tuple with value `str` or `None`.
|
918
|
+
If tuple length is `1`, extract and return `str`.
|
919
|
+
- When no match, then return `None`.
|
920
|
+
"""
|
921
|
+
|
922
|
+
# Handle parameter.
|
923
|
+
text = text or self.data
|
924
|
+
|
925
|
+
# Search.
|
926
|
+
result = search_batch(text, *patterns)
|
927
|
+
|
928
|
+
# Check.
|
929
|
+
if result is None:
|
930
|
+
self.trigger_continue()
|
931
|
+
|
932
|
+
return result
|
933
|
+
|
934
|
+
|
903
935
|
@overload
|
904
936
|
def reply(
|
905
937
|
self,
|
@@ -1030,8 +1062,7 @@ class WechatReceiver(BaseWeChat):
|
|
1030
1062
|
# Set attribute.
|
1031
1063
|
self.wechat = wechat
|
1032
1064
|
self.max_receiver = max_receiver
|
1033
|
-
|
1034
|
-
call_name = self.wechat.client.login_info['name']
|
1065
|
+
call_name = call_name or self.wechat.client.login_info['name']
|
1035
1066
|
self.call_name = call_name
|
1036
1067
|
self.queue: Queue[WeChatMessage] = Queue()
|
1037
1068
|
self.handlers: list[Callable[[WeChatMessage], Any]] = []
|
@@ -1313,8 +1344,7 @@ class WechatReceiver(BaseWeChat):
|
|
1313
1344
|
|
1314
1345
|
## Cache.
|
1315
1346
|
download_file = File(download_path)
|
1316
|
-
|
1317
|
-
file_name = f'{download_file.md5}.{file_name_suffix}'
|
1347
|
+
file_name = file_name or f'{download_file.md5}.{file_name_suffix}'
|
1318
1348
|
cache_path = self.wechat.cache.store(download_path, file_name, delete=True)
|
1319
1349
|
|
1320
1350
|
# Set parameter.
|
reywechat/rschedule.py
CHANGED
reywechat/rsend.py
CHANGED
@@ -389,7 +389,7 @@ class WeChatSender(BaseWeChat):
|
|
389
389
|
Added text.
|
390
390
|
"""
|
391
391
|
|
392
|
-
#
|
392
|
+
# Handle parameter.
|
393
393
|
member_dict = self.wechat.client.get_room_member_dict(room_id)
|
394
394
|
login_id = self.wechat.client.login_info['id']
|
395
395
|
if login_id in member_dict:
|
reywechat/rtrigger.py
CHANGED
@@ -135,7 +135,7 @@ class WeChatTrigger(BaseWeChat):
|
|
135
135
|
is_reply : Whehter is reply function, allow call `WeChatMessage.reply`, can only reply once function.
|
136
136
|
"""
|
137
137
|
|
138
|
-
#
|
138
|
+
# Handle parameter.
|
139
139
|
rule: TriggerRule = {
|
140
140
|
'level': level,
|
141
141
|
'execute': execute,
|
reywechat/rwechat.py
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
reywechat/__init__.py,sha256=BL4PUpTguszJ612qsZf4-sOXxRIsiYRQ_m__FGMd1RQ,513
|
2
|
+
reywechat/rall.py,sha256=zEW-mLL2uP8aT2_foCMFGmMi_3RCrGl8qutnSVkmY1E,397
|
3
|
+
reywechat/rbase.py,sha256=0NunIUIXra2ML2N6odwMk5oENTE0r6VSBHWXUvgI-lc,1124
|
4
|
+
reywechat/rcache.py,sha256=Hh_HE-t_KUMlrz4gEFPh1AjmhnrSgH520IFJPumWb7A,908
|
5
|
+
reywechat/rclient.py,sha256=MEvQB3pHb5ORukKbKntalRtFcKIOP9BGtDsMt5ihQfM,22524
|
6
|
+
reywechat/rdb.py,sha256=euMCZBYz6b4Pw27zPUKYOwPHxK7g47pYfWFfNZMh0mU,40342
|
7
|
+
reywechat/rlog.py,sha256=x4WFLNoeKqGjPVoI81ZZNEd9ctdYToSg5hEFuESmCQY,5254
|
8
|
+
reywechat/rreceive.py,sha256=RkUwPsWz6k_Ua3ovrbXRMVajeNOJQqvpPXz_CvJyUPQ,35162
|
9
|
+
reywechat/rschedule.py,sha256=bZEEZV3K4zrJvupe1Eq6kGR7kunbVq5dfGnqFKYF3JI,1857
|
10
|
+
reywechat/rsend.py,sha256=UmdKCOb1cPKEmBPHt9htjxB8fPyi5jW5pGwpRQIZdKA,13720
|
11
|
+
reywechat/rtrigger.py,sha256=n8kUNovh62r7crlXrp33uaKvbILT-wcfvUqeyGt7YhM,4956
|
12
|
+
reywechat/rwechat.py,sha256=d9yNnLLz0YI1buatf5j4YMhj6tUH6yWsDnx91EyAhow,4926
|
13
|
+
reywechat/data/client_api.dll,sha256=H9uj-x9Ztg0jFZK0yY6NsnyH5_119dQRFfoVVMidxRs,592384
|
14
|
+
reywechat-1.0.33.dist-info/METADATA,sha256=iWpKAPaPOLLlLnmBv8bGRXGjDmlbMuVMLZtaqodYSQk,1551
|
15
|
+
reywechat-1.0.33.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
16
|
+
reywechat-1.0.33.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
17
|
+
reywechat-1.0.33.dist-info/RECORD,,
|
@@ -1,17 +0,0 @@
|
|
1
|
-
reywechat/__init__.py,sha256=BL4PUpTguszJ612qsZf4-sOXxRIsiYRQ_m__FGMd1RQ,513
|
2
|
-
reywechat/rall.py,sha256=zEW-mLL2uP8aT2_foCMFGmMi_3RCrGl8qutnSVkmY1E,397
|
3
|
-
reywechat/rbase.py,sha256=0NunIUIXra2ML2N6odwMk5oENTE0r6VSBHWXUvgI-lc,1124
|
4
|
-
reywechat/rcache.py,sha256=Hh_HE-t_KUMlrz4gEFPh1AjmhnrSgH520IFJPumWb7A,908
|
5
|
-
reywechat/rclient.py,sha256=gtTYaoqhgh9kRFslETKjBJiAAdzJfeOxIJbdCkGAFhM,22577
|
6
|
-
reywechat/rdb.py,sha256=Gcj3d-uIospaacjHY8B4HHdru5OwiS9PO6cceAWvXqY,40333
|
7
|
-
reywechat/rlog.py,sha256=d3S0eHMUZ92OLE7fjP3zzikIYANtnbAxhnE_DIV_1OY,5251
|
8
|
-
reywechat/rreceive.py,sha256=0S7GZkLuUdLeccSQJT0-ASBqo_IFmNNQfwk_Qn-SC1E,34178
|
9
|
-
reywechat/rschedule.py,sha256=fn11rH0HqxbnJYxARCBBiSdzBpYfQFhcjNmkvihVMTc,1854
|
10
|
-
reywechat/rsend.py,sha256=s2sR6l74reDShBAu_MwpavVunz0g42pIga0zX4ElIuI,13717
|
11
|
-
reywechat/rtrigger.py,sha256=GHfkhNrS8rV4uXWC3N54UTjak7nKGfqJWX6pe57Hsgg,4953
|
12
|
-
reywechat/rwechat.py,sha256=igeG0XhfBN1BRQ9RDmYrPZIKdnIK2tmS05wb-eMdlzs,4923
|
13
|
-
reywechat/data/client_api.dll,sha256=H9uj-x9Ztg0jFZK0yY6NsnyH5_119dQRFfoVVMidxRs,592384
|
14
|
-
reywechat-1.0.31.dist-info/METADATA,sha256=hx4R2CIjrn41MVLGtuLYKwrdiFZw97UQnzRxYfsc9Es,1551
|
15
|
-
reywechat-1.0.31.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
16
|
-
reywechat-1.0.31.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
17
|
-
reywechat-1.0.31.dist-info/RECORD,,
|
File without changes
|
File without changes
|