Code to run after WeChat can log on and forwarding messages, now turn to how to add forwarding messages by default the interim head and delete the first name? Feel the interim head and take my name was completely unable to use!
the from wxpy import *
The entire content of the # import wxpy module
Bot bot=()
Popup qr code # initialization of robot, computer, mobile phone WeChat scan code in
Bot. Groups (update=True, contact_only=False)
# WeChat after landing, update WeChat group list (including not save to address book group)
My_groups=bot. The groups (). The search (' Turing main hair ')
# to find out the name including "Turing main hair" group, suppose we have two WeChat group, respectively called "Turing the main group of 1", "Turing Lord send 2 group", if you have 3 or more Turing main group, the code above can all find out, and is realized in the code behind the group synchronization,
My_groups [0]. Update_group (members_details=True)
# update "Turing the main group of 1" the member list of information
My_groups [1]. Update_group (members_details=True)
# update "Turing Lord send 2 group of" the member list of information
@ bot. Register (my_groups, except_self=False)
Def sync_my_groups (MSG) :
My_name=MSG. Member. The name + ':'
# for forwarding messages plus prefix, name and a colon group members, members of the group name from note, group of nicknames, WeChat nickname inside in order to automatically,
Sync_message_in_groups (MSG, my_groups, prefix=my_name)
@ bot. Register (my_groups, except_self=False)
# registration message response to an event, once receive Turing Lord send group messages, execute the following code synchronization message, robot itself in the group of information also synchronized,
Def sync_my_groups (MSG) :
Sync_message_in_groups (MSG, my_groups)
# synchronization "Turing the main group of 1" and "Turing Lord send 2 group", including text, images, video, voice, file sharing, regular expressions, map, etc.,
Bot. The join ()
# blocking thread, to keep the robot run