Wechat chat robot implementation

 





Now more and more people use wechat chat, in wechat contact emotion, when your stupid friend is not happy, find your wechat chat, and you do not have time, or did not see in time, you can set up wechat chat robot to tease him, or flirt your favorite she/he.

All right, without further ado, let’s start practicing.

The required environment

System: Windows8.1 (Other Windows versions /Linux/Mac OS)

Python: Python3.6 (3.4~3.7)

Editor: I used PyCharm

Specific principles

After receiving the reply from the Turing robot, the message will be forwarded to the friend, which is to build a communication bridge between the Turing robot and the friend.

The specific implementation steps are as follows:

1, download the relevant environment and editor, the installation package links: pan.baidu.com/s/148jhViqs… Extraction code: F68G.

2. Register a Turing robot and get APIkey. See the registration link for a tutorial.

3. Install wxpy, Requests, ITchat, and Wxpy packages using PIP to simplify the development process.

Installing dependency packages

PIP install wxpy requests itchat

The implementation code

Fromwxpyimport * API_key =” register the Turing robot to obtain the APIkey”bot = bot ()tuling = tuling (API_key = API_key)my_group = Ensure_one (bot.groups().search(” wechat group name “))my_friend = Register (my_group)defauto_replay_group(MSG):tuling.do_reply(MSG)@bot.regi ster(my_friend)defauto_replay_person(msg):tuling.do_reply(msg)bot.join()

Realize the screenshot

Wechat group implementation:




Wechat picture _20180721223850. JPG

Wechat friends to achieve:




Wechat picture _20180721223618.jpg

For the first time, if there is a mistake, but also hope to point out, thank you!!

By: Leo