文章详情页
python的 itchat微信api文档的 itchat.send如何发信息给指定用户?
浏览:93日期:2022-06-29 11:06:53
问题描述
itchat.send_msg(’Hello world’)<ItchatReturnValue: {u’MsgID’: u’’, u’LocalID’: u’’, u’BaseResponse’: {u’ErrMsg’: u’’, u’Ret’: 1204, ’RawMsg’: u’’}}>
不能发给自己信息
itchat.send(’hello’,toUserName = User)
发给别人也不行( User 是一个微信号 )
问题解答
回答1:#想给谁发信息,先查找到这个朋友users = itchat.search_friends(name=u’通讯录备注名’)#找到UserNameuserName = users[0][’UserName’]#然后给他发消息itchat.send(’hello’,toUserName = userName)
或者每直接用这个用户发送
user = itchat.search_friends(name=u’通讯录备注名’)[0]user.send(u’机器人say hello’)
相关文章:
1. java - CompletableFuture allof 超时处理2. angular.js - angularjs的自定义过滤器如何给文字加颜色?3. 如何分别在Windows下用Winform项模板+C#,在MacOSX下用Cocos Application项目模板+Objective-C实现一个制作游戏的空的黑窗口?4. python - TypeError: tryMsgcode() takes exactly 2 arguments (0 given)5. javascript - 关于json中获取多个key-value对中多层嵌套key的name6. android clickablespan获取选中内容7. 关于docker下的nginx压力测试8. android - 启动模拟器的,报“Could not automatically detect an ADB binary……”,要怎么解决?9. javascript - 最终生成的jsBundle文件压缩问题10. docker安装后出现Cannot connect to the Docker daemon.
排行榜
