0
点赞
收藏
分享

微信扫一扫

Python 微信机器人-用itchat库向好友发送名片、转发名片实例演示


先看效果图​:

我发给机器人的名片,它存了下来,然后再发送给我。

Python 微信机器人-用itchat库向好友发送名片、转发名片实例演示_python

itchat.content.CARD​ 就是名片类型,当微信接收到名片就会触发。

itchat.send_raw_msg()​ 就是发送名片。

只要记录 ​msg[‘MsgType’]​ 和 ​msg[‘Content’]​ 的值就可以保存名片信息。

msg[‘FromUserName’]​ 是指定把名片发送给谁。

#!/user/bin/env python
# -*- coding:utf-8 -*-
import itchat

# 接收名片
@itchat.msg_register(itchat.content.CARD, isFriendChat = True)
def send_card(msg):
itchat.send_raw_msg(msg['MsgType'], msg['Content'], msg['FromUserName'])

itchat.auto_login(hotReload = True)
itchat.run()

喜欢的点个赞❤吧!



举报

相关推荐

用Python发送微信消息给好友

微信机器人

0 条评论