Skip to content

表情Emoticon

HanSon edited this page Mar 17, 2017 · 2 revisions

属性

属性 类型 含义
msg array 消息的原始数组

msg

Array
(
    [MsgId] => 6772641265151554495
    [FromUserName] => @2aefd23a286785769c6be1cd61d53efc
    [ToUserName] => @@72ff7269e94ee5d193cd0ead19de219355587e6fff8517e938877c48e595e34f
    [MsgType] => 47
    [Content] => <msg><emoji fromusername = "fasdsfsa" tousername = "1612649397@chatroom" type="1" idbuffer="media:0_0" md5="2f3091f91f072885162e8a386d89df1d" len = "30868" productid="" androidmd5="2f3091f91f072885162e8a386d89df1d" androidlen="30868" s60v3md5 = "2f3091f91f072885162e8a386d89df1d" s60v3len="30868" s60v5md5 = "2f3091f91f072885162e8a386d89df1d" s60v5len="30868" cdnurl = "http://emoji.qpic.cn/wx_emoji/5knfxytWpeicFUW49jSp5mWokicKujpEtF9vBwvnGhHa49TdQllib4XJA/" designerid = "" thumburl = "" encrypturl = "http://emoji.qpic.cn/wx_emoji/Td29TU4DXH6EOICHRHewenUVDDnic2Psdo9eILUibHhkaHAJ8rg6GIbg/" aeskey= "a577b9bfc7992baa1f8a954f47e16790" width= "200" height= "200" ></emoji> </msg>
    [Status] => 3
    [ImgStatus] => 2
    [CreateTime] => 1484641975
    [VoiceLength] => 0
    [PlayLength] => 0
    [FileName] =>
    [FileSize] =>
    [MediaId] =>
    [Url] =>
    [AppMsgType] => 0
    [StatusNotifyCode] => 0
    [StatusNotifyUserName] =>
    [RecommendInfo] => Array
        (
            [UserName] =>
            [NickName] =>
            [QQNum] => 0
            [Province] =>
            [City] =>
            [Content] =>
            [Signature] =>
            [Alias] =>
            [Scene] => 0
            [VerifyFlag] => 0
            [AttrStatus] => 0
            [Sex] => 0
            [Ticket] =>
            [OpCode] => 0
        )

    [ForwardFlag] => 0
    [AppInfo] => Array
        (
            [AppID] =>
            [Type] => 0
        )

    [HasProductId] => 0
    [Ticket] =>
    [ImgHeight] => 200
    [ImgWidth] => 200
    [SubMsgType] => 0
    [NewMsgId] => 6772641265151554495
    [OriContent] =>
)

方法

Emoticon::send($username, $emoticon); 发送表情消息, $emoticon为表情路径 Emoticon::sendByMsgId($username, $msgId); 发送某消息id的表情

栗子

$robot->server->setMessageHandler(function ($message){
    // 发送收到的表情
    if ($message instanceof Emoticon) {
        return $message;
    }

    // 表情库随机发送表情
    Emoticon::sendRandom($message->from['UserName']); 
});
Clone this wiki locally