-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPreventWithdrawal.py
125 lines (108 loc) · 5.34 KB
/
PreventWithdrawal.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#coding=utf8
import requests
from requests import exceptions
from urllib.request import urlopen
from bs4 import BeautifulSoup
from urllib.parse import urlencode
from threading import Timer
import re
from wxpy import *
import schedule
import time
import http
import json
import datetime
import random
import os
import ctypes
bot = Bot(cache_path=True,console_qr = 1)
myself = bot.self
bot.enable_puid('wxpy_puid.pkl')
Lie = bot.friends().search(u'Lie')
Test = bot.groups().search(u'C.B.M电子竞技俱乐部')
recallNotice = ensure_one(bot.groups().search('C.B.M电子竞技俱乐部'))
# 文本 TEXT = 'Text'
# 位置 MAP = 'Map' 1
# 名片 CARD = 'Card' 2
# 分享 SHARING = 'Sharing' 3
# 图片 PICTURE = 'Picture' 4
# 语音 RECORDING = 'Recording' 5
# 文件 ATTACHMENT = 'Attachment' 6
# 视频 VIDEO = 'Video' 7
@bot.register(Group)
def handleReceiveMsg(msg):
'''
监听消息
:param msg:
:param chats:
:return:
'''
ra = msg.raw
mss = msg.bot.messages
le = len(mss)
if ra['Status'] == 4:
# 获取消息ID
oldmsgid = re.search(re.compile('<msgid>(.*?)</msgid>', re.S),ra['Content']).group(1)
for i in range(le-1,-1,-1):
if oldmsgid == str(mss[i].id):
name = msg.chat.name
username = msg.member.nick_name
if name == None or name == '':
name = msg.chat.nick_name
username = msg.member.nick_name
if mss[i].type == 'Text':
recallNotice.send('来自【'+ name + '】的【' + username +'】撤回了一条消息:'+ mss[i].text)
bot.file_helper.send('来自【'+ name + '】的【' + username +'】撤回了一条消息:'+ mss[i].text)
break
elif mss[i].type == 'Map':
recallNotice.send('来自【'+ name + '】的【' + username + '】撤回了一个位置信息:' + (mss[i].location)['label'])
bot.file_helper.send('来自【'+ name + '】的【' + username + '】撤回了一个位置信息:' + (mss[i].location)['label'])
break
elif mss[i].type == 'Card':
card = mss[i].card
name = card.name
if name == None or name == '':
name = card.nick_name
sex = str(card.sex)
if sex == '1':
sex = '男'
else:
sex = '女'
recallNotice.send('来自【'+ name + '】的【' + username + '】撤回了一张名片:名称:'+ name +',性别:' + sex)
bot.file_helper.send('来自【'+ name + '】的【' + username + '】撤回了一张名片:名称:'+ name +',性别:' + sex)
break
elif mss[i].type == 'Sharing':
recallNotice.send('来自【'+ name + '】的【' + username + '】撤回了一个分享:' + mss[i].url)
bot.file_helper.send('来自【'+ name + '】的【' + username + '】撤回了一个分享:' + mss[i].url)
break
elif mss[i].type == 'Picture':
mss[i].raw.get('Text')(mss[i].file_name)
bot.file_helper.send('来自【'+ name + '】的【' + username + '】撤回了一张图片,图片正在加载。。。')
bot.file_helper.send_image(mss[i].file_name)
recallNotice.send('来自【'+ name + '】的【' + username + '】撤回了一张图片,图片正在加载。。。')
recallNotice.send_image(mss[i].file_name)
break
elif mss[i].type == 'Recording':
mss[i].raw.get('Text')(mss[i].file_name)
bot.file_helper.send('来自【'+ name + '】的【' + username + '】撤回了一条语音,语音正在加载。。。')
bot.file_helper.send_file(mss[i].file_name)
recallNotice.send('来自【'+ name + '】的【' + username + '】撤回了一条语音,语音正在加载。。。')
recallNotice.send_file(mss[i].file_name)
break
elif mss[i].type == 'Attachment':
mss[i].raw.get('Text')(mss[i].file_name)
bot.file_helper.send('来自【'+ name + '】的【' + username + '】撤回了一个文件,文件正在加载。。。')
bot.file_helper.send_file(mss[i].file_name)
recallNotice.send('来自【'+ name + '】的【' + username + '】撤回了一个文件,文件正在加载。。。')
recallNotice.send_file(mss[i].file_name)
break
elif mss[i].type == 'Video':
mss[i].raw.get('Text')(mss[i].file_name)
bot.file_helper.send('来自【'+ name + '】的【' + username +'】撤回了一个视频,视频正在加载。。。')
bot.file_helper.send_video(mss[i].file_name)
recallNotice.send('来自【'+ name + '】的【' + username +'】撤回了一个视频,视频正在加载。。。')
recallNotice.send_video(mss[i].file_name)
break
while True:
schedule.run_pending()
time.sleep(1)