import itchat
from itchat.content import*
@itchat.msg_register([TEXT, MAP, CARD, NOTE, SHARING], isGroupChat=True)
def group_text(msg):
group = itchat.get_chatrooms(update=True)
test = ''
for g in group:
if g['NickName'] == '群一':
from_group = g['UserName']
for menb in g['MemberList']:
if menb['NickName'] == "桃之夭夭":
test = menb['UserName']
if g['NickName'] == '兔子':
to_group = g['UserName']
if msg['FromUserName'] == from_group:
if msg['ActualUserName'] == test:
itchat.send('【转发来自群一】:%s'%(msg['Content']),to_group)
@itchat.msg_register([PICTURE, ATTACHMENT, VIDEO,RECORDING], isGroupChat=True)
def group_reply_media1(msg):
group = itchat.get_chatrooms(update=True)
test = ''
for g in group:
if g['NickName'] == '群一':
from_group = g['UserName']
for menb in g['MemberList']:
#print(menb['NickName'])
if menb['NickName'] == "桃之夭夭":
test = menb['UserName']
if g['NickName'] == '兔子':
to_group = g['UserName']
msg['Text'](msg['FileName'])
if msg['FromUserName'] == from_group:
if msg['ActualUserName'] == test:
msg['Text'](msg['FileName'])
itchat.send('@%s@%s'%({'Picture': 'img', 'Video': 'vid'}.get(msg['Type'], 'fil'),msg['FileName']),to_group)
itchat.auto_login(enableCmdQR=True)
itchat.run()