reywechat 1.0.68__py3-none-any.whl → 1.0.70__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/rcache.py CHANGED
@@ -9,7 +9,7 @@
9
9
  """
10
10
 
11
11
 
12
- from reykit.ros import FileCache, join_path
12
+ from reykit.ros import FileStore, join_path
13
13
 
14
14
  from .rbase import WeChatBase
15
15
  from .rwechat import WeChat
@@ -20,7 +20,7 @@ __all__ = (
20
20
  )
21
21
 
22
22
 
23
- class WeChatCache(WeChatBase, FileCache):
23
+ class WeChatCache(WeChatBase, FileStore):
24
24
  """
25
25
  WeChat file cache type.
26
26
  """
@@ -41,7 +41,7 @@ class WeChatCache(WeChatBase, FileCache):
41
41
  # Set attribute.
42
42
  self.wechat = wechat
43
43
  path = join_path(self.wechat.project_dir, 'cache')
44
- self.cache = FileCache(path)
44
+ self.cache = FileStore(path)
45
45
  self.folder = self.cache.folder
46
46
  self.index = self.cache.index
47
47
  self.store = self.cache.store
reywechat/rreceive.py CHANGED
@@ -212,15 +212,15 @@ class WeChatMessage(WeChatBase):
212
212
  """
213
213
 
214
214
  # Cache.
215
- if self._cache['_user_name'] is not None:
216
- return self._cache['_user_name']
215
+ if 'user_name' in self._cache:
216
+ return self._cache['user_name']
217
217
 
218
218
  # Set.
