微信必须可以登录网页才能使用此功能 微信登录
import itchat
itchat
.auto_login
()
itchat
.send
('你好,文件传输助手')
try:
username
= itchat
.search_friends
(remarkName
='好友名称')[0]['UserName']
except Exception
as e
:
print('查询好友失败,不能发送消息')
else:
itchat
.send
('wdnmd',toUserName
=username
)
微信报警
import itchat
itchat
.auto_login
(hotReload
=True)
try:
username
= itchat
.search_friends
(remarkName
='好友名称')[0]['UserName']
except Exception
as e
:
print('查询好友失败,不能发送消息')
else:
for i
in range (3):
itchat
.send
('报警内容')
print('发送成功')
转载请注明原文地址: https://lol.8miu.com/read-16189.html