In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to use itchat in python to achieve a Wechat robot, the content is concise and easy to understand, absolutely can make your eyes bright, through the detailed introduction of this article hope you can get something.
Send (msg= "Text Message", toUserName=None) msg represents the text sent, and toUserName represents the object to be sent. Of course, if you want to send a message to someone after logging in, then first you need to get the name you want to send, you can do this:
Of course, the send function can also send files, pictures and videos.
Itchat.send ("Hello World!") # sending text is equivalent to send_msg () ithcat.send ("@ fil@%s"%'/ tmp/test.text') # sending files is equivalent to send_file () ithcat.send ("@ img@%s"%'/ tmp/test.png') # sending pictures is equivalent to send_img () ithcat.send ("@ vid@%s"%'/ tmp/test.mkv') # sending videos is equivalent to send_video ()
Try Niudao 2: we try to add a small function (automatic reply)
The TEXT here means that the method is called when a message is received, and the reply is the same as the message received. If you write from itchat.content import *, then you can also write @ itchat.msg_register (TEXT). Msg already contains the content returned by Wechat in the form of a dictionary. Just call it directly. The parameters and others will be introduced one by one.
IsFriendChat stands for friends, isGroupChat for group chat, and isMapChat for official account, which can be called when set to True.
2. Take FRIENDS as an example to add automatic authentication and send messages.
Add FRIENDS as a friend to call this function.
Reply to add group and send group link:
The above is how to use itchat to implement a Wechat robot in python. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.