219
- self._cache['_user_name'] = self.receiver.wechat.client.get_contact_name(
219
+ self._cache['user_name'] = self.receiver.wechat.client.get_contact_name(
220
220
  self.user
221
221
  )
222
222
 
223
- return self._cache['_user_name']
223
+ return self._cache['user_name']
224
224
 
225
225
 
226
226
  @property
@@ -238,15 +238,15 @@ class WeChatMessage(WeChatBase):
238
238
  return
239
239
 
240
240
  # Cache.
241
- if self._cache['_room_name'] is not None:
242
- return self._cache['_room_name']
241
+ if 'room_name' in self._cache:
242
+ return self._cache['room_name']
243
243
 
244
244
  # Set.
245
- self._cache['_room_name'] = self.receiver.wechat.client.get_contact_name(
245
+ self._cache['room_name'] = self.receiver.wechat.client.get_contact_name(
246
246
  self.room
247
247
  )
248
248
 
249
- return self._cache['_room_name']
249
+ return self._cache['room_name']
250
250
 
251
251
 
252
252
  @property
@@ -260,16 +260,16 @@ class WeChatMessage(WeChatBase):
260
260
  """
261
261
 
262
262
  # Cache.
263
- if self._cache['_window_name'] is not None:
264
- return self._cache['_window_name']
263
+ if 'window_name' in self._cache:
264
+ return self._cache['window_name']
265
265
 
266
266
  # Set.
267
267
  if self.room is None:
268
- self._cache['_window_name'] = self.user_name
268
+ self._cache['window_name'] = self.user_name
269
269
  else:
270
- self._cache['_window_name'] = self.room_name
270
+ self._cache['window_name'] = self.room_name
271
271
 
272
- return self._cache['_window_name']
272
+ return self._cache['window_name']
273
273
 
274
274
 
275
275
  @property
@@ -283,111 +283,111 @@ class WeChatMessage(WeChatBase):
283
283
  """
284
284
 
285
285
  # Cache.
286
- if self._cache['_text'] is not None:
287
- return self._cache['_text']
286
+ if 'text' in self._cache:
287
+ return self._cache['text']
288
288
 
289
289
  # Get.
290
290
  match self.type:
291
291
 
292
292
  ## Text.
293
293
  case 1:
294
- self._cache['_text'] = self.data
294
+ self._cache['text'] = self.data
295
295
 
296
296
  ## Image.
297
297
  case 3:
298
- self._cache['_text'] = '[图片]'
298
+ self._cache['text'] = '[图片]'
299
299
 
300
300
  ## Voice.
301
301
  case 34:
302
302
  voice_len = round(self.voice_len, 1)
303
- self._cache['_text'] = f'[{voice_len}秒的语音]'
303
+ self._cache['text'] = f'[{voice_len}秒的语音]'
304
304
 
305
305
  ## New firend invitation.
306
306
  case 37:
307
- self._cache['_text'] = '[新好友邀请]'
307
+ self._cache['text'] = '[新好友邀请]'
308
308
 
309
309
  ## Business card.
310
310
  case 42:
311
- self._cache['_text'] = f'[分享名片"{self.business_card_name}"]'
311
+ self._cache['text'] = f'[分享名片"{self.business_card_name}"]'
312
312
 
313
313
  ## Video.
314
314
  case 43:
315
- self._cache['_text'] = f'[{self.video_len}秒的视频]'
315
+ self._cache['text'] = f'[{self.video_len}秒的视频]'
316
316
 
317
317
  ## Emoticon.
318
318
  case 47:
319
- self._cache['_text'] = f'[动画表情]'
319
+ self._cache['text'] = f'[动画表情]'
320
320
 
321
321
  ## Position.
322
322
  case 48:
323
- self._cache['_text'] = '[地图位置分享]'
323
+ self._cache['text'] = '[地图位置分享]'
324
324
 
325
325
  ## Share.
326
326
  case 49:
327
327
 
328
328
  ### Pure URL text.
329
329
  if self.share_type == 1:
330
- self._cache['_text'] = '[网址]'
330
+ self._cache['text'] = '[网址]'
331
331
  if self.share_params['title'] is not None:
332
332
  self._text += f' {self.share_params['title']}'
333
333
 
334
334
  ### File uploaded.
335
335
  elif self.is_file_uploaded:
336
- self._cache['_text'] = f'[文件"{self.file['name']}"发送完成]'
336
+ self._cache['text'] = f'[文件"{self.file['name']}"发送完成]'
337
337
 
338
338
  ### Initiate real time location.
339
339
  elif self.share_type == 17:
340
- self._cache['_text'] = '[开始实时地图位置分享]'
340
+ self._cache['text'] = '[开始实时地图位置分享]'
341
341
 
342
342
  ### Forword messages.
343
343
  elif self.is_forword:
344
344
  if self.share_params['title'] is None:
345
- self._cache['_text'] = '[转发聊天记录]'
345
+ self._cache['text'] = '[转发聊天记录]'
346
346
  else:
347
- self._cache['_text'] = f'[转发"{self.share_params['title']}"]'
347
+ self._cache['text'] = f'[转发"{self.share_params['title']}"]'
348
348
  if self.share_params['desc'] is not None:
349
349
  self._text += f' {self.share_params['desc']}'
350
350
 
351
351
  ### Mini program.
352
352
  elif self.is_mini_program:
353
353
  if self.share_params['name'] is None:
354
- self._cache['_text'] = '[小程序分享]'
354
+ self._cache['text'] = '[小程序分享]'
355
355
  else:
356
- self._cache['_text'] = f'[小程序"{self.share_params['name']}"分享]'
356
+ self._cache['text'] = f'[小程序"{self.share_params['name']}"分享]'
357
357
  if self.share_params['title'] is not None:
358
358
  self._text += f' {self.share_params['title']}'
359
359
 
360
360
  ### Video channel.
361
361
  elif self.share_type == 51:
362
362
  if self.share_params['name'] is None:
363
- self._cache['_text'] = '[视频号分享]'
363
+ self._cache['text'] = '[视频号分享]'
364
364
  else:
365
- self._cache['_text'] = f'[视频号"{self.share_params['name']}"分享]'
365
+ self._cache['text'] = f'[视频号"{self.share_params['name']}"分享]'
366
366
  if self.share_params['title'] is not None:
367
367
  self._text += f' {self.share_params['title']}'
368
368
 
369
369
  ### Quote.
370
370
  elif self.is_quote:
371
- self._cache['_text'] = f'[引用了"{self.quote_params['quote_user_name']}"的消息并发言] {self.quote_params['text']}'
371
+ self._cache['text'] = f'[引用了"{self.quote_params['quote_user_name']}"的消息并发言] {self.quote_params['text']}'
372
372
 
373
373
  ### Quote me.
374
374
  elif self.is_quote_me:
375
- self._cache['_text'] = f'[引用了你的消息并发言] {self.quote_params['text']}'
375
+ self._cache['text'] = f'[引用了你的消息并发言] {self.quote_params['text']}'
376
376
 
377
377
  ### File uploading.
378
378
  elif self.is_file_uploading:
379
- self._cache['_text'] = f'[文件"{self.file_name_uploading}"发送中]'
379
+ self._cache['text'] = f'[文件"{self.file_name_uploading}"发送中]'
380
380
 
381
381
  ### Transfer money.
382
382
  elif self.is_money:
383
- self._cache['_text'] = f'[转账{self.money_amount}¥]'
383
+ self._cache['text'] = f'[转账{self.money_amount}¥]'
384
384
 
385
385
  ### App.
386
386
  elif self.is_app:
387
387
  if self.share_params['name'] is None:
388
- self._cache['_text'] = '[APP分享]'
388
+ self._cache['text'] = '[APP分享]'
389
389
  else:
390
- self._cache['_text'] = f'[APP"{self.share_params['name']}"分享]'
390
+ self._cache['text'] = f'[APP"{self.share_params['name']}"分享]'
391
391
  if self.share_params["title"] is not None:
392
392
  self._text += f' {self.share_params["title"]}'
393
393
  if self.share_params["desc"] is not None:
@@ -396,9 +396,9 @@ class WeChatMessage(WeChatBase):
396
396
  ### Other.
397
397
  else:
398
398
  if self.share_params['name'] is None:
399
- self._cache['_text'] = '[分享]'
399
+ self._cache['text'] = '[分享]'
400
400
  else:
401
- self._cache['_text'] = f'["{self.share_params['name']}"分享]'
401
+ self._cache['text'] = f'["{self.share_params['name']}"分享]'
402
402
  if self.share_params["title"] is not None:
403
403
  self._text += f' {self.share_params["title"]}'
404
404
  if self.share_params["desc"] is not None:
@@ -406,32 +406,32 @@ class WeChatMessage(WeChatBase):
406
406
 
407
407
  ## Voice call or video call.
408
408
  case 50:
409
- self._cache['_text'] = '[视频或语音通话]'
409
+ self._cache['text'] = '[视频或语音通话]'
410
410
 
411
411
  ## System sync.
412
412
  case 51:
413
- self._cache['_text'] = '[系统同步]'
413
+ self._cache['text'] = '[系统同步]'
414
414
 
415
415
  ## Real time position.
416
416
  case 56:
417
- self._cache['_text'] = '[实时地图位置分享中]'
417
+ self._cache['text'] = '[实时地图位置分享中]'
418
418
 
419
419
  ## System.
420
420
  case 10000:
421
- self._cache['_text'] = '[系统信息]'
421
+ self._cache['text'] = '[系统信息]'
422
422
 
423
423
  ## Pat.
424
424
  case 10002 if self.is_pat:
425
- self._cache['_text'] = f'[{self.pat_text}]'
425
+ self._cache['text'] = f'[{self.pat_text}]'
426
426
 
427
427
  ## Recall.
428
428
  case 10002 if self.is_recall:
429
- self._cache['_text'] = '[撤回了一条消息]'
429
+ self._cache['text'] = '[撤回了一条消息]'
430
430
 
431
431
  case _:
432
- self._cache['_text'] = '[消息]'
432
+ self._cache['text'] = '[消息]'
433
433
 
434
- return self._cache['_text']
434
+ return self._cache['text']
435
435
 
436
436
 
437
437
  @property
@@ -445,8 +445,8 @@ class WeChatMessage(WeChatBase):
445
445
  """
446
446
 
447
447
  # Cache.
448
- if self._cache['_voice_len'] is not None:
449
- return self._cache['_voice_len']
448
+ if 'voice_len' in self._cache:
449
+ return self._cache['voice_len']
450
450
 
451
451
  # Check.
452
452
  if self.type != 34:
@@ -455,9 +455,9 @@ class WeChatMessage(WeChatBase):
455
455
  # Get.
456
456
  pattern = r'voicelength="(\d+)"'
457
457
  voice_len_us_str = search(pattern, self.data)
458
- self._cache['_voice_len'] = int(voice_len_us_str) / 1000
458
+ self._cache['voice_len'] = int(voice_len_us_str) / 1000
459
459
 
460
- return self._cache['_voice_len']
460
+ return self._cache['voice_len']
461
461
 
462
462
 
463
463
  @property
@@ -471,8 +471,8 @@ class WeChatMessage(WeChatBase):
471
471
  """
472
472
 
473
473
  # Cache.
474
- if self._cache['_video_len'] is not None:
475
- return self._cache['_video_len']
474
+ if 'video_len' in self._cache:
475
+ return self._cache['video_len']
476
476
 
477
477
  # Check.
478
478
  if self.type != 43:
@@ -481,9 +481,9 @@ class WeChatMessage(WeChatBase):
481
481
  # Get.
482
482
  pattern = r'playlength="(\d+)"'
483
483
  video_len_s_str = search(pattern, self.data)
484
- self._cache['_video_len'] = int(video_len_s_str)
484
+ self._cache['video_len'] = int(video_len_s_str)
485
485
 
486
- return self._cache['_video_len']
486
+ return self._cache['video_len']
487
487
 
488
488
 
489
489
  @property
@@ -497,8 +497,8 @@ class WeChatMessage(WeChatBase):
497
497
  """
498
498
 
499
499
  # Cache.
500
- if self._cache['_business_card_name'] is not None:
501
- return self._cache['_business_card_name']
500
+ if 'business_card_name' in self._cache:
501
+ return self._cache['business_card_name']
502
502
 
503
503
  # Check.
504
504
  if self.type != 42:
@@ -506,9 +506,9 @@ class WeChatMessage(WeChatBase):
506
506
 
507
507
  # Get.
508
508
  pattern = r'nickname="([^"]+)"'
509
- self._cache['_business_card_name'] = search(pattern, self.data)
509
+ self._cache['business_card_name'] = search(pattern, self.data)
510
510
 
511
- return self._cache['_business_card_name']
511
+ return self._cache['business_card_name']
512
512
 
513
513
 
514
514
  @property
@@ -522,8 +522,8 @@ class WeChatMessage(WeChatBase):
522
522
  """
523
523
 
524
524
  # Cache.
525
- if self._cache['_share_type'] is not None:
526
- return self._cache['_share_type']
525
+ if 'share_type' in self._cache:
526
+ return self._cache['share_type']
527
527
 
528
528
  # Check.
529
529
  if self.type != 49:
@@ -532,9 +532,9 @@ class WeChatMessage(WeChatBase):
532
532
  # Get.
533
533
  pattern = r'<type>(\d+)</type>'
534
534
  share_type_str: str = search(pattern, self.data)
535
- self._cache['_share_type'] = int(share_type_str)
535
+ self._cache['share_type'] = int(share_type_str)
536
536
 
537
- return self._cache['_share_type']
537
+ return self._cache['share_type']
538
538
 
539
539
 
540
540
  @property
@@ -548,8 +548,8 @@ class WeChatMessage(WeChatBase):
548
548
  """
549
549
 
550
550
  # Cache.
551
- if self._cache['_share_params'] is not None:
552
- return self._cache['_share_params']
551
+ if 'share_params' in self._cache:
552
+ return self._cache['share_params']
553
553
 
554
554
  # Check.
555
555
  if self.type != 49:
@@ -573,7 +573,7 @@ class WeChatMessage(WeChatBase):
573
573
  'url': url
574
574
  }
575
575
 
576
- return self._cache['_share_params']
576
+ return self._cache['share_params']
577
577
 
578
578
 
579
579
  @property
@@ -587,16 +587,16 @@ class WeChatMessage(WeChatBase):
587
587
  """
588
588
 
589
589
  # Cache.
590
- if self._cache['_is_file_uploading'] is not None:
591
- return self._cache['_is_file_uploading']
590
+ if 'is_file_uploading' in self._cache:
591
+ return self._cache['is_file_uploading']
592
592
 
593
593
  # Judge.
594
- self._cache['_is_file_uploading'] = (
594
+ self._cache['is_file_uploading'] = (
595
595
  self.type == 49
596
596
  and self.share_type == 74
597
597
  )
598
598
 
599
- return self._cache['_is_file_uploading']
599
+ return self._cache['is_file_uploading']
600
600
 
601
601
 
602
602
  @property
@@ -610,17 +610,17 @@ class WeChatMessage(WeChatBase):
610
610
  """
611
611
 
612
612
  # Cache.
613
- if self._cache['_file_name_uploading'] is not None:
614
- return self._cache['_file_name_uploading']
613
+ if 'file_name_uploading' in self._cache:
614
+ return self._cache['file_name_uploading']
615
615
 
616
616
  # Check.
617
617
  if not self.is_file_uploading:
618
- throw(AssertionError, self._is_file_uploading)
618
+ throw(AssertionError, self._cache['is_file_uploading'])
619
619
 
620
620
  # Get.
621
- self._file_name_uploading: str = search(r'<title><!\[CDATA\[([^<>]+)\]\]></title>', self.data)
621
+ self._cache['file_name_uploading'] = search(r'<title><!\[CDATA\[([^<>]+)\]\]></title>', self.data)
622
622
 
623
- return self._cache['_file_name_uploading']
623
+ return self._cache['file_name_uploading']
624
624
 
625
625
 
626
626
  @property
@@ -634,16 +634,16 @@ class WeChatMessage(WeChatBase):
634
634
  """
635
635
 
636
636
  # Cache.
637
- if self._cache['_is_file_uploaded'] is not None:
638
- return self._cache['_is_file_uploaded']
637
+ if 'is_file_uploaded' in self._cache:
638
+ return self._cache['is_file_uploaded']
639
639
 
640
640
  # Judge.
641
- self._cache['_is_file_uploading'] = (
641
+ self._cache['is_file_uploading'] = (
642
642
  self.type == 49
643
643
  and self.share_type == 6
644
644
  )
645
645
 
646
- return self._cache['_is_file_uploaded']
646
+ return self._cache['is_file_uploaded']
647
647
 
648
648
 
649
649
  @property
@@ -657,16 +657,16 @@ class WeChatMessage(WeChatBase):
657
657
  """
658
658
 
659
659
  # Cache.
660
- if self._cache['_is_forward'] is not None:
661
- return self._cache['_is_forward']
660
+ if 'is_forward' in self._cache:
661
+ return self._cache['is_forward']
662
662
 
663
663
  # Judge.
664
- self._cache['_is_forward'] = (
664
+ self._cache['is_forward'] = (
665
665
  self.type == 49
666
666
  and self.share_type in (19, 40)
667
667
  )
668
668
 
669
- return self._cache['_is_forward']
669
+ return self._cache['is_forward']
670
670
 
671
671
 
672
672
  @property
@@ -680,16 +680,16 @@ class WeChatMessage(WeChatBase):
680
680
  """
681
681
 
682
682
  # Cache.
683
- if self._cache['_is_mini_program'] is not None:
684
- return self._cache['_is_mini_program']
683
+ if 'is_mini_program' in self._cache:
684
+ return self._cache['is_mini_program']
685
685
 
686
686
  # Judge.
687
- self._cache['_is_mini_program'] = (
687
+ self._cache['is_mini_program'] = (
688
688
  self.type == 49
689
689
  and self.type == 33
690
690
  )
691
691
 
692
- return self._cache['_is_mini_program']
692
+ return self._cache['is_mini_program']
693
693
 
694
694
 
695
695
  @property
@@ -703,16 +703,16 @@ class WeChatMessage(WeChatBase):
703
703
  """
704
704
 
705
705
  # Cache.
706
- if self._cache['_is_quote'] is not None:
707
- return self._cache['_is_quote']
706
+ if 'is_quote' in self._cache:
707
+ return self._cache['is_quote']
708
708
 
709
709
  # Judge.
710
- self._cache['_is_quote'] = (
710
+ self._cache['is_quote'] = (
711
711
  self.type == 49
712
712
  and self.share_type == 57
713
713
  )
714
714
 
715
- return self._cache['_is_quote']
715
+ return self._cache['is_quote']
716
716
 
717
717
 
718
718
  @property
@@ -756,12 +756,12 @@ class WeChatMessage(WeChatBase):
756
756
  """
757
757
 
758
758
  # Cache.
759
- if self._cache['_quote_params'] is not None:
760
- return self._cache['_quote_params']
759
+ if 'quote_params' in self._cache:
760
+ return self._cache['quote_params']
761
761
 
762
762
  # Check.
763
763
  if not self.is_quote:
764
- throw(AssertionError, self._is_quote)
764
+ throw(AssertionError, self._cache['is_quote'])
765
765
 
766
766
  # Extract.
767
767
  pattern = '<title>([^<>]+)</title>'
@@ -791,7 +791,7 @@ class WeChatMessage(WeChatBase):
791
791
  'quote_data': quote_data
792
792
  }
793
793
 
794
- return self._cache['_quote_params']
794
+ return self._cache['quote_params']
795
795
 
796
796
 
797
797
  @property
@@ -805,16 +805,16 @@ class WeChatMessage(WeChatBase):
805
805
  """
806
806
 
807
807
  # Cache.
808
- if self._cache['_is_money'] is not None:
809
- return self._cache['_is_money']
808
+ if 'is_money' in self._cache:
809
+ return self._cache['is_money']
810
810
 
811
811
  # Judge.
812
- self._cache['_is_money'] = (
812
+ self._cache['is_money'] = (
813
813
  self.type == 49
814
814
  and self.share_type == 2000
815
815
  )
816
816
 
817
- return self._cache['_is_money']
817
+ return self._cache['is_money']
818
818
 
819
819
 
820
820
  @property
@@ -828,18 +828,18 @@ class WeChatMessage(WeChatBase):
828
828
  """
829
829
 
830
830
  # Cache.
831
- if self._cache['_money_amount'] is not None:
832
- return self._cache['_money_amount']
831
+ if 'money_amount' in self._cache:
832
+ return self._cache['money_amount']
833
833
 
834
834
  # Check.
835
835
  if not self.is_money:
836
- throw(AssertionError, self._is_money)
836
+ throw(AssertionError, self._cache['is_money'])
837
837
 
838
838
  # Judge.
839
839
  amount_str: str = search(r'<feedesc><!\[CDATA\[¥([\d.,]+)\]\]></feedesc>', self.data)
840
- self._cache['_money_amount'] = float(amount_str)
840
+ self._cache['money_amount'] = float(amount_str)
841
841
 
842
- return self._cache['_money_amount']
842
+ return self._cache['money_amount']
843
843
 
844
844
 
845
845
  @property
@@ -853,16 +853,16 @@ class WeChatMessage(WeChatBase):
853
853
  """
854
854
 
855
855
  # Cache.
856
- if self._cache['_is_app'] is not None:
857
- return self._cache['_is_app']
856
+ if 'is_app' in self._cache:
857
+ return self._cache['is_app']
858
858
 
859
859
  # Judge.
860
- self._cache['_is_app'] = (
860
+ self._cache['is_app'] = (
861
861
  self.type == 49
862
862
  and search('<appname>[^<>]+</appname>', self.data) is not None
863
863
  )
864
864
 
865
- return self._cache['_is_app']
865
+ return self._cache['is_app']
866
866
 
867
867
 
868
868
  @property
@@ -876,8 +876,8 @@ class WeChatMessage(WeChatBase):
876
876
  """
877
877
 
878
878
  # Cache.
879
- if self._cache['_at_names'] is not None:
880
- return self._cache['_at_names']
879
+ if 'at_names' in self._cache:
880
+ return self._cache['at_names']
881
881
 
882
882
  # Get.
883
883
  if self.type == 1:
@@ -885,9 +885,9 @@ class WeChatMessage(WeChatBase):
885
885
  elif self.is_quote:
886
886
  text = self.quote_params['text']
887
887
  pattern = r'@(\w+)\u2005'
888
- self._cache['_at_names'] = findall(pattern, text)
888
+ self._cache['at_names'] = findall(pattern, text)
889
889
 
890
- return self._cache['_at_names']
890
+ return self._cache['at_names']
891
891
 
892
892
 
893
893
  @property
@@ -901,13 +901,13 @@ class WeChatMessage(WeChatBase):
901
901
  """
902
902
 
903
903
  # Cache.
904
- if self._cache['_is_at'] is not None:
905
- return self._cache['_is_at']
904
+ if 'is_at' in self._cache:
905
+ return self._cache['is_at']
906
906
 
907
907
  # Judge.
908
- self._cache['_is_at'] = self.at_names != []
908
+ self._cache['is_at'] = self.at_names != []
909
909
 
910
- return self._cache['_is_at']
910
+ return self._cache['is_at']
911
911
 
912
912
 
913
913
  @property
@@ -921,13 +921,13 @@ class WeChatMessage(WeChatBase):
921
921
  """
922
922
 
923
923
  # Cache.
924
- if self._cache['_is_at_me'] is not None:
925
- return self._cache['_is_at_me']
924
+ if 'is_at_me' in self._cache:
925
+ return self._cache['is_at_me']
926
926
 
927
927
  # Judge.
928
- self._cache['_is_at_me'] = self.receiver.wechat.client.login_info['name'] in self.at_names
928
+ self._cache['is_at_me'] = self.receiver.wechat.client.login_info['name'] in self.at_names
929
929
 
930
- return self._cache['_is_at_me']
930
+ return self._cache['is_at_me']
931
931
 
932
932
 
933
933
  @property
@@ -941,11 +941,11 @@ class WeChatMessage(WeChatBase):
941
941
  """
942
942
 
943
943
  # Cache.
944
- if self._cache['_is_call'] is not None:
945
- return self._cache['_is_call']
944
+ if 'is_call' in self._cache:
945
+ return self._cache['is_call']
946
946
 
947
947
  # Judge.
948
- self._cache['_is_call'] = (
948
+ self._cache['is_call'] = (
949
949
 
950
950
  ## Last call.
951
951
  self.is_last_call
@@ -970,7 +970,7 @@ class WeChatMessage(WeChatBase):
970
970
 
971
971
  )
972
972
 
973
- return self._cache['_is_call']
973
+ return self._cache['is_call']
974
974
 
975
975
 
976
976
  @property
@@ -984,12 +984,12 @@ class WeChatMessage(WeChatBase):
984
984
  """
985
985
 
986
986
  # Cache.
987
- if self._cache['_call_text'] is not None:
988
- return self._cache['_call_text']
987
+ if 'call_text' in self._cache:
988
+ return self._cache['call_text']
989
989
 
990
990
  # Check.
991
991
  if not self.is_call:
992
- throw(AssertionError, self._is_call)
992
+ throw(AssertionError, self._cache['is_call'])
993
993
 
994
994
  # Get.
995
995
  text = self.text
@@ -1006,9 +1006,9 @@ class WeChatMessage(WeChatBase):
1006
1006
  if result is not None:
1007
1007
  text = result
1008
1008
 
1009
- self._cache['_call_text'] = text.strip()
1009
+ self._cache['call_text'] = text.strip()
1010
1010
 
1011
- return self._cache['_call_text']
1011
+ return self._cache['call_text']
1012
1012
 
1013
1013
 
1014
1014
  @property
@@ -1022,22 +1022,22 @@ class WeChatMessage(WeChatBase):
1022
1022
  """
1023
1023
 
1024
1024
  # Cache.
1025
- if self._cache['_is_call_next'] is not None:
1026
- return self._cache['_is_call_next']
1025
+ if 'is_call_next' in self._cache:
1026
+ return self._cache['is_call_next']
1027
1027
 
1028
1028
  # Judge.
1029
- self._cache['_is_call_next'] = (
1029
+ self._cache['is_call_next'] = (
1030
1030
  self.room is not None
1031
1031
  and self.is_call
1032
1032
  and self.call_text == ''
1033
1033
  )
1034
1034
 
1035
1035
  ### Mark.
1036
- if self._is_call_next:
1036
+ if self._cache['is_call_next']:
1037
1037
  call_next_mark_value = f'{self.user}_{self.room}'
1038
1038
  self.receiver.mark(call_next_mark_value, 'is_call_next')
1039
1039
 
1040
- return self._cache['_is_call_next']
1040
+ return self._cache['is_call_next']
1041
1041
 
1042
1042
 
1043
1043
  @property
@@ -1051,15 +1051,15 @@ class WeChatMessage(WeChatBase):
1051
1051
  """
1052
1052
 
1053
1053
  # Cache.
1054
- if self._cache['_is_last_call'] is not None:
1055
- return self._cache['_is_last_call']
1054
+ if 'is_last_call' in self._cache:
1055
+ return self._cache['is_last_call']
1056
1056
 
1057
1057
  # Judge.
1058
1058
  call_next_mark_value = f'{self.user}_{self.room}'
1059
- self._cache['_is_last_call'] = self.receiver.mark.is_marked(call_next_mark_value, 'is_call_next')
1059
+ self._cache['is_last_call'] = self.receiver.mark.is_marked(call_next_mark_value, 'is_call_next')
1060
1060
 
1061
1061
  # Mark.
1062
- if self._is_last_call:
1062
+ if self._cache['is_last_call']:
1063
1063
  call_next_mark_value = f'{self.user}_{self.room}'
1064
1064
  self.receiver.mark.remove(call_next_mark_value, 'is_call_next')
1065
1065
 
@@ -1077,16 +1077,16 @@ class WeChatMessage(WeChatBase):
1077
1077
  """
1078
1078
 
1079
1079
  # Cache.
1080
- if self._cache['_is_pat'] is not None:
1081
- return self._cache['_is_pat']
1080
+ if 'is_pat' in self._cache:
1081
+ return self._cache['is_pat']
1082
1082
 
1083
1083
  # Judge.
1084
- self._cache['_is_pat'] = (
1084
+ self._cache['is_pat'] = (
1085
1085
  self.type == 10002
1086
1086
  and self.data.startswith('<sysmsg type="pat">')
1087
1087
  )
1088
1088
 
1089
- return self._cache['_is_pat']
1089
+ return self._cache['is_pat']
1090
1090
 
1091
1091
 
1092
1092
  @property
@@ -1100,17 +1100,17 @@ class WeChatMessage(WeChatBase):
1100
1100
  """
1101
1101
 
1102
1102
  # Cache.
1103
- if self._cache['_is_pat_me'] is not None:
1104
- return self._cache['_is_pat_me']
1103
+ if 'is_pat_me' in self._cache:
1104
+ return self._cache['is_pat_me']
1105
1105
 
1106
1106
  # Judge.
1107
1107
  pattern = r'<template><!\[CDATA\["\$\{[\da-z_]+\}" 拍了拍我\]\]></template>'
1108
- self._cache['_is_pat_me'] = (
1108
+ self._cache['is_pat_me'] = (
1109
1109
  self.is_pat
1110
1110
  and search(pattern, self.data) is not None
1111
1111
  )
1112
1112
 
1113
- return self._cache['_is_pat_me']
1113
+ return self._cache['is_pat_me']
1114
1114
 
1115
1115
 
1116
1116
  @property
@@ -1124,12 +1124,12 @@ class WeChatMessage(WeChatBase):
1124
1124
  """
1125
1125
 
1126
1126
  # Cache.
1127
- if self._cache['_pat_text'] is not None:
1128
- return self._cache['_pat_text']
1127
+ if 'pat_text' in self._cache:
1128
+ return self._cache['pat_text']
1129
1129
 
1130
1130
  # Check.
1131
1131
  if not self.is_pat:
1132
- throw(AssertionError, self._is_pat)
1132
+ throw(AssertionError, self._cache['is_pat'])
1133
1133
 
1134
1134
  # Get.
1135
1135
 
@@ -1145,9 +1145,9 @@ class WeChatMessage(WeChatBase):
1145
1145
  old_text = '${%s}' % user_id
1146
1146
  text = text.replace(old_text, user_name)
1147
1147
 
1148
- self._cache['_pat_text'] = text
1148
+ self._cache['pat_text'] = text
1149
1149
 
1150
- return self._cache['_pat_text']
1150
+ return self._cache['pat_text']
1151
1151
 
1152
1152
 
1153
1153
  @property
@@ -1161,16 +1161,16 @@ class WeChatMessage(WeChatBase):
1161
1161
  """
1162
1162
 
1163
1163
  # Cache.
1164
- if self._cache['_is_recall'] is not None:
1165
- return self._cache['_is_recall']
1164
+ if 'is_recall' in self._cache:
1165
+ return self._cache['is_recall']
1166
1166
 
1167
1167
  # Judge.
1168
- self._cache['_is_recall'] = (
1168
+ self._cache['is_recall'] = (
1169
1169
  self.type == 10002
1170
1170
  and self.data.startswith('<sysmsg type="revokemsg">')
1171
1171
  )
1172
1172
 
1173
- return self._cache['_is_recall']
1173
+ return self._cache['is_recall']
1174
1174
 
1175
1175
 
1176
1176
  @property
@@ -1184,11 +1184,11 @@ class WeChatMessage(WeChatBase):
1184
1184
  """
1185
1185
 
1186
1186
  # Cache.
1187
- if self._cache['_is_new_user'] is not None:
1188
- return self._cache['_is_new_user']
1187
+ if 'is_new_user' in self._cache:
1188
+ return self._cache['is_new_user']
1189
1189
 
1190
1190
  # Judge.
1191
- self._cache['_is_new_user'] = (
1191
+ self._cache['is_new_user'] = (
1192
1192
  self.type == 10000
1193
1193
  and (
1194
1194
  self.data == '以上是打招呼的内容'
@@ -1197,7 +1197,7 @@ class WeChatMessage(WeChatBase):
1197
1197
  )
1198
1198
  )
1199
1199
 
1200
- return self._cache['_is_new_user']
1200
+ return self._cache['is_new_user']
1201
1201
 
1202
1202
 
1203
1203
  @property
@@ -1211,11 +1211,11 @@ class WeChatMessage(WeChatBase):
1211
1211
  """
1212
1212
 
1213
1213
  # Cache.
1214
- if self._cache['_is_new_room'] is not None:
1215
- return self._cache['_is_new_room']
1214
+ if 'is_new_room' in self._cache:
1215
+ return self._cache['is_new_room']
1216
1216
 
1217
1217
  # Judge.
1218
- self._cache['_is_new_room'] = (
1218
+ self._cache['is_new_room'] = (
1219
1219
  self.type == 10000
1220
1220
  and (
1221
1221
  '邀请你和' in self.data[:38]
@@ -1223,7 +1223,7 @@ class WeChatMessage(WeChatBase):
1223
1223
  )
1224
1224
  )
1225
1225
 
1226
- return self._cache['_is_new_room']
1226
+ return self._cache['is_new_room']
1227
1227
 
1228
1228
 
1229
1229
  @property
@@ -1237,17 +1237,17 @@ class WeChatMessage(WeChatBase):
1237
1237
  """
1238
1238
 
1239
1239
  # Cache.
1240
- if self._cache['_is_new_room_user'] is not None:
1241
- return self._cache['_is_new_room_user']
1240
+ if 'is_new_room_user' in self._cache:
1241
+ return self._cache['is_new_room_user']
1242
1242
 
1243
1243
  # Judge.
1244
- self._cache['_is_new_room_user'] = (
1244
+ self._cache['is_new_room_user'] = (
1245
1245
  self.type == 10000
1246
1246
  and '邀请"' in self.data[:37]
1247
1247
  and self.data.endswith('"加入了群聊')
1248
1248
  )
1249
1249
 
1250
- return self._cache['_is_new_room_user']
1250
+ return self._cache['is_new_room_user']
1251
1251
 
1252
1252
 
1253
1253
  @property
@@ -1261,13 +1261,13 @@ class WeChatMessage(WeChatBase):
1261
1261
  """
1262
1262
 
1263
1263
  # Extracted.
1264
- if self._cache['_new_room_user_name'] is not None:
1265
- return self._cache['_new_room_user_name']
1264
+ if 'new_room_user_name' in self._cache:
1265
+ return self._cache['new_room_user_name']
1266
1266
 
1267
1267
  # Extract.
1268
1268
  pattern = '邀请"(.+?)"加入了群聊'
1269
1269
  result: str = search(pattern, self.data)
1270
- self._cache['_new_room_user_name'] = result
1270
+ self._cache['new_room_user_name'] = result
1271
1271
 
1272
1272
  return result
1273
1273
 
@@ -1283,16 +1283,16 @@ class WeChatMessage(WeChatBase):
1283
1283
  """
1284
1284
 
1285
1285
  # Cache.
1286
- if self._cache['_is_change_room_name'] is not None:
1287
- return self._cache['_is_change_room_name']
1286
+ if 'is_change_room_name' in self._cache:
1287
+ return self._cache['is_change_room_name']
1288
1288
 
1289
1289
  # Judge.
1290
- self._cache['_is_change_room_name'] = (
1290
+ self._cache['is_change_room_name'] = (
1291
1291
  self.type == 10000
1292
1292
  and '修改群名为“' in self.data[:40]
1293
1293
  )
1294
1294
 
1295
- return self._cache['_is_change_room_name']
1295
+ return self._cache['is_change_room_name']
1296
1296
 
1297
1297
 
1298
1298
  @property
@@ -1306,15 +1306,15 @@ class WeChatMessage(WeChatBase):
1306
1306
  """
1307
1307
 
1308
1308
  # Extracted.
1309
- if self._cache['_change_room_name'] is not None:
1310
- return self._cache['_change_room_name']
1309
+ if 'change_room_name' in self._cache:
1310
+ return self._cache['change_room_name']
1311
1311
 
1312
1312
  # Extract.
1313
1313
  pattern = '修改群名为“(.+?)”'
1314
1314
  result: str = search(pattern, self.data)
1315
- self._cache['_change_room_name'] = result
1315
+ self._cache['change_room_name'] = result
1316
1316
 
1317
- return self._cache['_change_room_name']
1317
+ return self._cache['change_room_name']
1318
1318
 
1319
1319
 
1320
1320
  @property
@@ -1328,17 +1328,17 @@ class WeChatMessage(WeChatBase):
1328
1328
  """
1329
1329
 
1330
1330
  # Cache.
1331
- if self._cache['_is_kick_out_room'] is not None:
1332
- return self._cache['_is_kick_out_room']
1331
+ if 'is_kick_out_room' in self._cache:
1332
+ return self._cache['is_kick_out_room']
1333
1333
 
1334
1334
  # Judge.
1335
- self._cache['_is_kick_out_room'] = (
1335
+ self._cache['is_kick_out_room'] = (
1336
1336
  self.type == 10000
1337
1337
  and self.data.startswith('你被')
1338
1338
  and self.data.endswith('移出群聊')
1339
1339
  )
1340
1340
 
1341
- return self._cache['_is_kick_out_room']
1341
+ return self._cache['is_kick_out_room']
1342
1342
 
1343
1343
 
1344
1344
  @property
@@ -1352,17 +1352,17 @@ class WeChatMessage(WeChatBase):
1352
1352
  """
1353
1353
 
1354
1354
  # Cache.
1355
- if self._cache['_is_dissolve_room'] is not None:
1356
- return self._cache['_is_dissolve_room']
1355
+ if 'is_dissolve_room' in self._cache:
1356
+ return self._cache['is_dissolve_room']
1357
1357
 
1358
1358
  # Judge.
1359
- self._cache['_is_dissolve_room'] = (
1359
+ self._cache['is_dissolve_room'] = (
1360
1360
  self.type == 10000
1361
1361
  and self.data.startswith('群主')
1362
1362
  and self.data.endswith('已解散该群聊')
1363
1363
  )
1364
1364
 
1365
- return self._cache['_is_dissolve_room']
1365
+ return self._cache['is_dissolve_room']
1366
1366
 
1367
1367
 
1368
1368
  @property
@@ -1376,17 +1376,17 @@ class WeChatMessage(WeChatBase):
1376
1376
  """
1377
1377
 
1378
1378
  # Cache.
1379
- if self._cache['_image_qrcodes'] is not None:
1380
- return self._cache['_image_qrcodes']
1379
+ if 'image_qrcodes' in self._cache:
1380
+ return self._cache['image_qrcodes']
1381
1381
 
1382
1382
  # Check.
1383
1383
  if self.type != 3:
1384
1384
  throw(AssertionError, self.type)
1385
1385
 
1386
1386
  # Extract.
1387
- self._cache['_image_qrcodes'] = decode_qrcode(self.file['path'])
1387
+ self._cache['image_qrcodes'] = decode_qrcode(self.file['path'])
1388
1388
 
1389
- return self._cache['_image_qrcodes']
1389
+ return self._cache['image_qrcodes']
1390
1390
 
1391
1391
 
1392
1392
  @property
@@ -1400,16 +1400,16 @@ class WeChatMessage(WeChatBase):
1400
1400
  """
1401
1401
 
1402
1402
  # Cache.
1403
- if self._cache['_is_html'] is not None:
1404
- return self._cache['_is_html']
1403
+ if 'is_html' in self._cache:
1404
+ return self._cache['is_html']
1405
1405
 
1406
1406
  # Judge.
1407
- self._cache['_is_html'] = (
1407
+ self._cache['is_html'] = (
1408
1408
  self.type != 1
1409
1409
  and search(r'^<(\S+)[ >].*</\1>\s*', self.data) is not None
1410
1410
  )
1411
1411
 
1412
- return self._cache['_is_html']
1412
+ return self._cache['is_html']
1413
1413
 
1414
1414
 
1415
1415
  @property
@@ -1423,17 +1423,17 @@ class WeChatMessage(WeChatBase):
1423
1423
  """
1424
1424
 
1425
1425
  # Cache.
1426
- if self._cache['_is_xml'] is not None:
1427
- return self._cache['_is_xml']
1426
+ if 'is_xml' in self._cache:
1427
+ return self._cache['is_xml']
1428
1428
 
1429
1429
  # Judge.
1430
- self._cache['_is_xml'] = (
1430
+ self._cache['is_xml'] = (
1431
1431
  self.type != 1
1432
1432
  and self.data.startswith('<?xml ')
1433
1433
  and self.data.rstrip().endswith('</msg>')
1434
1434
  )
1435
1435
 
1436
- return self._cache['_is_xml']
1436
+ return self._cache['is_xml']
1437
1437
 
1438
1438
 
1439
1439
  @property
@@ -1449,13 +1449,13 @@ class WeChatMessage(WeChatBase):
1449
1449
  """
1450
1450
 
1451
1451
  # Extracted.
1452
- if self._cache['_valid'] is not None:
1453
- return self._cache['_valid']
1452
+ if 'valid' in self._cache:
1453
+ return self._cache['valid']
1454
1454
 
1455
1455
  # Judge.
1456
- self._cache['_valid'] = self.receiver.wechat.database.is_valid(self)
1456
+ self._cache['valid'] = self.receiver.wechat.database.is_valid(self)
1457
1457
 
1458
- return self._cache['_valid']
1458
+ return self._cache['valid']
1459
1459
 
1460
1460
 
1461
1461
  def check_call(self) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reywechat
3
- Version: 1.0.68
3
+ Version: 1.0.70
4
4
  Summary: WeChat method set.
5
5
  Project-URL: homepage, https://github.com/reyxbo/reywechat/
6
6
  Author-email: Rey <reyxbo@163.com>
@@ -1,16 +1,16 @@
1
1
  reywechat/__init__.py,sha256=FXc3XSiPLLmz9bgZdiYKxeWX-7VT9RqPc_EkXp3Kk0I,476
2
2
  reywechat/rall.py,sha256=5J_X-XMOyb1Vp1jyS9-oRFXGOtp2vRPX1g3tJot_Eck,371
3
3
  reywechat/rbase.py,sha256=hbxn5spvcl_C_Bw8A9teulOXT9GMlxUw145_YbXIOzc,1124
4
- reywechat/rcache.py,sha256=7UsHHfgFOgxuSqlTSAO6CprgUUOeBCXYus0kxmRBQxk,908
4
+ reywechat/rcache.py,sha256=5FIa8UB3VsLHT_EXHHmFP62a5AeS22anJCJXC8t4tWw,908
5
5
  reywechat/rclient.py,sha256=lc1CPle9h08mwP8NlJN0ybzcNJxtpV0ma6q6cz1RIxk,22518
6
6
  reywechat/rdb.py,sha256=R3ZySPsLM5g0hChFBMxtG9MRZCZ433aMYa_LuggKK90,51010
7
7
  reywechat/rlog.py,sha256=TSA-_5pwlq0sUND2cnLDqXvdmAdMAkC7tXIz3WfJ7Xw,5259
8
- reywechat/rreceive.py,sha256=wIzxcKrt1apGG-qlc4otrTfTz8AG6V2RmCWW4ADQ-74,51109
8
+ reywechat/rreceive.py,sha256=zT5mhXolmpaSkBuG-jL-Jt5ATVMwpyrSF3U5FamdyzU,50561
9
9
  reywechat/rsend.py,sha256=BB42r24x37V1tb27HLhnB_2tILv-DW26F9QbhqiNes8,20101
10
10
  reywechat/rtrigger.py,sha256=WdOQwobPdGPyyE9J-qtQFPd60713T0aWqKk02PLdCRE,4966
11
11
  reywechat/rwechat.py,sha256=g0pbprMPv_qWb_lGFrPDAWsJO4vPSIgFLkw0Y28CZUo,4751
12
12
  reywechat/data/client_api.dll,sha256=H9uj-x9Ztg0jFZK0yY6NsnyH5_119dQRFfoVVMidxRs,592384
13
- reywechat-1.0.68.dist-info/METADATA,sha256=e0wI7pWszpHxEiTwWUs9mwMZxez7Dg2wkBc4tTWK9Aw,1551
14
- reywechat-1.0.68.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- reywechat-1.0.68.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
16
- reywechat-1.0.68.dist-info/RECORD,,
13
+ reywechat-1.0.70.dist-info/METADATA,sha256=sr5yfSW75aD1S2oqSoWTUGEbmfUy_mg1mWDW1UfF8rI,1551
14
+ reywechat-1.0.70.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
+ reywechat-1.0.70.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
16
+ reywechat-1.0.70.dist-info/RECORD,,