文章詳情頁
python的 itchat微信api文檔的 itchat.send如何發(fā)信息給指定用戶?
瀏覽:77日期: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’’}}>
不能發(fā)給自己信息
itchat.send(’hello’,toUserName = User)
發(fā)給別人也不行( User 是一個微信號 )
問題解答
回答1:#想給誰發(fā)信息,先查找到這個朋友users = itchat.search_friends(name=u’通訊錄備注名’)#找到UserNameuserName = users[0][’UserName’]#然后給他發(fā)消息itchat.send(’hello’,toUserName = userName)
或者每直接用這個用戶發(fā)送
user = itchat.search_friends(name=u’通訊錄備注名’)[0]user.send(u’機(jī)器人say hello’)
相關(guān)文章:
1. macos - mac下docker如何設(shè)置代理2. java - 請問在main方法中寫成對象名.屬性()并賦值,與直接參參數(shù)賦值輸錯誤是什么原因?3. MySQL數(shù)據(jù)庫中文亂碼的原因4. 關(guān)docker hub上有些鏡像的tag被標(biāo)記““This image has vulnerabilities””5. docker不顯示端口映射呢?6. docker - 各位電腦上有多少個容器啊?容器一多,自己都搞混了,咋辦呢?7. android studio總是在processes running好久8. angular.js - 關(guān)于$apply()9. docker-compose 為何找不到配置文件?10. dockerfile - 我用docker build的時候出現(xiàn)下邊問題 麻煩幫我看一下
排行榜

熱門標(biāo)簽