reywechat 1.0.20__py3-none-any.whl → 1.0.22__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/__init__.py +0 -0
- reywechat/data/client_api.dll +0 -0
- reywechat/rall.py +0 -0
- reywechat/rbase.py +0 -0
- reywechat/rclient.py +0 -0
- reywechat/rdb.py +16 -16
- reywechat/rlog.py +2 -2
- reywechat/rreceive.py +10 -13
- reywechat/rschedule.py +0 -0
- reywechat/rsend.py +14 -15
- reywechat/rtrigger.py +4 -4
- reywechat/rwechat.py +2 -2
- {reywechat-1.0.20.dist-info → reywechat-1.0.22.dist-info}/METADATA +1 -1
- reywechat-1.0.22.dist-info/RECORD +16 -0
- reywechat-1.0.20.dist-info/RECORD +0 -16
- {reywechat-1.0.20.dist-info → reywechat-1.0.22.dist-info}/WHEEL +0 -0
- {reywechat-1.0.20.dist-info → reywechat-1.0.22.dist-info}/licenses/LICENSE +0 -0
reywechat/__init__.py
CHANGED
File without changes
|
reywechat/data/client_api.dll
CHANGED
File without changes
|
reywechat/rall.py
CHANGED
File without changes
|
reywechat/rbase.py
CHANGED
File without changes
|
reywechat/rclient.py
CHANGED
File without changes
|
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
|
"""
|
@@ -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
|
|
@@ -961,11 +961,8 @@ class WechatReceiver(BaseWeChat):
|
|
961
961
|
|
962
962
|
## Loop.
|
963
963
|
for handler in handlers:
|
964
|
-
wrap_exc(
|
965
|
-
|
966
|
-
message,
|
967
|
-
_handler=handle_handler_exception
|
968
|
-
)
|
964
|
+
handler = wrap_exc(handler, handler=handle_handler_exception)
|
965
|
+
handler(message)
|
969
966
|
|
970
967
|
# Log.
|
971
968
|
self.rwechat.log.log_receive(message)
|
@@ -1011,7 +1008,7 @@ class WechatReceiver(BaseWeChat):
|
|
1011
1008
|
self.handlers.append(handler)
|
1012
1009
|
|
1013
1010
|
|
1014
|
-
def
|
1011
|
+
def __handler_room(
|
1015
1012
|
self,
|
1016
1013
|
message: WeChatMessage
|
1017
1014
|
) -> None:
|
@@ -1036,7 +1033,7 @@ class WechatReceiver(BaseWeChat):
|
|
1036
1033
|
message.user = None
|
1037
1034
|
|
1038
1035
|
|
1039
|
-
def
|
1036
|
+
def __handler_file(
|
1040
1037
|
self,
|
1041
1038
|
message: WeChatMessage
|
1042
1039
|
) -> None:
|
reywechat/rschedule.py
CHANGED
File without changes
|
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:
|
@@ -195,17 +197,14 @@ class WeChatSender(BaseWeChat):
|
|
195
197
|
|
196
198
|
### Loop.
|
197
199
|
for handler in self.handlers:
|
198
|
-
wrap_exc(
|
199
|
-
|
200
|
-
sendparam,
|
201
|
-
_handler=handle_handler_exception
|
202
|
-
)
|
200
|
+
handler = wrap_exc(handler, handler=handle_handler_exception)
|
201
|
+
handler(sendparam)
|
203
202
|
|
204
203
|
## Log.
|
205
204
|
self.rwechat.log.log_send(sendparam)
|
206
205
|
|
207
206
|
|
208
|
-
def
|
207
|
+
def __delete_cache_file(self) -> None:
|
209
208
|
"""
|
210
209
|
Add handler, Delete cache file.
|
211
210
|
"""
|
@@ -234,7 +233,7 @@ class WeChatSender(BaseWeChat):
|
|
234
233
|
self.add_handler(handler_delete_cache_file)
|
235
234
|
|
236
235
|
|
237
|
-
def
|
236
|
+
def __send(
|
238
237
|
self,
|
239
238
|
sendparam: WeChatSendParameter
|
240
239
|
) -> None:
|
@@ -257,7 +256,7 @@ class WeChatSender(BaseWeChat):
|
|
257
256
|
|
258
257
|
## From file ID.
|
259
258
|
if (file_id := sendparam.params.get('file_id')) is not None:
|
260
|
-
sendparam.params['path'], sendparam.params['file_name'] = self.rwechat.database.
|
259
|
+
sendparam.params['path'], sendparam.params['file_name'] = self.rwechat.database.__download_file(file_id)
|
261
260
|
|
262
261
|
## Set file name.
|
263
262
|
if (
|
@@ -340,10 +339,10 @@ class WeChatSender(BaseWeChat):
|
|
340
339
|
throw(ValueError, sendparam.send_type)
|
341
340
|
|
342
341
|
# Wait.
|
343
|
-
self.
|
342
|
+
self.__wait(sendparam)
|
344
343
|
|
345
344
|
|
346
|
-
def
|
345
|
+
def __wait(
|
347
346
|
self,
|
348
347
|
sendparam: WeChatSendParameter
|
349
348
|
) -> 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=UK3zu93_PYegq7atr7tUTxvKUewgHz5QcQTBWGLWCxk,31339
|
8
|
+
reywechat/rschedule.py,sha256=gO5TbSDiOavwlZF2AAqJAcUMJ6ME0257z5UdY9HjEGI,3730
|
9
|
+
reywechat/rsend.py,sha256=0A2uYDez9bPfwm88Z4FCCYtRprY9Et3KbdLf3qhRlKc,17898
|
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.22.dist-info/METADATA,sha256=9tmNr8QIGT3WZvn-WGI5dr9bhdGKdXnYY9F5zGS1bmw,1551
|
14
|
+
reywechat-1.0.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
15
|
+
reywechat-1.0.22.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
16
|
+
reywechat-1.0.22.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=3WDHyv2-Ph0rqyE7urh9K7bHyK1na5z2Kl-kzndYEGY,37684
|
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.20.dist-info/METADATA,sha256=gikqdgNgG7qziOyfLgSD5HoEtdjaC3SmhjUoRoGYJbw,1551
|
14
|
-
reywechat-1.0.20.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
15
|
-
reywechat-1.0.20.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
16
|
-
reywechat-1.0.20.dist-info/RECORD,,
|
File without changes
|
File without changes
|