use itchat Log in wechat webpage , use schedule Send messages in a fixed period of time .
* notes : Wechat does not support web version , At present, this method cannot be used , There is no good solution . Possible ideas are direct use of stickers / Copy function and mouse / Keyboard control for information selection and transmission .
import schedule
import time
import itchat
chatTarget = ' baby ' # Wechat user name sent to
chatTime = '08:00' # Time to send messages
chatMessage = ' Good morning, baby !' # Sent content
itchat.auto_login() # Scan the code and log in web Version wechat , Restart the program to log in again
def chat():
user = itchat.search_friends(name=chatTarget) # Search in the friends list
itchat.send(chatMessage, user[0]['UserName']) # Send a message
schedule.every().day.at(chatTime).do(chat) # Plan to send messages every day at the specified time
while True:
schedule.run_pending() # Implementation plan
time.sleep(10) # Refresh interval
It looks like , While snoring, you can give your beloved in the early morning TA Send a greeting !
schedule You can also book more complicated times , Such as the first half of the week in every month .
itchat You can also get user replies , Call Turing robot API It can really realize automation !