文章詳情頁
python的 itchat微信api文檔的 itchat.send如何發信息給指定用戶?
瀏覽:127日期: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. linux - 編譯時提示頭文件#include <mysql/mysql.h>不存在,百度之后也沒解決2. html - 內嵌app 的web 頁面如何應用 app 內置的靜態文件3. javascript - immutable配合react提升性能?4. JAVA 版本問題?5. node.js - webpack --watch以后報錯env: node: No such file or directory6. html頁面中怎么將兩個點之間的距離用直線連接起來?7. java - yuicompressor-maven-plugin 合并可用卻不壓縮, 哪配置不對?8. css3 - 如何出現橫向捲軸?9. java - Spring +Mybatis 事務 不能回滾10. PHP類中的$this
排行榜
