文章詳情頁
python的 itchat微信api文檔的 itchat.send如何發(fā)信息給指定用戶?
瀏覽:90日期: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’機器人say hello’)
相關(guān)文章:
1. mysql 查詢身份證號字段值有效的數(shù)據(jù)2. python bottle跑起來以后,定時執(zhí)行的任務為什么每次都重復(多)執(zhí)行一次?3. 視頻文件不能播放,怎么辦?4. html5 - HTML代碼中的文字亂碼是怎么回事?5. python - 爬蟲模擬登錄后,爬取csdn后臺文章列表遇到的問題6. visual-studio - Python OpenCV: 奇怪的自動補全問題7. mysql - 分庫分表、分區(qū)、讀寫分離 這些都是用在什么場景下 ,會帶來哪些效率或者其他方面的好處8. javascript - 彈出一個子窗口,操作之后關(guān)閉,主窗口會得到相應的響應,例如網(wǎng)站的某些登錄界面,django后臺的管理等,這是怎么實現(xiàn)的呢?9. javascript - ios返回不執(zhí)行js怎么解決?10. android - 分享到微信,如何快速轉(zhuǎn)換成字節(jié)數(shù)組
排行榜

熱門標簽