自動マイクロチャネルチャットスクリプト



Automatic Micro Channel Chat Script



import re import time import itchat from itchat.content import * # Single chat (text) @itchat.msg_register(itchat.content.TEXT) def tuling_reply(msg): reply = r'1' # Auto-reply nickname replay_friend = [ 'Monet rain', 'salted rice Dian'] #NickName indicates the nickname of a signal rather than a micro name = itchat.search_friends(userName=msg['FromUserName'])['NickName'] if name in replay_friend: # Obtain an acceptable text message = msg['Text'] if u 'Yuquan' in message and u 'explain' in message and u 'Registration' in message: return reply # Group chat (text) @itchat.msg_register(itchat.content.TEXT, isGroupChat=True) def group_text_reply(msg): reply = r'1' name = itchat.search_chatrooms(userName=msg['FromUserName'])['NickName'] if name == u'Lab306 active group ': # replaced with the name of their own group print(name) print(msg['Text']) message = msg['Text'] if u 'Yuquan' in message and u 'explain' in message and u 'Registration' in message: # # @ Of course, if you just want for people to reply, you can set if msg [ 'isAt']: # if msg['isAt']: # return reply return reply if __name__ == '__main __': # enable micro-channel automatic login, login two-dimensional code itchat.auto_login(hotReload=True) itchat.run()