def chgr_reply(msg):
#print(msg)
chcont=msg['Content']
if chcont.find('revokemsg')>0:
loc1=max(chcont.find('/oldmsgid><msgid>')+26,chcont.find('</oldmsgid><msgid>')+18)
loc2=max(chcont.find('</msgid><replacemsg><![CDATA'),chcont.find('</msgid><replacemsg><![CDATA'))
messageid=chcont[loc1:loc2]
print(messageid)
chtext=msg['Text']
print(chtext)
chlen=len(chtext)
aname=chtext[:chlen-7]
try:
oritun=IDandTUN[str(messageid)]
orifun=IDandFUN[str(messageid)]
except:
print('dont chehui twice')
if (oritun==myusrname or orifun==myusrname)and (chtext.find('You')>0 or chtext.find('?')>0) or chtext=="You've recalled a message.":
aname='myself'
else:
aname=aname + '[not me]'
try:
itchat.send("[Autoreply] The message revoked by '"+aname+"' just now is :"+IDandMESSAGE[str(messageid)],oritun)
itchat.send("[Autoreply] The message revoked by '"+aname+"' just now is :"+IDandMESSAGE[str(messageid)],orifun)
except:
print("-----Can't find original msg")
评论列表
文章目录