如何知道自己被别人删除了?
向已经删除你的人发信息会收到note类型的message status == 4!
if msg["Status"] == 4:
如何做到给别人发信息不打扰到正常好友?
利用特殊字符"ॣ ॣ ॣ" !
newInstance.send("ॣ ॣॣ", toUserName=user["UserName"])
代码如下:
import itchat
import time
import threading
from multiprocessing import Pool
newInstance = itchat.new_instance()
nosingList = []
balckList = []
def longtime():
print("进来了")
def new():
friendslist = newInstance.get_friends()
for user in friendslist:
if user["Signature"] == "":
nosingList.append(user)
for user in nosingList:
try:
newInstance.send("ॣ ॣॣ", toUserName=user["UserName"])
except NotImplementedError:
print("加好友失败%s" % user["UserName"])
finally:
print("发送给了 %s" % user["UserName"])
time.sleep(0.5)
t = threading.Thread(target=new, name='LoopThread')
t.start()
t.join()
@newInstance.msg_register(itchat.content.NOTE)
def text_reply(msg):
print(msg)
if msg["Status"] == 4:
print(msg["User"]["NickName"] + "已经删除了你")
newInstance.send((msg["User"]["NickName"] + "已经删除或拉黑了你"),toUserName='filehelper')
balckList.append(msg["User"]["NickName"])
print(balckList)
newInstance.set_alias(userName=msg["FromUserName"],alias="A删除了你的人")
@newInstance.msg_register(itchat.content.TEXT)
def text_reply(msg):
print(msg)
if msg.text == "开始测试":
print("开始测试了")
longtime()
newInstance.auto_login(hotReload=False)
newInstance.run(debug=True, blockThread=True)
How to use !
脚本运行以后需要扫描登录网页版微信,登录成功以后向任意一个好友发送"开始测试"四个字,个人建议发给文件助手.
测试完成以后测试结果会逐条发送到文件助手,并且在通讯录中会将删除你的好友改成备注 'A删除了你的人'