reywechat 1.0.83__py3-none-any.whl → 1.0.85__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 +1 -1
- reywechat/rclient.py +19 -19
- reywechat/rdb.py +52 -70
- reywechat/rlog.py +3 -3
- reywechat/rreceive.py +4 -4
- reywechat/rsend.py +3 -3
- reywechat/rtrigger.py +1 -1
- reywechat/rwechat.py +1 -1
- {reywechat-1.0.83.dist-info → reywechat-1.0.85.dist-info}/METADATA +3 -3
- reywechat-1.0.85.dist-info/RECORD +16 -0
- reywechat-1.0.83.dist-info/RECORD +0 -16
- {reywechat-1.0.83.dist-info → reywechat-1.0.85.dist-info}/WHEEL +0 -0
- {reywechat-1.0.83.dist-info → reywechat-1.0.85.dist-info}/licenses/LICENSE +0 -0
reywechat/__init__.py
CHANGED
reywechat/rclient.py
CHANGED
@@ -212,7 +212,7 @@ class WeChatClient(WeChatBase):
|
|
212
212
|
Inject DLL file of start API into the WeChat client process.
|
213
213
|
"""
|
214
214
|
|
215
|
-
#
|
215
|
+
# Parameter.
|
216
216
|
dll_file_relpath = './data/client_api.dll'
|
217
217
|
dll_file_path = find_relpath(__file__, dll_file_relpath)
|
218
218
|
|
@@ -251,7 +251,7 @@ class WeChatClient(WeChatBase):
|
|
251
251
|
Client response content dictionary.
|
252
252
|
"""
|
253
253
|
|
254
|
-
#
|
254
|
+
# Parameter.
|
255
255
|
url = f'http://127.0.0.1:{self.client_api_port}/api/{api}'
|
256
256
|
data = data or {}
|
257
257
|
if type(success_code) == int:
|
@@ -299,7 +299,7 @@ class WeChatClient(WeChatBase):
|
|
299
299
|
Check result.
|
300
300
|
"""
|
301
301
|
|
302
|
-
#
|
302
|
+
# Parameter.
|
303
303
|
api = 'checkLogin'
|
304
304
|
|
305
305
|
# Request.
|
@@ -352,7 +352,7 @@ class WeChatClient(WeChatBase):
|
|
352
352
|
- `Key 'decrypt_key'`: Database decrypt key.
|
353
353
|
"""
|
354
354
|
|
355
|
-
#
|
355
|
+
# Parameter.
|
356
356
|
api = 'userInfo'
|
357
357
|
|
358
358
|
# Request.
|
@@ -402,7 +402,7 @@ class WeChatClient(WeChatBase):
|
|
402
402
|
timeout : Request timeout seconds.
|
403
403
|
"""
|
404
404
|
|
405
|
-
#
|
405
|
+
# Parameter.
|
406
406
|
api = 'hookSyncMsg'
|
407
407
|
port = str(port)
|
408
408
|
timeout_ms_str = str(int(timeout * 1000))
|
@@ -440,7 +440,7 @@ class WeChatClient(WeChatBase):
|
|
440
440
|
Unhook the message.
|
441
441
|
"""
|
442
442
|
|
443
|
-
#
|
443
|
+
# Parameter.
|
444
444
|
api = 'unhookSyncMsg'
|
445
445
|
|
446
446
|
# Request.
|
@@ -462,7 +462,7 @@ class WeChatClient(WeChatBase):
|
|
462
462
|
id\\_ : Message ID.
|
463
463
|
"""
|
464
464
|
|
465
|
-
#
|
465
|
+
# Parameter.
|
466
466
|
api = 'downloadAttach'
|
467
467
|
data = {'msgId': id_}
|
468
468
|
|
@@ -484,7 +484,7 @@ class WeChatClient(WeChatBase):
|
|
484
484
|
dir\\_ : Save directory.
|
485
485
|
"""
|
486
486
|
|
487
|
-
#
|
487
|
+
# Parameter.
|
488
488
|
api = 'getVoiceByMsgId'
|
489
489
|
dir_ = os_abspath(dir_)
|
490
490
|
data = {
|
@@ -517,7 +517,7 @@ class WeChatClient(WeChatBase):
|
|
517
517
|
- `Key 'name'`: User nickname or chat room name.
|
518
518
|
"""
|
519
519
|
|
520
|
-
#
|
520
|
+
# Parameter.
|
521
521
|
api = 'getContactList'
|
522
522
|
filter_names = {
|
523
523
|
'filehelper': '朋友推荐消息',
|
@@ -586,7 +586,7 @@ class WeChatClient(WeChatBase):
|
|
586
586
|
User nickname or chat room name.
|
587
587
|
"""
|
588
588
|
|
589
|
-
#
|
589
|
+
# Parameter.
|
590
590
|
api = 'getContactProfile'
|
591
591
|
data = {'wxid': id_}
|
592
592
|
|
@@ -619,7 +619,7 @@ class WeChatClient(WeChatBase):
|
|
619
619
|
List of chat room member user ID.
|
620
620
|
"""
|
621
621
|
|
622
|
-
#
|
622
|
+
# Parameter.
|
623
623
|
api = 'getMemberFromChatRoom'
|
624
624
|
data = {'chatRoomId': room_id}
|
625
625
|
|
@@ -683,7 +683,7 @@ class WeChatClient(WeChatBase):
|
|
683
683
|
if text == '':
|
684
684
|
throw(ValueError, text)
|
685
685
|
|
686
|
-
#
|
686
|
+
# Parameter.
|
687
687
|
api = 'sendTextMsg'
|
688
688
|
data = {
|
689
689
|
'wxid': receive_id,
|
@@ -717,7 +717,7 @@ class WeChatClient(WeChatBase):
|
|
717
717
|
if text == '':
|
718
718
|
throw(ValueError, text)
|
719
719
|
|
720
|
-
#
|
720
|
+
# Parameter.
|
721
721
|
api = 'sendAtText'
|
722
722
|
if type(user_id) != str:
|
723
723
|
user_id = ','.join(user_id)
|
@@ -745,7 +745,7 @@ class WeChatClient(WeChatBase):
|
|
745
745
|
path : Message file path.
|
746
746
|
"""
|
747
747
|
|
748
|
-
#
|
748
|
+
# Parameter.
|
749
749
|
api = 'sendFileMsg'
|
750
750
|
data = {
|
751
751
|
'wxid': receive_id,
|
@@ -770,7 +770,7 @@ class WeChatClient(WeChatBase):
|
|
770
770
|
path : Message image file path.
|
771
771
|
"""
|
772
772
|
|
773
|
-
#
|
773
|
+
# Parameter.
|
774
774
|
api = 'sendImagesMsg'
|
775
775
|
data = {
|
776
776
|
'wxid': receive_id,
|
@@ -795,7 +795,7 @@ class WeChatClient(WeChatBase):
|
|
795
795
|
path : Message emotion file path.
|
796
796
|
"""
|
797
797
|
|
798
|
-
#
|
798
|
+
# Parameter.
|
799
799
|
api = 'sendCustomEmotion'
|
800
800
|
data = {
|
801
801
|
'wxid': receive_id,
|
@@ -820,7 +820,7 @@ class WeChatClient(WeChatBase):
|
|
820
820
|
user_id : User ID of pat.
|
821
821
|
"""
|
822
822
|
|
823
|
-
#
|
823
|
+
# Parameter.
|
824
824
|
api = 'sendPatMsg'
|
825
825
|
data = {
|
826
826
|
'wxid': receive_id,
|
@@ -855,7 +855,7 @@ class WeChatClient(WeChatBase):
|
|
855
855
|
public_id : Control public account ID.
|
856
856
|
"""
|
857
857
|
|
858
|
-
#
|
858
|
+
# Parameter.
|
859
859
|
text = text or ''
|
860
860
|
image_url = image_url or ''
|
861
861
|
public_name = public_name or ''
|
@@ -889,7 +889,7 @@ class WeChatClient(WeChatBase):
|
|
889
889
|
message_id : Forward message ID.
|
890
890
|
"""
|
891
891
|
|
892
|
-
#
|
892
|
+
# Parameter.
|
893
893
|
api = 'sendImagesMsg'
|
894
894
|
data = {
|
895
895
|
'wxid': receive_id,
|
reywechat/rdb.py
CHANGED
@@ -183,21 +183,8 @@ class WeChatDatabase(WeChatBase):
|
|
183
183
|
"""
|
184
184
|
WeChat database type.
|
185
185
|
Can create database used `self.build_db` method.
|
186
|
-
|
187
|
-
Attributes
|
188
|
-
----------
|
189
|
-
db_names : Database table name mapping dictionary.
|
190
186
|
"""
|
191
187
|
|
192
|
-
db_names = {
|
193
|
-
'contact_user': 'contact_user',
|
194
|
-
'contact_room': 'contact_room',
|
195
|
-
'contact_room_user': 'contact_room_user',
|
196
|
-
'message_receive': 'message_receive',
|
197
|
-
'message_send': 'message_send',
|
198
|
-
'stats': 'stats'
|
199
|
-
}
|
200
|
-
|
201
188
|
|
202
189
|
def __init__(
|
203
190
|
self,
|
@@ -241,21 +228,17 @@ class WeChatDatabase(WeChatBase):
|
|
241
228
|
|
242
229
|
def build_db(self) -> None:
|
243
230
|
"""
|
244
|
-
Check and build database tables
|
231
|
+
Check and build database tables.
|
245
232
|
"""
|
246
233
|
|
247
234
|
# Check.
|
248
235
|
if self.db_wechat is None:
|
249
236
|
throw(ValueError, self.db_wechat)
|
250
237
|
|
251
|
-
#
|
238
|
+
# Parameter.
|
239
|
+
database = self.db_wechat.database
|
252
240
|
|
253
241
|
## Table.
|
254
|
-
DatabaseTableContactUser._set_name(self.db_names['contact_user'])
|
255
|
-
DatabaseTableContactRoom._set_name(self.db_names['contact_room'])
|
256
|
-
DatabaseTableContactRoomUser._set_name(self.db_names['contact_room_user'])
|
257
|
-
DatabaseTableMessageReceive._set_name(self.db_names['message_receive'])
|
258
|
-
DatabaseTableMessageSend._set_name(self.db_names['message_send'])
|
259
242
|
tables = [
|
260
243
|
DatabaseTableContactUser,
|
261
244
|
DatabaseTableContactRoom,
|
@@ -267,13 +250,13 @@ class WeChatDatabase(WeChatBase):
|
|
267
250
|
## View stats.
|
268
251
|
views_stats = [
|
269
252
|
{
|
270
|
-
'path':
|
253
|
+
'path': 'stats',
|
271
254
|
'items': [
|
272
255
|
{
|
273
256
|
'name': 'receive_count',
|
274
257
|
'select': (
|
275
258
|
'SELECT COUNT(1)\n'
|
276
|
-
f'FROM `{
|
259
|
+
f'FROM `{database}`.`message_receive`'
|
277
260
|
),
|
278
261
|
'comment': 'Message receive count.'
|
279
262
|
},
|
@@ -281,7 +264,7 @@ class WeChatDatabase(WeChatBase):
|
|
281
264
|
'name': 'send_count',
|
282
265
|
'select': (
|
283
266
|
'SELECT COUNT(1)\n'
|
284
|
-
f'FROM `{
|
267
|
+
f'FROM `{database}`.`message_send`\n'
|
285
268
|
'WHERE `status` = 2'
|
286
269
|
),
|
287
270
|
'comment': 'Message send count.'
|
@@ -290,7 +273,7 @@ class WeChatDatabase(WeChatBase):
|
|
290
273
|
'name': 'user_count',
|
291
274
|
'select': (
|
292
275
|
'SELECT COUNT(1)\n'
|
293
|
-
f'FROM `{
|
276
|
+
f'FROM `{database}`.`contact_user`'
|
294
277
|
),
|
295
278
|
'comment': 'Contact user count.'
|
296
279
|
},
|
@@ -298,7 +281,7 @@ class WeChatDatabase(WeChatBase):
|
|
298
281
|
'name': 'room_count',
|
299
282
|
'select': (
|
300
283
|
'SELECT COUNT(1)\n'
|
301
|
-
f'FROM `{
|
284
|
+
f'FROM `{database}`.`contact_room`'
|
302
285
|
),
|
303
286
|
'comment': 'Contact room count.'
|
304
287
|
},
|
@@ -306,7 +289,7 @@ class WeChatDatabase(WeChatBase):
|
|
306
289
|
'name': 'room_user_count',
|
307
290
|
'select': (
|
308
291
|
'SELECT COUNT(1)\n'
|
309
|
-
f'FROM `{
|
292
|
+
f'FROM `{database}`.`contact_room_user`'
|
310
293
|
),
|
311
294
|
'comment': 'Contact room user count.'
|
312
295
|
},
|
@@ -314,7 +297,7 @@ class WeChatDatabase(WeChatBase):
|
|
314
297
|
'name': 'past_day_receive_count',
|
315
298
|
'select': (
|
316
299
|
'SELECT COUNT(1)\n'
|
317
|
-
f'FROM `{
|
300
|
+
f'FROM `{database}`.`message_receive`'
|
318
301
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) = 0'
|
319
302
|
),
|
320
303
|
'comment': 'Message receive count in the past day.'
|
@@ -323,7 +306,7 @@ class WeChatDatabase(WeChatBase):
|
|
323
306
|
'name': 'past_day_send_count',
|
324
307
|
'select': (
|
325
308
|
'SELECT COUNT(1)\n'
|
326
|
-
f'FROM `{
|
309
|
+
f'FROM `{database}`.`message_send`'
|
327
310
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) = 0'
|
328
311
|
),
|
329
312
|
'comment': 'Message send count in the past day.'
|
@@ -332,7 +315,7 @@ class WeChatDatabase(WeChatBase):
|
|
332
315
|
'name': 'past_day_user_count',
|
333
316
|
'select': (
|
334
317
|
'SELECT COUNT(1)\n'
|
335
|
-
f'FROM `{
|
318
|
+
f'FROM `{database}`.`contact_user`'
|
336
319
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) = 0'
|
337
320
|
),
|
338
321
|
'comment': 'Contact user count in the past day.'
|
@@ -341,7 +324,7 @@ class WeChatDatabase(WeChatBase):
|
|
341
324
|
'name': 'past_day_room_count',
|
342
325
|
'select': (
|
343
326
|
'SELECT COUNT(1)\n'
|
344
|
-
f'FROM `{
|
327
|
+
f'FROM `{database}`.`contact_room`'
|
345
328
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) = 0'
|
346
329
|
),
|
347
330
|
'comment': 'Contact room count in the past day.'
|
@@ -350,7 +333,7 @@ class WeChatDatabase(WeChatBase):
|
|
350
333
|
'name': 'past_day_room_user_count',
|
351
334
|
'select': (
|
352
335
|
'SELECT COUNT(1)\n'
|
353
|
-
f'FROM `{
|
336
|
+
f'FROM `{database}`.`contact_room_user`'
|
354
337
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) = 0'
|
355
338
|
),
|
356
339
|
'comment': 'Contact room user count in the past day.'
|
@@ -359,7 +342,7 @@ class WeChatDatabase(WeChatBase):
|
|
359
342
|
'name': 'past_week_receive_count',
|
360
343
|
'select': (
|
361
344
|
'SELECT COUNT(1)\n'
|
362
|
-
f'FROM `{
|
345
|
+
f'FROM `{database}`.`message_receive`'
|
363
346
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 6'
|
364
347
|
),
|
365
348
|
'comment': 'Message receive count in the past week.'
|
@@ -368,7 +351,7 @@ class WeChatDatabase(WeChatBase):
|
|
368
351
|
'name': 'past_week_send_count',
|
369
352
|
'select': (
|
370
353
|
'SELECT COUNT(1)\n'
|
371
|
-
f'FROM `{
|
354
|
+
f'FROM `{database}`.`message_send`'
|
372
355
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 6'
|
373
356
|
),
|
374
357
|
'comment': 'Message send count in the past week.'
|
@@ -377,7 +360,7 @@ class WeChatDatabase(WeChatBase):
|
|
377
360
|
'name': 'past_week_user_count',
|
378
361
|
'select': (
|
379
362
|
'SELECT COUNT(1)\n'
|
380
|
-
f'FROM `{
|
363
|
+
f'FROM `{database}`.`contact_user`'
|
381
364
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 6'
|
382
365
|
),
|
383
366
|
'comment': 'Contact user count in the past week.'
|
@@ -386,7 +369,7 @@ class WeChatDatabase(WeChatBase):
|
|
386
369
|
'name': 'past_week_room_count',
|
387
370
|
'select': (
|
388
371
|
'SELECT COUNT(1)\n'
|
389
|
-
f'FROM `{
|
372
|
+
f'FROM `{database}`.`contact_room`'
|
390
373
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 6'
|
391
374
|
),
|
392
375
|
'comment': 'Contact room count in the past week.'
|
@@ -395,7 +378,7 @@ class WeChatDatabase(WeChatBase):
|
|
395
378
|
'name': 'past_week_room_user_count',
|
396
379
|
'select': (
|
397
380
|
'SELECT COUNT(1)\n'
|
398
|
-
f'FROM `{
|
381
|
+
f'FROM `{database}`.`contact_room_user`'
|
399
382
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 6'
|
400
383
|
),
|
401
384
|
'comment': 'Contact room user count in the past week.'
|
@@ -404,7 +387,7 @@ class WeChatDatabase(WeChatBase):
|
|
404
387
|
'name': 'past_month_receive_count',
|
405
388
|
'select': (
|
406
389
|
'SELECT COUNT(1)\n'
|
407
|
-
f'FROM `{
|
390
|
+
f'FROM `{database}`.`message_receive`'
|
408
391
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 29'
|
409
392
|
),
|
410
393
|
'comment': 'Message receive count in the past month.'
|
@@ -413,7 +396,7 @@ class WeChatDatabase(WeChatBase):
|
|
413
396
|
'name': 'past_month_send_count',
|
414
397
|
'select': (
|
415
398
|
'SELECT COUNT(1)\n'
|
416
|
-
f'FROM `{
|
399
|
+
f'FROM `{database}`.`message_send`'
|
417
400
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 29'
|
418
401
|
),
|
419
402
|
'comment': 'Message send count in the past month.'
|
@@ -422,7 +405,7 @@ class WeChatDatabase(WeChatBase):
|
|
422
405
|
'name': 'past_month_user_count',
|
423
406
|
'select': (
|
424
407
|
'SELECT COUNT(1)\n'
|
425
|
-
f'FROM `{
|
408
|
+
f'FROM `{database}`.`contact_user`'
|
426
409
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 29'
|
427
410
|
),
|
428
411
|
'comment': 'Contact user count in the past month.'
|
@@ -431,7 +414,7 @@ class WeChatDatabase(WeChatBase):
|
|
431
414
|
'name': 'past_month_room_count',
|
432
415
|
'select': (
|
433
416
|
'SELECT COUNT(1)\n'
|
434
|
-
f'FROM `{
|
417
|
+
f'FROM `{database}`.`contact_room`'
|
435
418
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 29'
|
436
419
|
),
|
437
420
|
'comment': 'Contact room count in the past month.'
|
@@ -440,7 +423,7 @@ class WeChatDatabase(WeChatBase):
|
|
440
423
|
'name': 'past_month_room_user_count',
|
441
424
|
'select': (
|
442
425
|
'SELECT COUNT(1)\n'
|
443
|
-
f'FROM `{
|
426
|
+
f'FROM `{database}`.`contact_room_user`'
|
444
427
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 29'
|
445
428
|
),
|
446
429
|
'comment': 'Contact room user count in the past month.'
|
@@ -449,7 +432,7 @@ class WeChatDatabase(WeChatBase):
|
|
449
432
|
'name': 'receive_last_time',
|
450
433
|
'select': (
|
451
434
|
'SELECT MAX(`message_time`)\n'
|
452
|
-
f'FROM `{
|
435
|
+
f'FROM `{database}`.`message_receive`'
|
453
436
|
),
|
454
437
|
'comment': 'Message last receive time.'
|
455
438
|
},
|
@@ -457,7 +440,7 @@ class WeChatDatabase(WeChatBase):
|
|
457
440
|
'name': 'send_last_time',
|
458
441
|
'select': (
|
459
442
|
'SELECT MAX(`update_time`)\n'
|
460
|
-
f'FROM `{
|
443
|
+
f'FROM `{database}`.`message_send`\n'
|
461
444
|
'WHERE `status` = 2'
|
462
445
|
),
|
463
446
|
'comment': 'Message last send time.'
|
@@ -487,7 +470,6 @@ class WeChatDatabase(WeChatBase):
|
|
487
470
|
|
488
471
|
# Get data.
|
489
472
|
contact_table = self.wechat.client.get_contact_table('user')
|
490
|
-
|
491
473
|
user_data = [
|
492
474
|
{
|
493
475
|
'user_id': row['id'],
|
@@ -506,7 +488,7 @@ class WeChatDatabase(WeChatBase):
|
|
506
488
|
## Insert.
|
507
489
|
if contact_table != []:
|
508
490
|
conn.execute.insert(
|
509
|
-
|
491
|
+
'contact_user',
|
510
492
|
user_data,
|
511
493
|
'update'
|
512
494
|
)
|
@@ -514,12 +496,12 @@ class WeChatDatabase(WeChatBase):
|
|
514
496
|
## Update.
|
515
497
|
if user_ids == []:
|
516
498
|
sql = (
|
517
|
-
f'UPDATE `{self.db_wechat.database}`.`
|
499
|
+
f'UPDATE `{self.db_wechat.database}`.`contact_user`\n'
|
518
500
|
'SET `contact` = 0'
|
519
501
|
)
|
520
502
|
else:
|
521
503
|
sql = (
|
522
|
-
f'UPDATE `{self.db_wechat.database}`.`
|
504
|
+
f'UPDATE `{self.db_wechat.database}`.`contact_user`\n'
|
523
505
|
'SET `contact` = 0\n'
|
524
506
|
'WHERE `user_id` NOT IN :user_ids'
|
525
507
|
)
|
@@ -561,7 +543,7 @@ class WeChatDatabase(WeChatBase):
|
|
561
543
|
## Insert.
|
562
544
|
if contact_table != []:
|
563
545
|
conn.execute.insert(
|
564
|
-
|
546
|
+
'contact_room',
|
565
547
|
room_data,
|
566
548
|
'update'
|
567
549
|
)
|
@@ -569,12 +551,12 @@ class WeChatDatabase(WeChatBase):
|
|
569
551
|
## Update.
|
570
552
|
if room_ids == []:
|
571
553
|
sql = (
|
572
|
-
f'UPDATE `{self.db_wechat.database}`.`
|
554
|
+
f'UPDATE `{self.db_wechat.database}`.`contact_room`\n'
|
573
555
|
'SET `contact` = 0'
|
574
556
|
)
|
575
557
|
else:
|
576
558
|
sql = (
|
577
|
-
f'UPDATE `{self.db_wechat.database}`.`
|
559
|
+
f'UPDATE `{self.db_wechat.database}`.`contact_room`\n'
|
578
560
|
'SET `contact` = 0\n'
|
579
561
|
'WHERE `room_id` NOT IN :room_ids'
|
580
562
|
)
|
@@ -638,7 +620,7 @@ class WeChatDatabase(WeChatBase):
|
|
638
620
|
## Insert.
|
639
621
|
if room_user_data != []:
|
640
622
|
conn.execute.insert(
|
641
|
-
|
623
|
+
'contact_room_user',
|
642
624
|
room_user_data,
|
643
625
|
'update'
|
644
626
|
)
|
@@ -646,18 +628,18 @@ class WeChatDatabase(WeChatBase):
|
|
646
628
|
## Update.
|
647
629
|
if room_user_ids == []:
|
648
630
|
sql = (
|
649
|
-
f'UPDATE `{self.db_wechat.database}`.`
|
631
|
+
f'UPDATE `{self.db_wechat.database}`.`contact_room_user`\n'
|
650
632
|
'SET `contact` = 0'
|
651
633
|
)
|
652
634
|
elif room_id is None:
|
653
635
|
sql = (
|
654
|
-
f'UPDATE `{self.db_wechat.database}`.`
|
636
|
+
f'UPDATE `{self.db_wechat.database}`.`contact_room_user`\n'
|
655
637
|
'SET `contact` = 0\n'
|
656
638
|
"WHERE CONCAT(`room_id`, ',', `user_id`) NOT IN :room_user_ids"
|
657
639
|
)
|
658
640
|
else:
|
659
641
|
sql = (
|
660
|
-
f'UPDATE `{self.db_wechat.database}`.`
|
642
|
+
f'UPDATE `{self.db_wechat.database}`.`contact_room_user`\n'
|
661
643
|
'SET `contact` = 0\n'
|
662
644
|
'WHERE (\n'
|
663
645
|
' `room_id` = :room_id\n'
|
@@ -705,7 +687,7 @@ class WeChatDatabase(WeChatBase):
|
|
705
687
|
|
706
688
|
## Insert.
|
707
689
|
self.db_wechat.execute.insert(
|
708
|
-
|
690
|
+
'contact_user',
|
709
691
|
data,
|
710
692
|
'update'
|
711
693
|
)
|
@@ -745,7 +727,7 @@ class WeChatDatabase(WeChatBase):
|
|
745
727
|
|
746
728
|
### 'contact_room'.
|
747
729
|
self.db_wechat.execute.insert(
|
748
|
-
|
730
|
+
'contact_room',
|
749
731
|
data,
|
750
732
|
'update'
|
751
733
|
)
|
@@ -767,7 +749,7 @@ class WeChatDatabase(WeChatBase):
|
|
767
749
|
|
768
750
|
## Update.
|
769
751
|
self.db_wechat.execute.update(
|
770
|
-
|
752
|
+
'contact_room',
|
771
753
|
data
|
772
754
|
)
|
773
755
|
|
@@ -789,7 +771,7 @@ class WeChatDatabase(WeChatBase):
|
|
789
771
|
|
790
772
|
## Update.
|
791
773
|
self.db_wechat.execute.update(
|
792
|
-
|
774
|
+
'contact_room',
|
793
775
|
data
|
794
776
|
)
|
795
777
|
|
@@ -869,7 +851,7 @@ class WeChatDatabase(WeChatBase):
|
|
869
851
|
|
870
852
|
# Insert.
|
871
853
|
self.db_wechat.execute.insert(
|
872
|
-
|
854
|
+
'message_receive',
|
873
855
|
data,
|
874
856
|
'ignore'
|
875
857
|
)
|
@@ -899,7 +881,7 @@ class WeChatDatabase(WeChatBase):
|
|
899
881
|
if send_params.status != WeChatSendStatusEnum.SENT:
|
900
882
|
return
|
901
883
|
|
902
|
-
#
|
884
|
+
# Parameter.
|
903
885
|
if send_params.exc_reports == []:
|
904
886
|
status = 2
|
905
887
|
else:
|
@@ -912,7 +894,7 @@ class WeChatDatabase(WeChatBase):
|
|
912
894
|
|
913
895
|
# Update.
|
914
896
|
self.db_wechat.execute.update(
|
915
|
-
|
897
|
+
'message_send',
|
916
898
|
data
|
917
899
|
)
|
918
900
|
|
@@ -966,13 +948,13 @@ class WeChatDatabase(WeChatBase):
|
|
966
948
|
Read record from table `message_send`, put send queue.
|
967
949
|
"""
|
968
950
|
|
969
|
-
#
|
951
|
+
# Parameter.
|
970
952
|
conn = self.db_wechat.connect()
|
971
953
|
|
972
954
|
# Read.
|
973
955
|
where = '`status` = 0'
|
974
956
|
result = conn.execute.select(
|
975
|
-
|
957
|
+
'message_send',
|
976
958
|
['send_id', 'type', 'receive_id', 'parameter', 'file_id'],
|
977
959
|
where,
|
978
960
|
order='`send_id`'
|
@@ -989,7 +971,7 @@ class WeChatDatabase(WeChatBase):
|
|
989
971
|
for row in table
|
990
972
|
]
|
991
973
|
sql = (
|
992
|
-
f'UPDATE `{self.db_wechat.database}`.`
|
974
|
+
f'UPDATE `{self.db_wechat.database}`.`message_send`\n'
|
993
975
|
'SET `status` = 1\n'
|
994
976
|
'WHERE `send_id` IN :send_ids'
|
995
977
|
)
|
@@ -1057,7 +1039,7 @@ class WeChatDatabase(WeChatBase):
|
|
1057
1039
|
## User.
|
1058
1040
|
if message.room is None:
|
1059
1041
|
result = message.receiver.wechat.db.db_wechat.execute.select(
|
1060
|
-
|
1042
|
+
'message_send',
|
1061
1043
|
['valid'],
|
1062
1044
|
'`user_id` = :user_id',
|
1063
1045
|
limit=1,
|
@@ -1067,7 +1049,7 @@ class WeChatDatabase(WeChatBase):
|
|
1067
1049
|
## Room.
|
1068
1050
|
elif message.user is None:
|
1069
1051
|
result = message.receiver.wechat.db.db_wechat.execute.select(
|
1070
|
-
|
1052
|
+
'message_send',
|
1071
1053
|
['valid'],
|
1072
1054
|
'`room_id` = :room_id',
|
1073
1055
|
limit=1,
|
@@ -1079,13 +1061,13 @@ class WeChatDatabase(WeChatBase):
|
|
1079
1061
|
sql = (
|
1080
1062
|
'SELECT (\n'
|
1081
1063
|
' SELECT `valid`\n'
|
1082
|
-
f' FROM `{self.db_wechat.database}`.`
|
1064
|
+
f' FROM `{self.db_wechat.database}`.`contact_room_user`\n'
|
1083
1065
|
' WHERE `room_id` = :room_id AND `user_id` = :user_id\n'
|
1084
1066
|
' LIMIT 1\n'
|
1085
1067
|
') AS `valid`\n'
|
1086
1068
|
'FROM (\n'
|
1087
1069
|
' SELECT `valid`\n'
|
1088
|
-
f' FROM `{self.db_wechat.database}`.`
|
1070
|
+
f' FROM `{self.db_wechat.database}`.`contact_room`\n'
|
1089
1071
|
' WHERE `room_id` = :room_id\n'
|
1090
1072
|
' LIMIT 1\n'
|
1091
1073
|
') AS `a`\n'
|
@@ -1112,7 +1094,7 @@ class WeChatDatabase(WeChatBase):
|
|
1112
1094
|
send_params : `WeChatSendParameters` instance.
|
1113
1095
|
"""
|
1114
1096
|
|
1115
|
-
#
|
1097
|
+
# Parameter.
|
1116
1098
|
params = send_params.params.copy()
|
1117
1099
|
data = {
|
1118
1100
|
'status': 0,
|
@@ -1144,6 +1126,6 @@ class WeChatDatabase(WeChatBase):
|
|
1144
1126
|
|
1145
1127
|
# Insert.
|
1146
1128
|
self.db_wechat.execute.insert(
|
1147
|
-
|
1129
|
+
'message_send',
|
1148
1130
|
data
|
1149
1131
|
)
|
reywechat/rlog.py
CHANGED
@@ -69,7 +69,7 @@ class WeChatLog(WeChatBase):
|
|
69
69
|
Folder instance.
|
70
70
|
"""
|
71
71
|
|
72
|
-
#
|
72
|
+
# Parameter.
|
73
73
|
dir_path = join_path(self.wechat.project_dir, 'log')
|
74
74
|
|
75
75
|
# Make.
|
@@ -84,7 +84,7 @@ class WeChatLog(WeChatBase):
|
|
84
84
|
Add log handler.
|
85
85
|
"""
|
86
86
|
|
87
|
-
#
|
87
|
+
# Parameter.
|
88
88
|
format_ = (
|
89
89
|
'%(format_time)s | '
|
90
90
|
'%(format_levelname)s | '
|
@@ -118,7 +118,7 @@ class WeChatLog(WeChatBase):
|
|
118
118
|
Result.
|
119
119
|
"""
|
120
120
|
|
121
|
-
#
|
121
|
+
# Parameter.
|
122
122
|
result = self.rrlog.print_colour
|
123
123
|
|
124
124
|
return result
|
reywechat/rreceive.py
CHANGED
@@ -169,7 +169,7 @@ class WeChatMessage(WeChatBase):
|
|
169
169
|
Parameters dictionary.
|
170
170
|
"""
|
171
171
|
|
172
|
-
#
|
172
|
+
# Parameter.
|
173
173
|
params: MessageParameters = {
|
174
174
|
'time': self.time,
|
175
175
|
'id': self.id,
|
@@ -1496,7 +1496,7 @@ class WeChatMessage(WeChatBase):
|
|
1496
1496
|
- When no match, then return `None`.
|
1497
1497
|
"""
|
1498
1498
|
|
1499
|
-
#
|
1499
|
+
# Parameter.
|
1500
1500
|
text = text or self.data
|
1501
1501
|
|
1502
1502
|
# Search.
|
@@ -1739,7 +1739,7 @@ class WechatReceiver(WeChatBase):
|
|
1739
1739
|
message : `WeChatMessage` instance.
|
1740
1740
|
"""
|
1741
1741
|
|
1742
|
-
#
|
1742
|
+
# Parameter.
|
1743
1743
|
handlers = [
|
1744
1744
|
self.__receiver_handler_file,
|
1745
1745
|
*self.handlers
|
@@ -1899,7 +1899,7 @@ class WechatReceiver(WeChatBase):
|
|
1899
1899
|
file_name = file_name or f'{download_file.md5}.{file_name_suffix}'
|
1900
1900
|
cache_path = self.wechat.cache.store(download_path, file_name, delete=True)
|
1901
1901
|
|
1902
|
-
#
|
1902
|
+
# Parameter.
|
1903
1903
|
cache_file = File(cache_path)
|
1904
1904
|
message_file: MessageParametersFile = {
|
1905
1905
|
'path': cache_path,
|
reywechat/rsend.py
CHANGED
@@ -521,7 +521,7 @@ class WeChatSender(WeChatBase):
|
|
521
521
|
params : Send parameters.
|
522
522
|
"""
|
523
523
|
|
524
|
-
#
|
524
|
+
# Parameter.
|
525
525
|
send_params = WeChatSendParameters(
|
526
526
|
self,
|
527
527
|
send_type,
|
@@ -578,7 +578,7 @@ class WeChatSender(WeChatBase):
|
|
578
578
|
Added text.
|
579
579
|
"""
|
580
580
|
|
581
|
-
#
|
581
|
+
# Parameter.
|
582
582
|
member_dict = self.wechat.client.get_room_member_dict(room_id)
|
583
583
|
login_id = self.wechat.client.login_info['id']
|
584
584
|
if login_id in member_dict:
|
@@ -617,7 +617,7 @@ class WeChatSender(WeChatBase):
|
|
617
617
|
Decorated function.
|
618
618
|
"""
|
619
619
|
|
620
|
-
#
|
620
|
+
# Parameter.
|
621
621
|
if type(receive_id) == str:
|
622
622
|
receive_ids = [receive_id]
|
623
623
|
else:
|
reywechat/rtrigger.py
CHANGED
@@ -135,7 +135,7 @@ class WeChatTrigger(WeChatBase):
|
|
135
135
|
is_reply : Whehter is reply function, allow call `WeChatMessage.reply`, can only reply once function.
|
136
136
|
"""
|
137
137
|
|
138
|
-
#
|
138
|
+
# Parameter.
|
139
139
|
rule: TriggerRule = {
|
140
140
|
'level': level,
|
141
141
|
'execute': execute,
|
reywechat/rwechat.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: reywechat
|
3
|
-
Version: 1.0.
|
4
|
-
Summary: WeChat method set.
|
3
|
+
Version: 1.0.85
|
4
|
+
Summary: WeChat client control method set.
|
5
5
|
Project-URL: homepage, https://github.com/reyxbo/reywechat/
|
6
6
|
Author-email: Rey <reyxbo@163.com>
|
7
7
|
License: Copyright 2025 ReyXBo
|
@@ -20,7 +20,7 @@ Description-Content-Type: text/markdown
|
|
20
20
|
|
21
21
|
# reywechat
|
22
22
|
|
23
|
-
>
|
23
|
+
> WeChat client control method set.
|
24
24
|
|
25
25
|
## Install
|
26
26
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
reywechat/__init__.py,sha256=oFL6LGNcE30nMTdOgNlU7x8cqcQyMqZORDra5PuxUrQ,491
|
2
|
+
reywechat/rall.py,sha256=5J_X-XMOyb1Vp1jyS9-oRFXGOtp2vRPX1g3tJot_Eck,371
|
3
|
+
reywechat/rbase.py,sha256=hbxn5spvcl_C_Bw8A9teulOXT9GMlxUw145_YbXIOzc,1124
|
4
|
+
reywechat/rcache.py,sha256=5FIa8UB3VsLHT_EXHHmFP62a5AeS22anJCJXC8t4tWw,908
|
5
|
+
reywechat/rclient.py,sha256=EaX6lciZhINg_3m76b7s29cZj5D4o1ASZlLzeVbcSlk,22579
|
6
|
+
reywechat/rdb.py,sha256=Bz7dvLM-5oBlHqx_mqw-nQMFlYm4gA646fBkNnDMYi8,37882
|
7
|
+
reywechat/rlog.py,sha256=sCTk1SSN3uP3zKzUN2aMZSA-GWrN_1g1Mmus2pVEp2M,5244
|
8
|
+
reywechat/rreceive.py,sha256=XAWgcI4txoxu0HITYcdsbfU6G6ENP1Edn9egXuFYEFQ,50944
|
9
|
+
reywechat/rsend.py,sha256=777RKnwuJk2A6bWT9TbzYaa2mjyqccNbO2dbj4mLMtA,20052
|
10
|
+
reywechat/rtrigger.py,sha256=rVSJhHcZXbSeyNZeMQbaOi8wGvzeEYv_hMAw4qnSWeQ,4982
|
11
|
+
reywechat/rwechat.py,sha256=wh04IT0s-QrGcnVe_fJxL3mYNLWcUuYgjDiupBB0ESk,4714
|
12
|
+
reywechat/data/client_api.dll,sha256=H9uj-x9Ztg0jFZK0yY6NsnyH5_119dQRFfoVVMidxRs,592384
|
13
|
+
reywechat-1.0.85.dist-info/METADATA,sha256=8vw8wu7rBzmy8RD4YZQBPA_DexDR4l5IqHOp7Bxtl5k,1575
|
14
|
+
reywechat-1.0.85.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
15
|
+
reywechat-1.0.85.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
16
|
+
reywechat-1.0.85.dist-info/RECORD,,
|
@@ -1,16 +0,0 @@
|
|
1
|
-
reywechat/__init__.py,sha256=FXc3XSiPLLmz9bgZdiYKxeWX-7VT9RqPc_EkXp3Kk0I,476
|
2
|
-
reywechat/rall.py,sha256=5J_X-XMOyb1Vp1jyS9-oRFXGOtp2vRPX1g3tJot_Eck,371
|
3
|
-
reywechat/rbase.py,sha256=hbxn5spvcl_C_Bw8A9teulOXT9GMlxUw145_YbXIOzc,1124
|
4
|
-
reywechat/rcache.py,sha256=5FIa8UB3VsLHT_EXHHmFP62a5AeS22anJCJXC8t4tWw,908
|
5
|
-
reywechat/rclient.py,sha256=j4ktgD2l1W9ktrTtfQfyIXCxc7KnT-gvqgy8-zRq8IU,22655
|
6
|
-
reywechat/rdb.py,sha256=EnU7e-o0ZjUbmNi7XVGwPoVH_tX5zd6EB7dDCCaliDc,39778
|
7
|
-
reywechat/rlog.py,sha256=JnzuSfQCKnvASPjZw9KrLTX9TjT79KLbciu8XeIA_88,5256
|
8
|
-
reywechat/rreceive.py,sha256=PjDdbF5tJh-bj2p_DxwYKXfk6dDkmv4s8W77Z1ODE1M,50960
|
9
|
-
reywechat/rsend.py,sha256=m3TvKlmBKK8KTsM85DeWIHbhVTRWbLMetBAU-zBYkAc,20064
|
10
|
-
reywechat/rtrigger.py,sha256=gDnokfFjw29Kz9qazxtb2clT2pBsuOJqIEErvg7L3hE,4986
|
11
|
-
reywechat/rwechat.py,sha256=xOxki5zFq145V-Ii3q8cFnJkCm8joCftgbbekGoCel0,4718
|
12
|
-
reywechat/data/client_api.dll,sha256=H9uj-x9Ztg0jFZK0yY6NsnyH5_119dQRFfoVVMidxRs,592384
|
13
|
-
reywechat-1.0.83.dist-info/METADATA,sha256=bkjrROWNWXrqzUX44CZQJnENqIWReqRYC5SZgAzirkQ,1551
|
14
|
-
reywechat-1.0.83.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
15
|
-
reywechat-1.0.83.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
16
|
-
reywechat-1.0.83.dist-info/RECORD,,
|
File without changes
|
File without changes
|