Implementing WeChat interface with Python (2)

Implementing WeChat interface with Python (2)

Column

❈The boy who loves to lie , the columnist of the Python Chinese community

Blog: https://chenjiabing666.github.io

Group news

3.key values ​​have been added, as follows: isAt Determine whether @ this number ActualNickName: Actual NickName (nickname) Content: Actual Content test program

Priority of registration messages

In general, the subsequent registration of the same type of message will overwrite the previously registered message, see the document for detailshttps://itchat.readthedocs.io/zh/latest

Message content

Note: All message content can be accessed using key-value pairs. For example, msg["FromUserName] is to view the sender, itchat.search_friends(userName=msg['FromUserName'])['NickName'] is to view the sender The sender’s nickname is a general message, and general messages follow the following content:

Initialization message

Text message

Picture message

itchat adds the Text key, the key value is the method of downloading the picture.

Extension: If you want to get the specific content in Content, you can use regular expressions to match it out

Video message

**itchat adds Text key, the key value is the method of downloading the video.

Geolocation news

itchat adds the Text key, the key value is the text form of the location.

Business card message

itchat adds the Text key, the key value is the attribute required for this call to add_friend.

Below is the test code for adding friends

Voice messages

*itchat adds the Text key, the key is the method to download the voice file, and the downloaded file is in MP3 format

Download method: msg'Text'

Animated emoticons

itchat added the Text key, the key value is the method of downloading the picture emoticon. Note: I personally test that the emoji provided by some WeChat stores cannot be downloaded successfully. The emoji that comes with it here belongs to the TEXT category, so if it is registered as a PICTURE message type, it cannot be monitored.

Common link or app sharing message

Mainly aimed at shared articles, etc.

Music link message

Mainly for music

Review: Implementing WeChat Interface with Python (1)

Reference: https://cloud.tencent.com/developer/article/1033559 Implementing WeChat interface with Python (2)-Cloud + Community-Tencent Cloud