您的位置:首頁技術文章
文章詳情頁

python的 itchat微信api文檔的 itchat.send如何發信息給指定用戶?

瀏覽:89日期: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’)

標簽: 微信 Python
相關文章:
国产综合久久一区二区三区