python实现微信不断给好友发消息

温馨提示:对好友谨慎使用,以免被删好友

微信需要能够登录网页版微信才能使用

1
2
3
4
5
6
7
8
9
10
11
12
import itchat
import time

print('扫一下弹出来的二维码')
itchat.auto_login(hotReload = True)
boom_remark_name = input('输入你要发消息的人的微信备注,按回车键继续:')
message = input('输入你要发送的内容,按回车键开始发送:')
boom_obj = itchat.search_friends(remarkName = boom_remark_name)[0]['UserName']
while True:
time.sleep(0.5)
print('消息已经发送')
itchat.send_msg(msg=message, toUserName=boom_obj)