reywechat 1.0.41__py3-none-any.whl → 1.0.43__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 +15 -4
- reywechat/rsend.py +13 -33
- reywechat/rwechat.py +1 -2
- {reywechat-1.0.41.dist-info → reywechat-1.0.43.dist-info}/METADATA +1 -1
- {reywechat-1.0.41.dist-info → reywechat-1.0.43.dist-info}/RECORD +7 -7
- {reywechat-1.0.41.dist-info → reywechat-1.0.43.dist-info}/WHEEL +0 -0
- {reywechat-1.0.41.dist-info → reywechat-1.0.43.dist-info}/licenses/LICENSE +0 -0
reywechat/rdb.py
CHANGED
@@ -941,8 +941,8 @@ class WeChatDatabase(BaseWeChat):
|
|
941
941
|
"""
|
942
942
|
|
943
943
|
# Check.
|
944
|
-
if send_param.status
|
945
|
-
|
944
|
+
if send_param.status != send_param.StatusEnum.SENT:
|
945
|
+
return
|
946
946
|
|
947
947
|
# Handle parameter.
|
948
948
|
if send_param.exc_reports == []:
|
@@ -1054,7 +1054,7 @@ class WeChatDatabase(BaseWeChat):
|
|
1054
1054
|
# Send.
|
1055
1055
|
for row in table:
|
1056
1056
|
send_id, type_, receive_id, parameter, file_id = row.values()
|
1057
|
-
send_type = WeChatSendTypeEnum
|
1057
|
+
send_type = WeChatSendTypeEnum(type_)
|
1058
1058
|
parameter: dict = json_loads(parameter)
|
1059
1059
|
|
1060
1060
|
## File.
|
@@ -1070,6 +1070,7 @@ class WeChatDatabase(BaseWeChat):
|
|
1070
1070
|
send_id,
|
1071
1071
|
**parameter
|
1072
1072
|
)
|
1073
|
+
send_param.status = send_param.StatusEnum.WAIT
|
1073
1074
|
self.wechat.sender.queue.put(send_param)
|
1074
1075
|
|
1075
1076
|
# Commit.
|
@@ -1117,6 +1118,16 @@ class WeChatDatabase(BaseWeChat):
|
|
1117
1118
|
)
|
1118
1119
|
|
1119
1120
|
## Room.
|
1121
|
+
elif message.user is None:
|
1122
|
+
result = message.receiver.wechat.database.database_wechat.execute_select(
|
1123
|
+
(self.db_names['wechat'], self.db_names['wechat.contact_room']),
|
1124
|
+
['valid'],
|
1125
|
+
'`room_id` = :room_id',
|
1126
|
+
limit=1,
|
1127
|
+
room_id=message.room
|
1128
|
+
)
|
1129
|
+
|
1130
|
+
## Room user.
|
1120
1131
|
else:
|
1121
1132
|
sql = (
|
1122
1133
|
'SELECT (\n'
|
@@ -1145,7 +1156,7 @@ class WeChatDatabase(BaseWeChat):
|
|
1145
1156
|
return judge
|
1146
1157
|
|
1147
1158
|
|
1148
|
-
def
|
1159
|
+
def _insert_send(self, send_param: WeChatSendParameter) -> None:
|
1149
1160
|
"""
|
1150
1161
|
Insert into `wechat.message_send` table of database, wait send.
|
1151
1162
|
|
reywechat/rsend.py
CHANGED
@@ -65,14 +65,14 @@ class WeChatSendStatusEnum(BaseWeChat, IntEnum):
|
|
65
65
|
|
66
66
|
Attributes
|
67
67
|
----------
|
68
|
-
INIT :
|
69
|
-
|
70
|
-
|
68
|
+
INIT : After initialization, before inserting into database queue.
|
69
|
+
WAIT : After get from database queue, before sending.
|
70
|
+
SENT : After sending.
|
71
71
|
"""
|
72
72
|
|
73
73
|
INIT = 0
|
74
|
-
|
75
|
-
|
74
|
+
WAIT = 1
|
75
|
+
SENT = 2
|
76
76
|
|
77
77
|
|
78
78
|
class WeChatSendParameter(BaseWeChat):
|
@@ -193,28 +193,7 @@ class WeChatSendParameter(BaseWeChat):
|
|
193
193
|
self.send_id = send_id
|
194
194
|
self.params = params
|
195
195
|
self.exc_reports: list[str] = []
|
196
|
-
self.
|
197
|
-
|
198
|
-
|
199
|
-
@property
|
200
|
-
def status(self) -> WeChatSendStatusEnum:
|
201
|
-
"""
|
202
|
-
WeChat send status.
|
203
|
-
|
204
|
-
Returns
|
205
|
-
-------
|
206
|
-
WeChat send parameters status enumeration.
|
207
|
-
"""
|
208
|
-
|
209
|
-
# Get.
|
210
|
-
if self.send_id is None:
|
211
|
-
status = WeChatSendStatusEnum.INIT
|
212
|
-
elif self.sent:
|
213
|
-
status = WeChatSendStatusEnum.AFTER
|
214
|
-
else:
|
215
|
-
status = WeChatSendStatusEnum.BEFORE
|
216
|
-
|
217
|
-
return status
|
196
|
+
self.status: WeChatSendStatusEnum
|
218
197
|
|
219
198
|
|
220
199
|
class WeChatSender(BaseWeChat):
|
@@ -289,7 +268,7 @@ class WeChatSender(BaseWeChat):
|
|
289
268
|
# Save.
|
290
269
|
send_param.exc_reports.append(exc_report)
|
291
270
|
|
292
|
-
send_param.
|
271
|
+
send_param.status = send_param.StatusEnum.SENT
|
293
272
|
|
294
273
|
## Handler.
|
295
274
|
for handler in self.handlers:
|
@@ -470,10 +449,11 @@ class WeChatSender(BaseWeChat):
|
|
470
449
|
# Handle parameter.
|
471
450
|
send_param = WeChatSendParameter(
|
472
451
|
self,
|
473
|
-
|
452
|
+
send_type,
|
474
453
|
receive_id,
|
475
454
|
**params
|
476
455
|
)
|
456
|
+
send_param.status = send_param.StatusEnum.INIT
|
477
457
|
handle_handler_exception = lambda exc_report, *_: send_param.exc_reports.append(exc_report)
|
478
458
|
|
479
459
|
# Handler.
|
@@ -482,7 +462,7 @@ class WeChatSender(BaseWeChat):
|
|
482
462
|
handler(send_param)
|
483
463
|
|
484
464
|
# Insert.
|
485
|
-
self.wechat.database.
|
465
|
+
self.wechat.database._insert_send(send_param)
|
486
466
|
|
487
467
|
|
488
468
|
def add_handler(
|
@@ -491,9 +471,9 @@ class WeChatSender(BaseWeChat):
|
|
491
471
|
) -> None:
|
492
472
|
"""
|
493
473
|
Add send handler function.
|
494
|
-
Call at the
|
495
|
-
Call at the
|
496
|
-
Call at the
|
474
|
+
Call at the after initialization, before inserting into database queue.
|
475
|
+
Call at the after get from database queue, before sending.
|
476
|
+
Call at the after sending.
|
497
477
|
Can be use `WeChatSendParameter.status` judge status.
|
498
478
|
|
499
479
|
Parameters
|
reywechat/rwechat.py
CHANGED
@@ -103,13 +103,12 @@ class WeChat(BaseWeChat):
|
|
103
103
|
|
104
104
|
## Send.
|
105
105
|
self.send_add_handler = self.sender.add_handler
|
106
|
-
self.send = self.
|
106
|
+
self.send = self.sender.send
|
107
107
|
self.send_start = self.sender.start
|
108
108
|
self.send_stop = self.sender.stop
|
109
109
|
self.wrap_try_send = self.sender.wrap_try_send
|
110
110
|
|
111
111
|
## Database.
|
112
|
-
self.send = self.sender.send = self.database.insert_send
|
113
112
|
self.database_build = self.database.build
|
114
113
|
|
115
114
|
## Schedule.
|
@@ -3,15 +3,15 @@ reywechat/rall.py,sha256=zEW-mLL2uP8aT2_foCMFGmMi_3RCrGl8qutnSVkmY1E,397
|
|
3
3
|
reywechat/rbase.py,sha256=0NunIUIXra2ML2N6odwMk5oENTE0r6VSBHWXUvgI-lc,1124
|
4
4
|
reywechat/rcache.py,sha256=Hh_HE-t_KUMlrz4gEFPh1AjmhnrSgH520IFJPumWb7A,908
|
5
5
|
reywechat/rclient.py,sha256=MEvQB3pHb5ORukKbKntalRtFcKIOP9BGtDsMt5ihQfM,22524
|
6
|
-
reywechat/rdb.py,sha256=
|
6
|
+
reywechat/rdb.py,sha256=akIQsx4CZIt-H6kXWn2vpUYjo5MgD8MluzBMnSdmLaM,40051
|
7
7
|
reywechat/rlog.py,sha256=IJL2WquiOYfB9iEai9xjojkuxPxiRHkdzZ5vCeaSA98,5261
|
8
8
|
reywechat/rreceive.py,sha256=40l3n_d1BcT2EhxIYOlOnzrSQkJ8WDI_qPvJcU7CSQU,35018
|
9
9
|
reywechat/rschedule.py,sha256=X9kreXdClTeItJHmNPJNqb_lct-BiLCyusMQxsj5hWU,1865
|
10
|
-
reywechat/rsend.py,sha256=
|
10
|
+
reywechat/rsend.py,sha256=iRxC7iURbF4UHbNkG2ITT1YUOCpAZ4amjeEkBQY1Bos,17624
|
11
11
|
reywechat/rtrigger.py,sha256=n8kUNovh62r7crlXrp33uaKvbILT-wcfvUqeyGt7YhM,4956
|
12
|
-
reywechat/rwechat.py,sha256=
|
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.43.dist-info/METADATA,sha256=vhJ7vHjnzo4fsufh05pCzdS3NCkw7P122ad3_JnOD70,1551
|
15
|
+
reywechat-1.0.43.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
16
|
+
reywechat-1.0.43.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
17
|
+
reywechat-1.0.43.dist-info/RECORD,,
|
File without changes
|
File without changes
|