reywechat 1.0.67__py3-none-any.whl → 1.0.68__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/rreceive.py +200 -245
- {reywechat-1.0.67.dist-info → reywechat-1.0.68.dist-info}/METADATA +1 -1
- {reywechat-1.0.67.dist-info → reywechat-1.0.68.dist-info}/RECORD +5 -5
- {reywechat-1.0.67.dist-info → reywechat-1.0.68.dist-info}/WHEEL +0 -0
- {reywechat-1.0.67.dist-info → reywechat-1.0.68.dist-info}/licenses/LICENSE +0 -0
reywechat/rreceive.py
CHANGED
@@ -154,52 +154,7 @@ class WeChatMessage(WeChatBase):
|
|
154
154
|
self.user = self.window
|
155
155
|
|
156
156
|
## Cache.
|
157
|
-
self.
|
158
|
-
self._room_name: str | None = None
|
159
|
-
self._window_name: str | None = None
|
160
|
-
self._text: str | None = None
|
161
|
-
self._voice_len: float | None = None
|
162
|
-
self._video_len: int | None = None
|
163
|
-
self._business_card_name: str | None = None
|
164
|
-
|
165
|
-
### Share.
|
166
|
-
self._share_type: int | None = None
|
167
|
-
self._share_params: MessageShareParameters | None = None
|
168
|
-
self._is_file_uploading: bool | None = None
|
169
|
-
self._file_name_uploading: str | None = None
|
170
|
-
self._is_file_uploaded: bool | None = None
|
171
|
-
self._is_forward: bool | None = None
|
172
|
-
self._is_mini_program: bool | None = None
|
173
|
-
self._is_quote: bool | None = None
|
174
|
-
self._is_quote_me: bool | None = None
|
175
|
-
self._quote_params: dict[Literal['text', 'quote_id', 'quote_type', 'quote_user', 'quote_user_name', 'quote_data'], str] | None = None
|
176
|
-
self._is_money: bool | None = None
|
177
|
-
self._money_amount: float | None = None
|
178
|
-
self._is_app: bool | None = None
|
179
|
-
|
180
|
-
self._at_names: list[str] = None
|
181
|
-
self._is_at: bool | None = None
|
182
|
-
self._is_at_me: bool | None = None
|
183
|
-
self._is_call: bool | None = None
|
184
|
-
self._call_text: str | None = None
|
185
|
-
self._is_call_next: bool | None = None
|
186
|
-
self._is_last_call: bool | None = None
|
187
|
-
self._is_pat: bool | None = None
|
188
|
-
self._is_pat_me: bool | None = None
|
189
|
-
self._pat_text: str | None = None
|
190
|
-
self._is_recall: bool | None = None
|
191
|
-
self._is_new_user: bool | None = None
|
192
|
-
self._is_new_room: bool | None = None
|
193
|
-
self._is_new_room_user: bool | None = None
|
194
|
-
self._new_room_user_name: str | None = None
|
195
|
-
self._is_change_room_name: bool | None = None
|
196
|
-
self._change_room_name: str | None = None
|
197
|
-
self._is_kick_out_room: bool | None = None
|
198
|
-
self._is_dissolve_room: bool | None = None
|
199
|
-
self._image_qrcodes: list[str] | None = None
|
200
|
-
self._is_html: bool | None = None
|
201
|
-
self._is_xml: bool | None = None
|
202
|
-
self._valid: bool | None = None
|
157
|
+
self._cache: dict[str, Any] = {}
|
203
158
|
|
204
159
|
## Update call next.
|
205
160
|
self.is_call_next
|
@@ -257,15 +212,15 @@ class WeChatMessage(WeChatBase):
|
|
257
212
|
"""
|
258
213
|
|
259
214
|
# Cache.
|
260
|
-
if self._user_name is not None:
|
261
|
-
return self._user_name
|
215
|
+
if self._cache['_user_name'] is not None:
|
216
|
+
return self._cache['_user_name']
|
262
217
|
|
263
218
|
# Set.
|
264
|
-
self._user_name = self.receiver.wechat.client.get_contact_name(
|
219
|
+
self._cache['_user_name'] = self.receiver.wechat.client.get_contact_name(
|
265
220
|
self.user
|
266
221
|
)
|
267
222
|
|
268
|
-
return self._user_name
|
223
|
+
return self._cache['_user_name']
|
269
224
|
|
270
225
|
|
271
226
|
@property
|
@@ -283,15 +238,15 @@ class WeChatMessage(WeChatBase):
|
|
283
238
|
return
|
284
239
|
|
285
240
|
# Cache.
|
286
|
-
if self._room_name is not None:
|
287
|
-
return self._room_name
|
241
|
+
if self._cache['_room_name'] is not None:
|
242
|
+
return self._cache['_room_name']
|
288
243
|
|
289
244
|
# Set.
|
290
|
-
self._room_name = self.receiver.wechat.client.get_contact_name(
|
245
|
+
self._cache['_room_name'] = self.receiver.wechat.client.get_contact_name(
|
291
246
|
self.room
|
292
247
|
)
|
293
248
|
|
294
|
-
return self._room_name
|
249
|
+
return self._cache['_room_name']
|
295
250
|
|
296
251
|
|
297
252
|
@property
|
@@ -305,16 +260,16 @@ class WeChatMessage(WeChatBase):
|
|
305
260
|
"""
|
306
261
|
|
307
262
|
# Cache.
|
308
|
-
if self._window_name is not None:
|
309
|
-
return self._window_name
|
263
|
+
if self._cache['_window_name'] is not None:
|
264
|
+
return self._cache['_window_name']
|
310
265
|
|
311
266
|
# Set.
|
312
267
|
if self.room is None:
|
313
|
-
self._window_name = self.user_name
|
268
|
+
self._cache['_window_name'] = self.user_name
|
314
269
|
else:
|
315
|
-
self._window_name = self.room_name
|
270
|
+
self._cache['_window_name'] = self.room_name
|
316
271
|
|
317
|
-
return self._window_name
|
272
|
+
return self._cache['_window_name']
|
318
273
|
|
319
274
|
|
320
275
|
@property
|
@@ -328,111 +283,111 @@ class WeChatMessage(WeChatBase):
|
|
328
283
|
"""
|
329
284
|
|
330
285
|
# Cache.
|
331
|
-
if self._text is not None:
|
332
|
-
return self._text
|
286
|
+
if self._cache['_text'] is not None:
|
287
|
+
return self._cache['_text']
|
333
288
|
|
334
289
|
# Get.
|
335
290
|
match self.type:
|
336
291
|
|
337
292
|
## Text.
|
338
293
|
case 1:
|
339
|
-
self._text = self.data
|
294
|
+
self._cache['_text'] = self.data
|
340
295
|
|
341
296
|
## Image.
|
342
297
|
case 3:
|
343
|
-
self._text = '[图片]'
|
298
|
+
self._cache['_text'] = '[图片]'
|
344
299
|
|
345
300
|
## Voice.
|
346
301
|
case 34:
|
347
302
|
voice_len = round(self.voice_len, 1)
|
348
|
-
self._text = f'[{voice_len}秒的语音]'
|
303
|
+
self._cache['_text'] = f'[{voice_len}秒的语音]'
|
349
304
|
|
350
305
|
## New firend invitation.
|
351
306
|
case 37:
|
352
|
-
self._text = '[新好友邀请]'
|
307
|
+
self._cache['_text'] = '[新好友邀请]'
|
353
308
|
|
354
309
|
## Business card.
|
355
310
|
case 42:
|
356
|
-
self._text = f'[分享名片"{self.business_card_name}"]'
|
311
|
+
self._cache['_text'] = f'[分享名片"{self.business_card_name}"]'
|
357
312
|
|
358
313
|
## Video.
|
359
314
|
case 43:
|
360
|
-
self._text = f'[{self.video_len}秒的视频]'
|
315
|
+
self._cache['_text'] = f'[{self.video_len}秒的视频]'
|
361
316
|
|
362
317
|
## Emoticon.
|
363
318
|
case 47:
|
364
|
-
self._text = f'[动画表情]'
|
319
|
+
self._cache['_text'] = f'[动画表情]'
|
365
320
|
|
366
321
|
## Position.
|
367
322
|
case 48:
|
368
|
-
self._text = '[地图位置分享]'
|
323
|
+
self._cache['_text'] = '[地图位置分享]'
|
369
324
|
|
370
325
|
## Share.
|
371
326
|
case 49:
|
372
327
|
|
373
328
|
### Pure URL text.
|
374
329
|
if self.share_type == 1:
|
375
|
-
self._text = '[网址]'
|
330
|
+
self._cache['_text'] = '[网址]'
|
376
331
|
if self.share_params['title'] is not None:
|
377
332
|
self._text += f' {self.share_params['title']}'
|
378
333
|
|
379
334
|
### File uploaded.
|
380
335
|
elif self.is_file_uploaded:
|
381
|
-
self._text = f'[文件"{self.file['name']}"发送完成]'
|
336
|
+
self._cache['_text'] = f'[文件"{self.file['name']}"发送完成]'
|
382
337
|
|
383
338
|
### Initiate real time location.
|
384
339
|
elif self.share_type == 17:
|
385
|
-
self._text = '[开始实时地图位置分享]'
|
340
|
+
self._cache['_text'] = '[开始实时地图位置分享]'
|
386
341
|
|
387
342
|
### Forword messages.
|
388
343
|
elif self.is_forword:
|
389
344
|
if self.share_params['title'] is None:
|
390
|
-
self._text = '[转发聊天记录]'
|
345
|
+
self._cache['_text'] = '[转发聊天记录]'
|
391
346
|
else:
|
392
|
-
self._text = f'[转发"{self.share_params['title']}"]'
|
347
|
+
self._cache['_text'] = f'[转发"{self.share_params['title']}"]'
|
393
348
|
if self.share_params['desc'] is not None:
|
394
349
|
self._text += f' {self.share_params['desc']}'
|
395
350
|
|
396
351
|
### Mini program.
|
397
352
|
elif self.is_mini_program:
|
398
353
|
if self.share_params['name'] is None:
|
399
|
-
self._text = '[小程序分享]'
|
354
|
+
self._cache['_text'] = '[小程序分享]'
|
400
355
|
else:
|
401
|
-
self._text = f'[小程序"{self.share_params['name']}"分享]'
|
356
|
+
self._cache['_text'] = f'[小程序"{self.share_params['name']}"分享]'
|
402
357
|
if self.share_params['title'] is not None:
|
403
358
|
self._text += f' {self.share_params['title']}'
|
404
359
|
|
405
360
|
### Video channel.
|
406
361
|
elif self.share_type == 51:
|
407
362
|
if self.share_params['name'] is None:
|
408
|
-
self._text = '[视频号分享]'
|
363
|
+
self._cache['_text'] = '[视频号分享]'
|
409
364
|
else:
|
410
|
-
self._text = f'[视频号"{self.share_params['name']}"分享]'
|
365
|
+
self._cache['_text'] = f'[视频号"{self.share_params['name']}"分享]'
|
411
366
|
if self.share_params['title'] is not None:
|
412
367
|
self._text += f' {self.share_params['title']}'
|
413
368
|
|
414
369
|
### Quote.
|
415
370
|
elif self.is_quote:
|
416
|
-
self._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']}'
|
417
372
|
|
418
373
|
### Quote me.
|
419
374
|
elif self.is_quote_me:
|
420
|
-
self._text = f'[引用了你的消息并发言] {self.quote_params['text']}'
|
375
|
+
self._cache['_text'] = f'[引用了你的消息并发言] {self.quote_params['text']}'
|
421
376
|
|
422
377
|
### File uploading.
|
423
378
|
elif self.is_file_uploading:
|
424
|
-
self._text = f'[文件"{self.file_name_uploading}"发送中]'
|
379
|
+
self._cache['_text'] = f'[文件"{self.file_name_uploading}"发送中]'
|
425
380
|
|
426
381
|
### Transfer money.
|
427
382
|
elif self.is_money:
|
428
|
-
self._text = f'[转账{self.money_amount}¥]'
|
383
|
+
self._cache['_text'] = f'[转账{self.money_amount}¥]'
|
429
384
|
|
430
385
|
### App.
|
431
386
|
elif self.is_app:
|
432
387
|
if self.share_params['name'] is None:
|
433
|
-
self._text = '[APP分享]'
|
388
|
+
self._cache['_text'] = '[APP分享]'
|
434
389
|
else:
|
435
|
-
self._text = f'[APP"{self.share_params['name']}"分享]'
|
390
|
+
self._cache['_text'] = f'[APP"{self.share_params['name']}"分享]'
|
436
391
|
if self.share_params["title"] is not None:
|
437
392
|
self._text += f' {self.share_params["title"]}'
|
438
393
|
if self.share_params["desc"] is not None:
|
@@ -441,9 +396,9 @@ class WeChatMessage(WeChatBase):
|
|
441
396
|
### Other.
|
442
397
|
else:
|
443
398
|
if self.share_params['name'] is None:
|
444
|
-
self._text = '[分享]'
|
399
|
+
self._cache['_text'] = '[分享]'
|
445
400
|
else:
|
446
|
-
self._text = f'["{self.share_params['name']}"分享]'
|
401
|
+
self._cache['_text'] = f'["{self.share_params['name']}"分享]'
|
447
402
|
if self.share_params["title"] is not None:
|
448
403
|
self._text += f' {self.share_params["title"]}'
|
449
404
|
if self.share_params["desc"] is not None:
|
@@ -451,32 +406,32 @@ class WeChatMessage(WeChatBase):
|
|
451
406
|
|
452
407
|
## Voice call or video call.
|
453
408
|
case 50:
|
454
|
-
self._text = '[视频或语音通话]'
|
409
|
+
self._cache['_text'] = '[视频或语音通话]'
|
455
410
|
|
456
411
|
## System sync.
|
457
412
|
case 51:
|
458
|
-
self._text = '[系统同步]'
|
413
|
+
self._cache['_text'] = '[系统同步]'
|
459
414
|
|
460
415
|
## Real time position.
|
461
416
|
case 56:
|
462
|
-
self._text = '[实时地图位置分享中]'
|
417
|
+
self._cache['_text'] = '[实时地图位置分享中]'
|
463
418
|
|
464
419
|
## System.
|
465
420
|
case 10000:
|
466
|
-
self._text = '[系统信息]'
|
421
|
+
self._cache['_text'] = '[系统信息]'
|
467
422
|
|
468
423
|
## Pat.
|
469
424
|
case 10002 if self.is_pat:
|
470
|
-
self._text = f'[{self.pat_text}]'
|
425
|
+
self._cache['_text'] = f'[{self.pat_text}]'
|
471
426
|
|
472
427
|
## Recall.
|
473
428
|
case 10002 if self.is_recall:
|
474
|
-
self._text = '[撤回了一条消息]'
|
429
|
+
self._cache['_text'] = '[撤回了一条消息]'
|
475
430
|
|
476
431
|
case _:
|
477
|
-
self._text = '[消息]'
|
432
|
+
self._cache['_text'] = '[消息]'
|
478
433
|
|
479
|
-
return self._text
|
434
|
+
return self._cache['_text']
|
480
435
|
|
481
436
|
|
482
437
|
@property
|
@@ -490,8 +445,8 @@ class WeChatMessage(WeChatBase):
|
|
490
445
|
"""
|
491
446
|
|
492
447
|
# Cache.
|
493
|
-
if self._voice_len is not None:
|
494
|
-
return self._voice_len
|
448
|
+
if self._cache['_voice_len'] is not None:
|
449
|
+
return self._cache['_voice_len']
|
495
450
|
|
496
451
|
# Check.
|
497
452
|
if self.type != 34:
|
@@ -500,9 +455,9 @@ class WeChatMessage(WeChatBase):
|
|
500
455
|
# Get.
|
501
456
|
pattern = r'voicelength="(\d+)"'
|
502
457
|
voice_len_us_str = search(pattern, self.data)
|
503
|
-
self._voice_len = int(voice_len_us_str) / 1000
|
458
|
+
self._cache['_voice_len'] = int(voice_len_us_str) / 1000
|
504
459
|
|
505
|
-
return self._voice_len
|
460
|
+
return self._cache['_voice_len']
|
506
461
|
|
507
462
|
|
508
463
|
@property
|
@@ -516,8 +471,8 @@ class WeChatMessage(WeChatBase):
|
|
516
471
|
"""
|
517
472
|
|
518
473
|
# Cache.
|
519
|
-
if self._video_len is not None:
|
520
|
-
return self._video_len
|
474
|
+
if self._cache['_video_len'] is not None:
|
475
|
+
return self._cache['_video_len']
|
521
476
|
|
522
477
|
# Check.
|
523
478
|
if self.type != 43:
|
@@ -526,9 +481,9 @@ class WeChatMessage(WeChatBase):
|
|
526
481
|
# Get.
|
527
482
|
pattern = r'playlength="(\d+)"'
|
528
483
|
video_len_s_str = search(pattern, self.data)
|
529
|
-
self._video_len = int(video_len_s_str)
|
484
|
+
self._cache['_video_len'] = int(video_len_s_str)
|
530
485
|
|
531
|
-
return self._video_len
|
486
|
+
return self._cache['_video_len']
|
532
487
|
|
533
488
|
|
534
489
|
@property
|
@@ -542,8 +497,8 @@ class WeChatMessage(WeChatBase):
|
|
542
497
|
"""
|
543
498
|
|
544
499
|
# Cache.
|
545
|
-
if self._business_card_name is not None:
|
546
|
-
return self._business_card_name
|
500
|
+
if self._cache['_business_card_name'] is not None:
|
501
|
+
return self._cache['_business_card_name']
|
547
502
|
|
548
503
|
# Check.
|
549
504
|
if self.type != 42:
|
@@ -551,9 +506,9 @@ class WeChatMessage(WeChatBase):
|
|
551
506
|
|
552
507
|
# Get.
|
553
508
|
pattern = r'nickname="([^"]+)"'
|
554
|
-
self._business_card_name = search(pattern, self.data)
|
509
|
+
self._cache['_business_card_name'] = search(pattern, self.data)
|
555
510
|
|
556
|
-
return self._business_card_name
|
511
|
+
return self._cache['_business_card_name']
|
557
512
|
|
558
513
|
|
559
514
|
@property
|
@@ -567,8 +522,8 @@ class WeChatMessage(WeChatBase):
|
|
567
522
|
"""
|
568
523
|
|
569
524
|
# Cache.
|
570
|
-
if self._share_type is not None:
|
571
|
-
return self._share_type
|
525
|
+
if self._cache['_share_type'] is not None:
|
526
|
+
return self._cache['_share_type']
|
572
527
|
|
573
528
|
# Check.
|
574
529
|
if self.type != 49:
|
@@ -577,9 +532,9 @@ class WeChatMessage(WeChatBase):
|
|
577
532
|
# Get.
|
578
533
|
pattern = r'<type>(\d+)</type>'
|
579
534
|
share_type_str: str = search(pattern, self.data)
|
580
|
-
self._share_type = int(share_type_str)
|
535
|
+
self._cache['_share_type'] = int(share_type_str)
|
581
536
|
|
582
|
-
return self._share_type
|
537
|
+
return self._cache['_share_type']
|
583
538
|
|
584
539
|
|
585
540
|
@property
|
@@ -593,8 +548,8 @@ class WeChatMessage(WeChatBase):
|
|
593
548
|
"""
|
594
549
|
|
595
550
|
# Cache.
|
596
|
-
if self._share_params is not None:
|
597
|
-
return self._share_params
|
551
|
+
if self._cache['_share_params'] is not None:
|
552
|
+
return self._cache['_share_params']
|
598
553
|
|
599
554
|
# Check.
|
600
555
|
if self.type != 49:
|
@@ -618,7 +573,7 @@ class WeChatMessage(WeChatBase):
|
|
618
573
|
'url': url
|
619
574
|
}
|
620
575
|
|
621
|
-
return self._share_params
|
576
|
+
return self._cache['_share_params']
|
622
577
|
|
623
578
|
|
624
579
|
@property
|
@@ -632,16 +587,16 @@ class WeChatMessage(WeChatBase):
|
|
632
587
|
"""
|
633
588
|
|
634
589
|
# Cache.
|
635
|
-
if self._is_file_uploading is not None:
|
636
|
-
return self._is_file_uploading
|
590
|
+
if self._cache['_is_file_uploading'] is not None:
|
591
|
+
return self._cache['_is_file_uploading']
|
637
592
|
|
638
593
|
# Judge.
|
639
|
-
self._is_file_uploading = (
|
594
|
+
self._cache['_is_file_uploading'] = (
|
640
595
|
self.type == 49
|
641
596
|
and self.share_type == 74
|
642
597
|
)
|
643
598
|
|
644
|
-
return self._is_file_uploading
|
599
|
+
return self._cache['_is_file_uploading']
|
645
600
|
|
646
601
|
|
647
602
|
@property
|
@@ -655,8 +610,8 @@ class WeChatMessage(WeChatBase):
|
|
655
610
|
"""
|
656
611
|
|
657
612
|
# Cache.
|
658
|
-
if self._file_name_uploading is not None:
|
659
|
-
return self._file_name_uploading
|
613
|
+
if self._cache['_file_name_uploading'] is not None:
|
614
|
+
return self._cache['_file_name_uploading']
|
660
615
|
|
661
616
|
# Check.
|
662
617
|
if not self.is_file_uploading:
|
@@ -665,7 +620,7 @@ class WeChatMessage(WeChatBase):
|
|
665
620
|
# Get.
|
666
621
|
self._file_name_uploading: str = search(r'<title><!\[CDATA\[([^<>]+)\]\]></title>', self.data)
|
667
622
|
|
668
|
-
return self._file_name_uploading
|
623
|
+
return self._cache['_file_name_uploading']
|
669
624
|
|
670
625
|
|
671
626
|
@property
|
@@ -679,16 +634,16 @@ class WeChatMessage(WeChatBase):
|
|
679
634
|
"""
|
680
635
|
|
681
636
|
# Cache.
|
682
|
-
if self._is_file_uploaded is not None:
|
683
|
-
return self._is_file_uploaded
|
637
|
+
if self._cache['_is_file_uploaded'] is not None:
|
638
|
+
return self._cache['_is_file_uploaded']
|
684
639
|
|
685
640
|
# Judge.
|
686
|
-
self._is_file_uploading = (
|
641
|
+
self._cache['_is_file_uploading'] = (
|
687
642
|
self.type == 49
|
688
643
|
and self.share_type == 6
|
689
644
|
)
|
690
645
|
|
691
|
-
return self._is_file_uploaded
|
646
|
+
return self._cache['_is_file_uploaded']
|
692
647
|
|
693
648
|
|
694
649
|
@property
|
@@ -702,16 +657,16 @@ class WeChatMessage(WeChatBase):
|
|
702
657
|
"""
|
703
658
|
|
704
659
|
# Cache.
|
705
|
-
if self._is_forward is not None:
|
706
|
-
return self._is_forward
|
660
|
+
if self._cache['_is_forward'] is not None:
|
661
|
+
return self._cache['_is_forward']
|
707
662
|
|
708
663
|
# Judge.
|
709
|
-
self._is_forward = (
|
664
|
+
self._cache['_is_forward'] = (
|
710
665
|
self.type == 49
|
711
666
|
and self.share_type in (19, 40)
|
712
667
|
)
|
713
668
|
|
714
|
-
return self._is_forward
|
669
|
+
return self._cache['_is_forward']
|
715
670
|
|
716
671
|
|
717
672
|
@property
|
@@ -725,16 +680,16 @@ class WeChatMessage(WeChatBase):
|
|
725
680
|
"""
|
726
681
|
|
727
682
|
# Cache.
|
728
|
-
if self._is_mini_program is not None:
|
729
|
-
return self._is_mini_program
|
683
|
+
if self._cache['_is_mini_program'] is not None:
|
684
|
+
return self._cache['_is_mini_program']
|
730
685
|
|
731
686
|
# Judge.
|
732
|
-
self._is_mini_program = (
|
687
|
+
self._cache['_is_mini_program'] = (
|
733
688
|
self.type == 49
|
734
689
|
and self.type == 33
|
735
690
|
)
|
736
691
|
|
737
|
-
return self._is_mini_program
|
692
|
+
return self._cache['_is_mini_program']
|
738
693
|
|
739
694
|
|
740
695
|
@property
|
@@ -748,16 +703,16 @@ class WeChatMessage(WeChatBase):
|
|
748
703
|
"""
|
749
704
|
|
750
705
|
# Cache.
|
751
|
-
if self._is_quote is not None:
|
752
|
-
return self._is_quote
|
706
|
+
if self._cache['_is_quote'] is not None:
|
707
|
+
return self._cache['_is_quote']
|
753
708
|
|
754
709
|
# Judge.
|
755
|
-
self._is_quote = (
|
710
|
+
self._cache['_is_quote'] = (
|
756
711
|
self.type == 49
|
757
712
|
and self.share_type == 57
|
758
713
|
)
|
759
714
|
|
760
|
-
return self._is_quote
|
715
|
+
return self._cache['_is_quote']
|
761
716
|
|
762
717
|
|
763
718
|
@property
|
@@ -771,16 +726,16 @@ class WeChatMessage(WeChatBase):
|
|
771
726
|
"""
|
772
727
|
|
773
728
|
# Cache.
|
774
|
-
if self.
|
775
|
-
return self.
|
729
|
+
if 'is_quote_me' in self._cache:
|
730
|
+
return self._cache['is_quote_me']
|
776
731
|
|
777
732
|
# Judge.
|
778
|
-
self.
|
733
|
+
self._cache['is_quote_me'] = (
|
779
734
|
self.is_quote
|
780
735
|
and '<chatusr>%s</chatusr>' % self.receiver.wechat.client.login_info['id'] in self.data
|
781
736
|
)
|
782
737
|
|
783
|
-
return self.
|
738
|
+
return self._cache['is_quote_me']
|
784
739
|
|
785
740
|
|
786
741
|
@property
|
@@ -801,8 +756,8 @@ class WeChatMessage(WeChatBase):
|
|
801
756
|
"""
|
802
757
|
|
803
758
|
# Cache.
|
804
|
-
if self._quote_params is not None:
|
805
|
-
return self._quote_params
|
759
|
+
if self._cache['_quote_params'] is not None:
|
760
|
+
return self._cache['_quote_params']
|
806
761
|
|
807
762
|
# Check.
|
808
763
|
if not self.is_quote:
|
@@ -836,7 +791,7 @@ class WeChatMessage(WeChatBase):
|
|
836
791
|
'quote_data': quote_data
|
837
792
|
}
|
838
793
|
|
839
|
-
return self._quote_params
|
794
|
+
return self._cache['_quote_params']
|
840
795
|
|
841
796
|
|
842
797
|
@property
|
@@ -850,16 +805,16 @@ class WeChatMessage(WeChatBase):
|
|
850
805
|
"""
|
851
806
|
|
852
807
|
# Cache.
|
853
|
-
if self._is_money is not None:
|
854
|
-
return self._is_money
|
808
|
+
if self._cache['_is_money'] is not None:
|
809
|
+
return self._cache['_is_money']
|
855
810
|
|
856
811
|
# Judge.
|
857
|
-
self._is_money = (
|
812
|
+
self._cache['_is_money'] = (
|
858
813
|
self.type == 49
|
859
814
|
and self.share_type == 2000
|
860
815
|
)
|
861
816
|
|
862
|
-
return self._is_money
|
817
|
+
return self._cache['_is_money']
|
863
818
|
|
864
819
|
|
865
820
|
@property
|
@@ -873,8 +828,8 @@ class WeChatMessage(WeChatBase):
|
|
873
828
|
"""
|
874
829
|
|
875
830
|
# Cache.
|
876
|
-
if self._money_amount is not None:
|
877
|
-
return self._money_amount
|
831
|
+
if self._cache['_money_amount'] is not None:
|
832
|
+
return self._cache['_money_amount']
|
878
833
|
|
879
834
|
# Check.
|
880
835
|
if not self.is_money:
|
@@ -882,9 +837,9 @@ class WeChatMessage(WeChatBase):
|
|
882
837
|
|
883
838
|
# Judge.
|
884
839
|
amount_str: str = search(r'<feedesc><!\[CDATA\[¥([\d.,]+)\]\]></feedesc>', self.data)
|
885
|
-
self._money_amount = float(amount_str)
|
840
|
+
self._cache['_money_amount'] = float(amount_str)
|
886
841
|
|
887
|
-
return self._money_amount
|
842
|
+
return self._cache['_money_amount']
|
888
843
|
|
889
844
|
|
890
845
|
@property
|
@@ -898,16 +853,16 @@ class WeChatMessage(WeChatBase):
|
|
898
853
|
"""
|
899
854
|
|
900
855
|
# Cache.
|
901
|
-
if self._is_app is not None:
|
902
|
-
return self._is_app
|
856
|
+
if self._cache['_is_app'] is not None:
|
857
|
+
return self._cache['_is_app']
|
903
858
|
|
904
859
|
# Judge.
|
905
|
-
self._is_app = (
|
860
|
+
self._cache['_is_app'] = (
|
906
861
|
self.type == 49
|
907
862
|
and search('<appname>[^<>]+</appname>', self.data) is not None
|
908
863
|
)
|
909
864
|
|
910
|
-
return self._is_app
|
865
|
+
return self._cache['_is_app']
|
911
866
|
|
912
867
|
|
913
868
|
@property
|
@@ -921,8 +876,8 @@ class WeChatMessage(WeChatBase):
|
|
921
876
|
"""
|
922
877
|
|
923
878
|
# Cache.
|
924
|
-
if self._at_names is not None:
|
925
|
-
return self._at_names
|
879
|
+
if self._cache['_at_names'] is not None:
|
880
|
+
return self._cache['_at_names']
|
926
881
|
|
927
882
|
# Get.
|
928
883
|
if self.type == 1:
|
@@ -930,9 +885,9 @@ class WeChatMessage(WeChatBase):
|
|
930
885
|
elif self.is_quote:
|
931
886
|
text = self.quote_params['text']
|
932
887
|
pattern = r'@(\w+)\u2005'
|
933
|
-
self._at_names = findall(pattern, text)
|
888
|
+
self._cache['_at_names'] = findall(pattern, text)
|
934
889
|
|
935
|
-
return self._at_names
|
890
|
+
return self._cache['_at_names']
|
936
891
|
|
937
892
|
|
938
893
|
@property
|
@@ -946,13 +901,13 @@ class WeChatMessage(WeChatBase):
|
|
946
901
|
"""
|
947
902
|
|
948
903
|
# Cache.
|
949
|
-
if self._is_at is not None:
|
950
|
-
return self._is_at
|
904
|
+
if self._cache['_is_at'] is not None:
|
905
|
+
return self._cache['_is_at']
|
951
906
|
|
952
907
|
# Judge.
|
953
|
-
self._is_at = self.at_names != []
|
908
|
+
self._cache['_is_at'] = self.at_names != []
|
954
909
|
|
955
|
-
return self._is_at
|
910
|
+
return self._cache['_is_at']
|
956
911
|
|
957
912
|
|
958
913
|
@property
|
@@ -966,13 +921,13 @@ class WeChatMessage(WeChatBase):
|
|
966
921
|
"""
|
967
922
|
|
968
923
|
# Cache.
|
969
|
-
if self._is_at_me is not None:
|
970
|
-
return self._is_at_me
|
924
|
+
if self._cache['_is_at_me'] is not None:
|
925
|
+
return self._cache['_is_at_me']
|
971
926
|
|
972
927
|
# Judge.
|
973
|
-
self._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
|
974
929
|
|
975
|
-
return self._is_at_me
|
930
|
+
return self._cache['_is_at_me']
|
976
931
|
|
977
932
|
|
978
933
|
@property
|
@@ -986,11 +941,11 @@ class WeChatMessage(WeChatBase):
|
|
986
941
|
"""
|
987
942
|
|
988
943
|
# Cache.
|
989
|
-
if self._is_call is not None:
|
990
|
-
return self._is_call
|
944
|
+
if self._cache['_is_call'] is not None:
|
945
|
+
return self._cache['_is_call']
|
991
946
|
|
992
947
|
# Judge.
|
993
|
-
self._is_call = (
|
948
|
+
self._cache['_is_call'] = (
|
994
949
|
|
995
950
|
## Last call.
|
996
951
|
self.is_last_call
|
@@ -1015,7 +970,7 @@ class WeChatMessage(WeChatBase):
|
|
1015
970
|
|
1016
971
|
)
|
1017
972
|
|
1018
|
-
return self._is_call
|
973
|
+
return self._cache['_is_call']
|
1019
974
|
|
1020
975
|
|
1021
976
|
@property
|
@@ -1029,8 +984,8 @@ class WeChatMessage(WeChatBase):
|
|
1029
984
|
"""
|
1030
985
|
|
1031
986
|
# Cache.
|
1032
|
-
if self._call_text is not None:
|
1033
|
-
return self._call_text
|
987
|
+
if self._cache['_call_text'] is not None:
|
988
|
+
return self._cache['_call_text']
|
1034
989
|
|
1035
990
|
# Check.
|
1036
991
|
if not self.is_call:
|
@@ -1051,9 +1006,9 @@ class WeChatMessage(WeChatBase):
|
|
1051
1006
|
if result is not None:
|
1052
1007
|
text = result
|
1053
1008
|
|
1054
|
-
self._call_text = text.strip()
|
1009
|
+
self._cache['_call_text'] = text.strip()
|
1055
1010
|
|
1056
|
-
return self._call_text
|
1011
|
+
return self._cache['_call_text']
|
1057
1012
|
|
1058
1013
|
|
1059
1014
|
@property
|
@@ -1067,11 +1022,11 @@ class WeChatMessage(WeChatBase):
|
|
1067
1022
|
"""
|
1068
1023
|
|
1069
1024
|
# Cache.
|
1070
|
-
if self._is_call_next is not None:
|
1071
|
-
return self._is_call_next
|
1025
|
+
if self._cache['_is_call_next'] is not None:
|
1026
|
+
return self._cache['_is_call_next']
|
1072
1027
|
|
1073
1028
|
# Judge.
|
1074
|
-
self._is_call_next = (
|
1029
|
+
self._cache['_is_call_next'] = (
|
1075
1030
|
self.room is not None
|
1076
1031
|
and self.is_call
|
1077
1032
|
and self.call_text == ''
|
@@ -1082,7 +1037,7 @@ class WeChatMessage(WeChatBase):
|
|
1082
1037
|
call_next_mark_value = f'{self.user}_{self.room}'
|
1083
1038
|
self.receiver.mark(call_next_mark_value, 'is_call_next')
|
1084
1039
|
|
1085
|
-
return self._is_call_next
|
1040
|
+
return self._cache['_is_call_next']
|
1086
1041
|
|
1087
1042
|
|
1088
1043
|
@property
|
@@ -1096,12 +1051,12 @@ class WeChatMessage(WeChatBase):
|
|
1096
1051
|
"""
|
1097
1052
|
|
1098
1053
|
# Cache.
|
1099
|
-
if self._is_last_call is not None:
|
1100
|
-
return self._is_last_call
|
1054
|
+
if self._cache['_is_last_call'] is not None:
|
1055
|
+
return self._cache['_is_last_call']
|
1101
1056
|
|
1102
1057
|
# Judge.
|
1103
1058
|
call_next_mark_value = f'{self.user}_{self.room}'
|
1104
|
-
self._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')
|
1105
1060
|
|
1106
1061
|
# Mark.
|
1107
1062
|
if self._is_last_call:
|
@@ -1122,16 +1077,16 @@ class WeChatMessage(WeChatBase):
|
|
1122
1077
|
"""
|
1123
1078
|
|
1124
1079
|
# Cache.
|
1125
|
-
if self._is_pat is not None:
|
1126
|
-
return self._is_pat
|
1080
|
+
if self._cache['_is_pat'] is not None:
|
1081
|
+
return self._cache['_is_pat']
|
1127
1082
|
|
1128
1083
|
# Judge.
|
1129
|
-
self._is_pat = (
|
1084
|
+
self._cache['_is_pat'] = (
|
1130
1085
|
self.type == 10002
|
1131
1086
|
and self.data.startswith('<sysmsg type="pat">')
|
1132
1087
|
)
|
1133
1088
|
|
1134
|
-
return self._is_pat
|
1089
|
+
return self._cache['_is_pat']
|
1135
1090
|
|
1136
1091
|
|
1137
1092
|
@property
|
@@ -1145,17 +1100,17 @@ class WeChatMessage(WeChatBase):
|
|
1145
1100
|
"""
|
1146
1101
|
|
1147
1102
|
# Cache.
|
1148
|
-
if self._is_pat_me is not None:
|
1149
|
-
return self._is_pat_me
|
1103
|
+
if self._cache['_is_pat_me'] is not None:
|
1104
|
+
return self._cache['_is_pat_me']
|
1150
1105
|
|
1151
1106
|
# Judge.
|
1152
1107
|
pattern = r'<template><!\[CDATA\["\$\{[\da-z_]+\}" 拍了拍我\]\]></template>'
|
1153
|
-
self._is_pat_me = (
|
1108
|
+
self._cache['_is_pat_me'] = (
|
1154
1109
|
self.is_pat
|
1155
1110
|
and search(pattern, self.data) is not None
|
1156
1111
|
)
|
1157
1112
|
|
1158
|
-
return self._is_pat_me
|
1113
|
+
return self._cache['_is_pat_me']
|
1159
1114
|
|
1160
1115
|
|
1161
1116
|
@property
|
@@ -1169,8 +1124,8 @@ class WeChatMessage(WeChatBase):
|
|
1169
1124
|
"""
|
1170
1125
|
|
1171
1126
|
# Cache.
|
1172
|
-
if self._pat_text is not None:
|
1173
|
-
return self._pat_text
|
1127
|
+
if self._cache['_pat_text'] is not None:
|
1128
|
+
return self._cache['_pat_text']
|
1174
1129
|
|
1175
1130
|
# Check.
|
1176
1131
|
if not self.is_pat:
|
@@ -1190,9 +1145,9 @@ class WeChatMessage(WeChatBase):
|
|
1190
1145
|
old_text = '${%s}' % user_id
|
1191
1146
|
text = text.replace(old_text, user_name)
|
1192
1147
|
|
1193
|
-
self._pat_text = text
|
1148
|
+
self._cache['_pat_text'] = text
|
1194
1149
|
|
1195
|
-
return self._pat_text
|
1150
|
+
return self._cache['_pat_text']
|
1196
1151
|
|
1197
1152
|
|
1198
1153
|
@property
|
@@ -1206,16 +1161,16 @@ class WeChatMessage(WeChatBase):
|
|
1206
1161
|
"""
|
1207
1162
|
|
1208
1163
|
# Cache.
|
1209
|
-
if self._is_recall is not None:
|
1210
|
-
return self._is_recall
|
1164
|
+
if self._cache['_is_recall'] is not None:
|
1165
|
+
return self._cache['_is_recall']
|
1211
1166
|
|
1212
1167
|
# Judge.
|
1213
|
-
self._is_recall = (
|
1168
|
+
self._cache['_is_recall'] = (
|
1214
1169
|
self.type == 10002
|
1215
1170
|
and self.data.startswith('<sysmsg type="revokemsg">')
|
1216
1171
|
)
|
1217
1172
|
|
1218
|
-
return self._is_recall
|
1173
|
+
return self._cache['_is_recall']
|
1219
1174
|
|
1220
1175
|
|
1221
1176
|
@property
|
@@ -1229,11 +1184,11 @@ class WeChatMessage(WeChatBase):
|
|
1229
1184
|
"""
|
1230
1185
|
|
1231
1186
|
# Cache.
|
1232
|
-
if self._is_new_user is not None:
|
1233
|
-
return self._is_new_user
|
1187
|
+
if self._cache['_is_new_user'] is not None:
|
1188
|
+
return self._cache['_is_new_user']
|
1234
1189
|
|
1235
1190
|
# Judge.
|
1236
|
-
self._is_new_user = (
|
1191
|
+
self._cache['_is_new_user'] = (
|
1237
1192
|
self.type == 10000
|
1238
1193
|
and (
|
1239
1194
|
self.data == '以上是打招呼的内容'
|
@@ -1242,7 +1197,7 @@ class WeChatMessage(WeChatBase):
|
|
1242
1197
|
)
|
1243
1198
|
)
|
1244
1199
|
|
1245
|
-
return self._is_new_user
|
1200
|
+
return self._cache['_is_new_user']
|
1246
1201
|
|
1247
1202
|
|
1248
1203
|
@property
|
@@ -1256,11 +1211,11 @@ class WeChatMessage(WeChatBase):
|
|
1256
1211
|
"""
|
1257
1212
|
|
1258
1213
|
# Cache.
|
1259
|
-
if self._is_new_room is not None:
|
1260
|
-
return self._is_new_room
|
1214
|
+
if self._cache['_is_new_room'] is not None:
|
1215
|
+
return self._cache['_is_new_room']
|
1261
1216
|
|
1262
1217
|
# Judge.
|
1263
|
-
self._is_new_room = (
|
1218
|
+
self._cache['_is_new_room'] = (
|
1264
1219
|
self.type == 10000
|
1265
1220
|
and (
|
1266
1221
|
'邀请你和' in self.data[:38]
|
@@ -1268,7 +1223,7 @@ class WeChatMessage(WeChatBase):
|
|
1268
1223
|
)
|
1269
1224
|
)
|
1270
1225
|
|
1271
|
-
return self._is_new_room
|
1226
|
+
return self._cache['_is_new_room']
|
1272
1227
|
|
1273
1228
|
|
1274
1229
|
@property
|
@@ -1282,17 +1237,17 @@ class WeChatMessage(WeChatBase):
|
|
1282
1237
|
"""
|
1283
1238
|
|
1284
1239
|
# Cache.
|
1285
|
-
if self._is_new_room_user is not None:
|
1286
|
-
return self._is_new_room_user
|
1240
|
+
if self._cache['_is_new_room_user'] is not None:
|
1241
|
+
return self._cache['_is_new_room_user']
|
1287
1242
|
|
1288
1243
|
# Judge.
|
1289
|
-
self._is_new_room_user = (
|
1244
|
+
self._cache['_is_new_room_user'] = (
|
1290
1245
|
self.type == 10000
|
1291
1246
|
and '邀请"' in self.data[:37]
|
1292
1247
|
and self.data.endswith('"加入了群聊')
|
1293
1248
|
)
|
1294
1249
|
|
1295
|
-
return self._is_new_room_user
|
1250
|
+
return self._cache['_is_new_room_user']
|
1296
1251
|
|
1297
1252
|
|
1298
1253
|
@property
|
@@ -1306,13 +1261,13 @@ class WeChatMessage(WeChatBase):
|
|
1306
1261
|
"""
|
1307
1262
|
|
1308
1263
|
# Extracted.
|
1309
|
-
if self._new_room_user_name is not None:
|
1310
|
-
return self._new_room_user_name
|
1264
|
+
if self._cache['_new_room_user_name'] is not None:
|
1265
|
+
return self._cache['_new_room_user_name']
|
1311
1266
|
|
1312
1267
|
# Extract.
|
1313
1268
|
pattern = '邀请"(.+?)"加入了群聊'
|
1314
1269
|
result: str = search(pattern, self.data)
|
1315
|
-
self._new_room_user_name = result
|
1270
|
+
self._cache['_new_room_user_name'] = result
|
1316
1271
|
|
1317
1272
|
return result
|
1318
1273
|
|
@@ -1328,16 +1283,16 @@ class WeChatMessage(WeChatBase):
|
|
1328
1283
|
"""
|
1329
1284
|
|
1330
1285
|
# Cache.
|
1331
|
-
if self._is_change_room_name is not None:
|
1332
|
-
return self._is_change_room_name
|
1286
|
+
if self._cache['_is_change_room_name'] is not None:
|
1287
|
+
return self._cache['_is_change_room_name']
|
1333
1288
|
|
1334
1289
|
# Judge.
|
1335
|
-
self._is_change_room_name = (
|
1290
|
+
self._cache['_is_change_room_name'] = (
|
1336
1291
|
self.type == 10000
|
1337
1292
|
and '修改群名为“' in self.data[:40]
|
1338
1293
|
)
|
1339
1294
|
|
1340
|
-
return self._is_change_room_name
|
1295
|
+
return self._cache['_is_change_room_name']
|
1341
1296
|
|
1342
1297
|
|
1343
1298
|
@property
|
@@ -1351,15 +1306,15 @@ class WeChatMessage(WeChatBase):
|
|
1351
1306
|
"""
|
1352
1307
|
|
1353
1308
|
# Extracted.
|
1354
|
-
if self._change_room_name is not None:
|
1355
|
-
return self._change_room_name
|
1309
|
+
if self._cache['_change_room_name'] is not None:
|
1310
|
+
return self._cache['_change_room_name']
|
1356
1311
|
|
1357
1312
|
# Extract.
|
1358
1313
|
pattern = '修改群名为“(.+?)”'
|
1359
1314
|
result: str = search(pattern, self.data)
|
1360
|
-
self._change_room_name = result
|
1315
|
+
self._cache['_change_room_name'] = result
|
1361
1316
|
|
1362
|
-
return self._change_room_name
|
1317
|
+
return self._cache['_change_room_name']
|
1363
1318
|
|
1364
1319
|
|
1365
1320
|
@property
|
@@ -1373,17 +1328,17 @@ class WeChatMessage(WeChatBase):
|
|
1373
1328
|
"""
|
1374
1329
|
|
1375
1330
|
# Cache.
|
1376
|
-
if self._is_kick_out_room is not None:
|
1377
|
-
return self._is_kick_out_room
|
1331
|
+
if self._cache['_is_kick_out_room'] is not None:
|
1332
|
+
return self._cache['_is_kick_out_room']
|
1378
1333
|
|
1379
1334
|
# Judge.
|
1380
|
-
self._is_kick_out_room = (
|
1335
|
+
self._cache['_is_kick_out_room'] = (
|
1381
1336
|
self.type == 10000
|
1382
1337
|
and self.data.startswith('你被')
|
1383
1338
|
and self.data.endswith('移出群聊')
|
1384
1339
|
)
|
1385
1340
|
|
1386
|
-
return self._is_kick_out_room
|
1341
|
+
return self._cache['_is_kick_out_room']
|
1387
1342
|
|
1388
1343
|
|
1389
1344
|
@property
|
@@ -1397,17 +1352,17 @@ class WeChatMessage(WeChatBase):
|
|
1397
1352
|
"""
|
1398
1353
|
|
1399
1354
|
# Cache.
|
1400
|
-
if self._is_dissolve_room is not None:
|
1401
|
-
return self._is_dissolve_room
|
1355
|
+
if self._cache['_is_dissolve_room'] is not None:
|
1356
|
+
return self._cache['_is_dissolve_room']
|
1402
1357
|
|
1403
1358
|
# Judge.
|
1404
|
-
self._is_dissolve_room = (
|
1359
|
+
self._cache['_is_dissolve_room'] = (
|
1405
1360
|
self.type == 10000
|
1406
1361
|
and self.data.startswith('群主')
|
1407
1362
|
and self.data.endswith('已解散该群聊')
|
1408
1363
|
)
|
1409
1364
|
|
1410
|
-
return self._is_dissolve_room
|
1365
|
+
return self._cache['_is_dissolve_room']
|
1411
1366
|
|
1412
1367
|
|
1413
1368
|
@property
|
@@ -1421,17 +1376,17 @@ class WeChatMessage(WeChatBase):
|
|
1421
1376
|
"""
|
1422
1377
|
|
1423
1378
|
# Cache.
|
1424
|
-
if self._image_qrcodes is not None:
|
1425
|
-
return self._image_qrcodes
|
1379
|
+
if self._cache['_image_qrcodes'] is not None:
|
1380
|
+
return self._cache['_image_qrcodes']
|
1426
1381
|
|
1427
1382
|
# Check.
|
1428
1383
|
if self.type != 3:
|
1429
1384
|
throw(AssertionError, self.type)
|
1430
1385
|
|
1431
1386
|
# Extract.
|
1432
|
-
self._image_qrcodes = decode_qrcode(self.file['path'])
|
1387
|
+
self._cache['_image_qrcodes'] = decode_qrcode(self.file['path'])
|
1433
1388
|
|
1434
|
-
return self._image_qrcodes
|
1389
|
+
return self._cache['_image_qrcodes']
|
1435
1390
|
|
1436
1391
|
|
1437
1392
|
@property
|
@@ -1445,16 +1400,16 @@ class WeChatMessage(WeChatBase):
|
|
1445
1400
|
"""
|
1446
1401
|
|
1447
1402
|
# Cache.
|
1448
|
-
if self._is_html is not None:
|
1449
|
-
return self._is_html
|
1403
|
+
if self._cache['_is_html'] is not None:
|
1404
|
+
return self._cache['_is_html']
|
1450
1405
|
|
1451
1406
|
# Judge.
|
1452
|
-
self._is_html = (
|
1407
|
+
self._cache['_is_html'] = (
|
1453
1408
|
self.type != 1
|
1454
1409
|
and search(r'^<(\S+)[ >].*</\1>\s*', self.data) is not None
|
1455
1410
|
)
|
1456
1411
|
|
1457
|
-
return self._is_html
|
1412
|
+
return self._cache['_is_html']
|
1458
1413
|
|
1459
1414
|
|
1460
1415
|
@property
|
@@ -1468,17 +1423,17 @@ class WeChatMessage(WeChatBase):
|
|
1468
1423
|
"""
|
1469
1424
|
|
1470
1425
|
# Cache.
|
1471
|
-
if self._is_xml is not None:
|
1472
|
-
return self._is_xml
|
1426
|
+
if self._cache['_is_xml'] is not None:
|
1427
|
+
return self._cache['_is_xml']
|
1473
1428
|
|
1474
1429
|
# Judge.
|
1475
|
-
self._is_xml = (
|
1430
|
+
self._cache['_is_xml'] = (
|
1476
1431
|
self.type != 1
|
1477
1432
|
and self.data.startswith('<?xml ')
|
1478
1433
|
and self.data.rstrip().endswith('</msg>')
|
1479
1434
|
)
|
1480
1435
|
|
1481
|
-
return self._is_xml
|
1436
|
+
return self._cache['_is_xml']
|
1482
1437
|
|
1483
1438
|
|
1484
1439
|
@property
|
@@ -1494,13 +1449,13 @@ class WeChatMessage(WeChatBase):
|
|
1494
1449
|
"""
|
1495
1450
|
|
1496
1451
|
# Extracted.
|
1497
|
-
if self._valid is not None:
|
1498
|
-
return self._valid
|
1452
|
+
if self._cache['_valid'] is not None:
|
1453
|
+
return self._cache['_valid']
|
1499
1454
|
|
1500
1455
|
# Judge.
|
1501
|
-
self._valid = self.receiver.wechat.database.is_valid(self)
|
1456
|
+
self._cache['_valid'] = self.receiver.wechat.database.is_valid(self)
|
1502
1457
|
|
1503
|
-
return self._valid
|
1458
|
+
return self._cache['_valid']
|
1504
1459
|
|
1505
1460
|
|
1506
1461
|
def check_call(self) -> None:
|
@@ -5,12 +5,12 @@ reywechat/rcache.py,sha256=7UsHHfgFOgxuSqlTSAO6CprgUUOeBCXYus0kxmRBQxk,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=
|
8
|
+
reywechat/rreceive.py,sha256=wIzxcKrt1apGG-qlc4otrTfTz8AG6V2RmCWW4ADQ-74,51109
|
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.
|
14
|
-
reywechat-1.0.
|
15
|
-
reywechat-1.0.
|
16
|
-
reywechat-1.0.
|
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,,
|
File without changes
|
File without changes
|