代码拉取完成,页面将自动刷新
#coding=utf-8
import itchat
from itchat.content import *
@itchat.msg_register(TEXT, isGroupChat=True)
def group_text(msg):
group = itchat.get_chatrooms(update=True)
from_user = ''
for g in group:
if g['NickName'] == '材硕18级班长支书们':#从群中找到指定的群聊
from_group = g['UserName']
for menb in g['MemberList']:
#print(menb['NickName'])
if menb['NickName'] == "这是发布通知的大佬名字":
from_user = menb['UserName']
break
if g['NickName'] == '材硕1801':#把消息发到这个群
to_group = g['UserName']
if msg['FromUserName'] == from_group:
if msg['ActualUserName'] == from_user:
itchat.send('[大佬有话要说] %s:%s'%(msg['ActualNickName'],msg['Content']),to_group)
@itchat.msg_register([PICTURE, ATTACHMENT, VIDEO], isGroupChat=True)
def group_reply_media(msg):
group = itchat.get_chatrooms(update=True)
from_user = ''
for g in group:
if g['NickName'] == '材硕18级班长支书们':#从群中找到指定的群聊
from_group = g['UserName']
for menb in g['MemberList']:
#print(menb['NickName'])
if menb['NickName'] == "这是发布通知的大佬名字":
from_user = menb['UserName']
break
if g['NickName'] == '材硕1801':#把消息发到这个群
to_group = g['UserName']
msg['Text'](msg['FileName'])
if msg['FromUserName'] == from_group:
if msg['ActualUserName'] == from_user:
msg['Text'](msg['FileName'])
itchat.send('@%s@%s'%({'Picture': 'img', 'Video': 'vid'}.get(msg['Type'], 'fil'),msg['FileName']),to_group)
itchat.auto_login(hotReload=False,enableCmdQR=2)
itchat.run()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。