reywechat 1.0.19__py3-none-any.whl → 1.0.21__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/rdb.py +17 -17
- reywechat/rlog.py +2 -2
- reywechat/rreceive.py +8 -8
- reywechat/rsend.py +12 -10
- reywechat/rtrigger.py +4 -4
- reywechat/rwechat.py +2 -2
- {reywechat-1.0.19.dist-info → reywechat-1.0.21.dist-info}/METADATA +1 -1
- reywechat-1.0.21.dist-info/RECORD +16 -0
- reywechat-1.0.19.dist-info/RECORD +0 -16
- {reywechat-1.0.19.dist-info → reywechat-1.0.21.dist-info}/WHEEL +0 -0
- {reywechat-1.0.19.dist-info → reywechat-1.0.21.dist-info}/licenses/LICENSE +0 -0
reywechat/rdb.py
CHANGED
@@ -77,12 +77,12 @@ class WeChatDatabase(BaseWeChat):
|
|
77
77
|
self.build()
|
78
78
|
|
79
79
|
# Add handler.
|
80
|
-
self.
|
81
|
-
self.
|
82
|
-
self.
|
83
|
-
self.
|
84
|
-
self.
|
85
|
-
self.
|
80
|
+
self.__to_contact_user()
|
81
|
+
self.__to_contact_room()
|
82
|
+
self.__to_contact_room_user()
|
83
|
+
self.__to_message_receive()
|
84
|
+
self.__to_message_send()
|
85
|
+
self.__from_message_send_loop()
|
86
86
|
|
87
87
|
|
88
88
|
def build(self) -> None:
|
@@ -709,7 +709,7 @@ class WeChatDatabase(BaseWeChat):
|
|
709
709
|
conn.close()
|
710
710
|
|
711
711
|
|
712
|
-
def
|
712
|
+
def __to_contact_user(self) -> None:
|
713
713
|
"""
|
714
714
|
Add handler, write record to table `contact_user`.
|
715
715
|
"""
|
@@ -748,7 +748,7 @@ class WeChatDatabase(BaseWeChat):
|
|
748
748
|
self.rwechat.receiver.add_handler(handler_to_contact_user)
|
749
749
|
|
750
750
|
|
751
|
-
def
|
751
|
+
def __to_contact_room(self) -> None:
|
752
752
|
"""
|
753
753
|
Add handler, write record to table `contact_room`.
|
754
754
|
"""
|
@@ -832,7 +832,7 @@ class WeChatDatabase(BaseWeChat):
|
|
832
832
|
self.rwechat.receiver.add_handler(handler_to_contact_room)
|
833
833
|
|
834
834
|
|
835
|
-
def
|
835
|
+
def __to_contact_room_user(self) -> None:
|
836
836
|
"""
|
837
837
|
Add handler, write record to table `contact_room_user`.
|
838
838
|
"""
|
@@ -862,7 +862,7 @@ class WeChatDatabase(BaseWeChat):
|
|
862
862
|
self.rwechat.receiver.add_handler(handler_to_contact_room_user)
|
863
863
|
|
864
864
|
|
865
|
-
def
|
865
|
+
def __to_message_receive(self) -> None:
|
866
866
|
"""
|
867
867
|
Add handler, write record to table `message_receive`.
|
868
868
|
"""
|
@@ -913,7 +913,7 @@ class WeChatDatabase(BaseWeChat):
|
|
913
913
|
self.rwechat.receiver.add_handler(handler_to_message_receive)
|
914
914
|
|
915
915
|
|
916
|
-
def
|
916
|
+
def __to_message_send(self) -> None:
|
917
917
|
"""
|
918
918
|
Add handler, write record to table `message_send`.
|
919
919
|
"""
|
@@ -975,7 +975,7 @@ class WeChatDatabase(BaseWeChat):
|
|
975
975
|
self.rwechat.sender.add_handler(handler_to_message_send)
|
976
976
|
|
977
977
|
|
978
|
-
def
|
978
|
+
def __download_file(
|
979
979
|
self,
|
980
980
|
file_id: int
|
981
981
|
) -> tuple[str, str]:
|
@@ -1017,7 +1017,7 @@ class WeChatDatabase(BaseWeChat):
|
|
1017
1017
|
return save_path, file_name
|
1018
1018
|
|
1019
1019
|
|
1020
|
-
def
|
1020
|
+
def __from_message_send(self) -> None:
|
1021
1021
|
"""
|
1022
1022
|
Read record from table `message_send`, put send queue.
|
1023
1023
|
"""
|
@@ -1045,7 +1045,7 @@ class WeChatDatabase(BaseWeChat):
|
|
1045
1045
|
# Convert.
|
1046
1046
|
if result.empty:
|
1047
1047
|
return
|
1048
|
-
table = result.
|
1048
|
+
table = result.to_table()
|
1049
1049
|
|
1050
1050
|
# Update.
|
1051
1051
|
send_ids = [
|
@@ -1071,7 +1071,7 @@ class WeChatDatabase(BaseWeChat):
|
|
1071
1071
|
## Save file.
|
1072
1072
|
file_id = parameter.get('file_id')
|
1073
1073
|
if file_id is not None:
|
1074
|
-
file_path, file_name = self.
|
1074
|
+
file_path, file_name = self.__download_file(file_id)
|
1075
1075
|
parameter['path'] = file_path
|
1076
1076
|
parameter['file_name'] = file_name
|
1077
1077
|
|
@@ -1087,7 +1087,7 @@ class WeChatDatabase(BaseWeChat):
|
|
1087
1087
|
|
1088
1088
|
|
1089
1089
|
@wrap_thread
|
1090
|
-
def
|
1090
|
+
def __from_message_send_loop(self) -> None:
|
1091
1091
|
"""
|
1092
1092
|
In the thread, loop read record from table `message_send`, put send queue.
|
1093
1093
|
"""
|
@@ -1132,7 +1132,7 @@ class WeChatDatabase(BaseWeChat):
|
|
1132
1132
|
while True:
|
1133
1133
|
|
1134
1134
|
# Put.
|
1135
|
-
self.
|
1135
|
+
self.__from_message_send()
|
1136
1136
|
|
1137
1137
|
# Wait.
|
1138
1138
|
sleep(1)
|
reywechat/rlog.py
CHANGED
@@ -50,10 +50,10 @@ class WeChatLog(BaseWeChat):
|
|
50
50
|
self.rrlog_file = Log('WeChat.WeChatFile')
|
51
51
|
|
52
52
|
# Add handler.
|
53
|
-
self.
|
53
|
+
self.__add_handler()
|
54
54
|
|
55
55
|
|
56
|
-
def
|
56
|
+
def __add_handler(self) -> None:
|
57
57
|
"""
|
58
58
|
Add log handler.
|
59
59
|
"""
|
reywechat/rreceive.py
CHANGED
@@ -856,8 +856,8 @@ class WechatReceiver(BaseWeChat):
|
|
856
856
|
self.trigger = WeChatTrigger(self)
|
857
857
|
|
858
858
|
# Start.
|
859
|
-
self.
|
860
|
-
self.
|
859
|
+
self.__start_callback()
|
860
|
+
self.__start_receiver(self.max_receiver)
|
861
861
|
self.rwechat.client.hook_message(
|
862
862
|
'127.0.0.1',
|
863
863
|
self.rwechat.client.message_callback_port,
|
@@ -866,7 +866,7 @@ class WechatReceiver(BaseWeChat):
|
|
866
866
|
|
867
867
|
|
868
868
|
@wrap_thread
|
869
|
-
def
|
869
|
+
def __start_callback(self) -> None:
|
870
870
|
"""
|
871
871
|
Start callback socket.
|
872
872
|
"""
|
@@ -914,7 +914,7 @@ class WechatReceiver(BaseWeChat):
|
|
914
914
|
|
915
915
|
|
916
916
|
@wrap_thread
|
917
|
-
def
|
917
|
+
def __start_receiver(
|
918
918
|
self,
|
919
919
|
max_receiver: int
|
920
920
|
) -> None:
|
@@ -939,8 +939,8 @@ class WechatReceiver(BaseWeChat):
|
|
939
939
|
|
940
940
|
# Set parameter.
|
941
941
|
handlers = [
|
942
|
-
self.
|
943
|
-
self.
|
942
|
+
self.__handler_room,
|
943
|
+
self.__handler_file,
|
944
944
|
*self.handlers
|
945
945
|
]
|
946
946
|
|
@@ -1011,7 +1011,7 @@ class WechatReceiver(BaseWeChat):
|
|
1011
1011
|
self.handlers.append(handler)
|
1012
1012
|
|
1013
1013
|
|
1014
|
-
def
|
1014
|
+
def __handler_room(
|
1015
1015
|
self,
|
1016
1016
|
message: WeChatMessage
|
1017
1017
|
) -> None:
|
@@ -1036,7 +1036,7 @@ class WechatReceiver(BaseWeChat):
|
|
1036
1036
|
message.user = None
|
1037
1037
|
|
1038
1038
|
|
1039
|
-
def
|
1039
|
+
def __handler_file(
|
1040
1040
|
self,
|
1041
1041
|
message: WeChatMessage
|
1042
1042
|
) -> None:
|
reywechat/rsend.py
CHANGED
@@ -67,6 +67,8 @@ class WeChatSendParameter(BaseWeChat):
|
|
67
67
|
WeChat send parameters type.
|
68
68
|
"""
|
69
69
|
|
70
|
+
SendEnum = WeChatSendEnum
|
71
|
+
|
70
72
|
|
71
73
|
def __init__(
|
72
74
|
self,
|
@@ -115,7 +117,7 @@ class WeChatSender(BaseWeChat):
|
|
115
117
|
WeChatSendEnum : Send type enumeration.
|
116
118
|
"""
|
117
119
|
|
118
|
-
|
120
|
+
SendEnum = WeChatSendEnum
|
119
121
|
|
120
122
|
|
121
123
|
def __init__(
|
@@ -140,12 +142,12 @@ class WeChatSender(BaseWeChat):
|
|
140
142
|
self.started: bool | None = False
|
141
143
|
|
142
144
|
# Start.
|
143
|
-
self.
|
144
|
-
self.
|
145
|
+
self.__delete_cache_file()
|
146
|
+
self.__start_sender()
|
145
147
|
|
146
148
|
|
147
149
|
@wrap_thread
|
148
|
-
def
|
150
|
+
def __start_sender(self) -> None:
|
149
151
|
"""
|
150
152
|
Start sender, that will sequentially send message in the send queue.
|
151
153
|
"""
|
@@ -166,7 +168,7 @@ class WeChatSender(BaseWeChat):
|
|
166
168
|
## Send.
|
167
169
|
sendparam = self.queue.get()
|
168
170
|
try:
|
169
|
-
self.
|
171
|
+
self.__send(sendparam)
|
170
172
|
|
171
173
|
## Exception.
|
172
174
|
except:
|
@@ -205,7 +207,7 @@ class WeChatSender(BaseWeChat):
|
|
205
207
|
self.rwechat.log.log_send(sendparam)
|
206
208
|
|
207
209
|
|
208
|
-
def
|
210
|
+
def __delete_cache_file(self) -> None:
|
209
211
|
"""
|
210
212
|
Add handler, Delete cache file.
|
211
213
|
"""
|
@@ -234,7 +236,7 @@ class WeChatSender(BaseWeChat):
|
|
234
236
|
self.add_handler(handler_delete_cache_file)
|
235
237
|
|
236
238
|
|
237
|
-
def
|
239
|
+
def __send(
|
238
240
|
self,
|
239
241
|
sendparam: WeChatSendParameter
|
240
242
|
) -> None:
|
@@ -257,7 +259,7 @@ class WeChatSender(BaseWeChat):
|
|
257
259
|
|
258
260
|
## From file ID.
|
259
261
|
if (file_id := sendparam.params.get('file_id')) is not None:
|
260
|
-
sendparam.params['path'], sendparam.params['file_name'] = self.rwechat.database.
|
262
|
+
sendparam.params['path'], sendparam.params['file_name'] = self.rwechat.database.__download_file(file_id)
|
261
263
|
|
262
264
|
## Set file name.
|
263
265
|
if (
|
@@ -340,10 +342,10 @@ class WeChatSender(BaseWeChat):
|
|
340
342
|
throw(ValueError, sendparam.send_type)
|
341
343
|
|
342
344
|
# Wait.
|
343
|
-
self.
|
345
|
+
self.__wait(sendparam)
|
344
346
|
|
345
347
|
|
346
|
-
def
|
348
|
+
def __wait(
|
347
349
|
self,
|
348
350
|
sendparam: WeChatSendParameter
|
349
351
|
) -> None:
|
reywechat/rtrigger.py
CHANGED
@@ -48,13 +48,13 @@ class WeChatTrigger(BaseWeChat):
|
|
48
48
|
self.rules: list[TriggerRule] = []
|
49
49
|
|
50
50
|
# Add handler.
|
51
|
-
self.handler = self.
|
51
|
+
self.handler = self.__trigger_by_rule()
|
52
52
|
|
53
53
|
# Add trigger.
|
54
|
-
self.
|
54
|
+
self.__add_trigger_valid()
|
55
55
|
|
56
56
|
|
57
|
-
def
|
57
|
+
def __trigger_by_rule(self) -> Callable[[WeChatMessage], None]:
|
58
58
|
"""
|
59
59
|
Add handler, trigger message by rules.
|
60
60
|
|
@@ -169,7 +169,7 @@ class WeChatTrigger(BaseWeChat):
|
|
169
169
|
raise WeChatTriggerBreakExit
|
170
170
|
|
171
171
|
|
172
|
-
def
|
172
|
+
def __add_trigger_valid(self) -> None:
|
173
173
|
"""
|
174
174
|
Add trigger, trigger rule judge valid.
|
175
175
|
|
reywechat/rwechat.py
CHANGED
@@ -76,7 +76,7 @@ class WeChat(BaseWeChat):
|
|
76
76
|
|
77
77
|
# Create folder.
|
78
78
|
project_dir = project_dir or os_getcwd()
|
79
|
-
self.
|
79
|
+
self.__create_folder(project_dir)
|
80
80
|
|
81
81
|
# Set attribute.
|
82
82
|
|
@@ -118,7 +118,7 @@ class WeChat(BaseWeChat):
|
|
118
118
|
self.schedule_resume = self.schedule.resume
|
119
119
|
|
120
120
|
|
121
|
-
def
|
121
|
+
def __create_folder(
|
122
122
|
self,
|
123
123
|
project_dir: str
|
124
124
|
) -> None:
|
@@ -0,0 +1,16 @@
|
|
1
|
+
reywechat/__init__.py,sha256=CBcaezJsuYnBzunuzRoRwz-q_HDQq7XsGKtNxCWAQoY,488
|
2
|
+
reywechat/rall.py,sha256=KAHdmzvrmDel_ttvZKR0tkfg21Amm3sKMvGJDkNA14U,374
|
3
|
+
reywechat/rbase.py,sha256=0NunIUIXra2ML2N6odwMk5oENTE0r6VSBHWXUvgI-lc,1124
|
4
|
+
reywechat/rclient.py,sha256=pE5gZyjQA1gLJroSKiSwUWOruWkST5LDqTURQcOeCeI,22571
|
5
|
+
reywechat/rdb.py,sha256=W-gNO9r7vB3pBD8c_wq8iXwsMxfMpWRMQfIJi5an_aw,37700
|
6
|
+
reywechat/rlog.py,sha256=hauobai1dxNruvohhyXHXcop3iKU88ogDAb2VstD5HM,4750
|
7
|
+
reywechat/rreceive.py,sha256=VpvY_hTXx434ns-G5rfZyYOJa9O9ZNrylS_6qF0pAGg,31387
|
8
|
+
reywechat/rschedule.py,sha256=gO5TbSDiOavwlZF2AAqJAcUMJ6ME0257z5UdY9HjEGI,3730
|
9
|
+
reywechat/rsend.py,sha256=zwuvuSKg5iAGb_4EYsvQFw2Qs_5yHO1Ygbgxb7kj9NA,17946
|
10
|
+
reywechat/rtrigger.py,sha256=ZYHRzAWVSxHz9gvK5tZQmZpjOCtl6vAuU3HmU_Tqflw,4773
|
11
|
+
reywechat/rwechat.py,sha256=U8f8cNHJVYi1yOg0BdVM9GhYt6hcg6-SRw7itHkalvQ,5778
|
12
|
+
reywechat/data/client_api.dll,sha256=H9uj-x9Ztg0jFZK0yY6NsnyH5_119dQRFfoVVMidxRs,592384
|
13
|
+
reywechat-1.0.21.dist-info/METADATA,sha256=G0ztl46m8KQT27EDP6J83-lBeFoQ5di2HnIX_hTHJcA,1551
|
14
|
+
reywechat-1.0.21.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
15
|
+
reywechat-1.0.21.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
16
|
+
reywechat-1.0.21.dist-info/RECORD,,
|
@@ -1,16 +0,0 @@
|
|
1
|
-
reywechat/__init__.py,sha256=CBcaezJsuYnBzunuzRoRwz-q_HDQq7XsGKtNxCWAQoY,488
|
2
|
-
reywechat/rall.py,sha256=KAHdmzvrmDel_ttvZKR0tkfg21Amm3sKMvGJDkNA14U,374
|
3
|
-
reywechat/rbase.py,sha256=0NunIUIXra2ML2N6odwMk5oENTE0r6VSBHWXUvgI-lc,1124
|
4
|
-
reywechat/rclient.py,sha256=pE5gZyjQA1gLJroSKiSwUWOruWkST5LDqTURQcOeCeI,22571
|
5
|
-
reywechat/rdb.py,sha256=sWeI7-yq87TNWZyyrNABsYIrnALC4NklpTncGtIxdiI,37687
|
6
|
-
reywechat/rlog.py,sha256=cP1182Ax46ItSMHtq4OAAKBZvXnUcN5NXfDT_eZeHNo,4748
|
7
|
-
reywechat/rreceive.py,sha256=iUhR4MmdP_LCA8QTjvbQ8gui30_hfezSzhKCEAwud74,31379
|
8
|
-
reywechat/rschedule.py,sha256=gO5TbSDiOavwlZF2AAqJAcUMJ6ME0257z5UdY9HjEGI,3730
|
9
|
-
reywechat/rsend.py,sha256=N5QkrPy67EHQIsHYJd0MCJQNSdCtYwvY9LdRSiozbjE,17910
|
10
|
-
reywechat/rtrigger.py,sha256=5bj4_bSQn8dT2_uvFIbI0M4ngOxEvvWxi5WU6SBE4nU,4769
|
11
|
-
reywechat/rwechat.py,sha256=dwdnjamo9h5ecLgrl-cFGEk7diwu3YZRP2zQXXynRM0,5776
|
12
|
-
reywechat/data/client_api.dll,sha256=H9uj-x9Ztg0jFZK0yY6NsnyH5_119dQRFfoVVMidxRs,592384
|
13
|
-
reywechat-1.0.19.dist-info/METADATA,sha256=nIlF8iPQ_w36b9aTsUwVRRrg5GjSk36msxtS68IJkak,1551
|
14
|
-
reywechat-1.0.19.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
15
|
-
reywechat-1.0.19.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
16
|
-
reywechat-1.0.19.dist-info/RECORD,,
|
File without changes
|
File without changes
|