设为首页 加入收藏

TOP

python实现微信接口(itchat)(九)
2017-12-23 06:07:03 】 浏览:1400
Tags:python 实现 接口 itchat
gt;

                <sourceusername></sourceusername>

                <sourcedisplayname></sourcedisplayname>

                <commenturl></commenturl>

                <thumburl>

                    http://imgcache.qq.com/music/photo/album/63/180_albumpic_143163_0.jpg

                </thumburl>

                <md5></md5>

            </appmsg>

            <fromusername></fromusername>

            <scene>0</scene>

            <appinfo>

                <version>29</version>

                <appname>摇一摇搜歌</appname>

            </appinfo>

            <commenturl></commenturl>

        </msg>

群消息

itchat 增加了三个群聊相关的键值:

  • isAt : 判断是否 @ 本号
  • ActualNickName : 实际 NickName
  • Content : 实际 Content

MsgType: 1

FromUserName: @@xxx

ToUserName: @xxx

Content:

    @xxx:<br/>xxx

红包消息

 MsgType: 49

    AppMsgType: 2001

    FromUserName: 发送方ID

    ToUserName: 接收方ID

    Content: 未知

系统消息

 MsgType: 10000

    FromUserName: 发送方ID

    ToUserName: 自己ID

    Content:

        "你已添加了 xxx ,现在可以开始聊天了。"

        "如果陌生人主动添加你为朋友,请谨慎核实对方身份。"

        "收到红包,请在手机上查看"

账号类型

tchat 为三种账号都提供了整体获取方法与搜索方法.

好友

get_friends

  • itchat.get_friends() 返回完整的好友列表
  • 每个好友为一个字典, 其中第一项为本人的账号信息;
  • 传入 update=True, 将更新好友列表并返回, get_friends(update=True)

search_friends

  • itchat.get_friends() 好友搜索,有以下四种方式
  • 仅获取自己的用户信息

# 获取自己的用户信息,返回自己的属性字典

itchat.search_friends()

  • 获取特定 UserName 的用户信息

 

# 获取特定UserName的用户信息

itchat.search_friends(userName='@abcdefg1234567')

 

## 获取发送信息的好友的详细信息

@itchat.msg_register(itchat.content.TEXT,isFriendChat=True)

def reply(msg):

  &

首页 上一页 6 7 8 9 10 11 12 下一页 尾页 9/14/14
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Python字符串操作 下一篇python 面向对象十 __init__和__n..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目