文章詳情頁(yè)
python的 itchat微信api文檔的 itchat.send如何發(fā)信息給指定用戶(hù)?
瀏覽:113日期:2022-06-29 11:06:53
問(wèn)題描述
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 是一個(gè)微信號(hào) )
問(wèn)題解答
回答1:#想給誰(shuí)發(fā)信息,先查找到這個(gè)朋友users = itchat.search_friends(name=u’通訊錄備注名’)#找到UserNameuserName = users[0][’UserName’]#然后給他發(fā)消息itchat.send(’hello’,toUserName = userName)
或者每直接用這個(gè)用戶(hù)發(fā)送
user = itchat.search_friends(name=u’通訊錄備注名’)[0]user.send(u’機(jī)器人say hello’)
相關(guān)文章:
1. Docker for Mac 創(chuàng)建的dnsmasq容器連不上/不工作的問(wèn)題2. java - 關(guān)于File的問(wèn)題?3. java - instance method中 static后的<K>是什么意思?4. 錯(cuò)誤:java.lang.NoSuchMethodError:org.objectweb.asm.ClassWriter。<init>(I)V6. python3.x - python連oanda的模擬交易api獲取json問(wèn)題第五問(wèn)7. java - SSH框架中寫(xiě)分頁(yè)時(shí)service層中不能注入分頁(yè)類(lèi)8. docker - 如何修改運(yùn)行中容器的配置9. javascript - QWebEngineView 如何爬 angular 的動(dòng)態(tài)數(shù)據(jù)?10. docker-machine添加一個(gè)已有的docker主機(jī)問(wèn)題
排行榜

熱門(mén)標(biāo)簽