-
Notifications
You must be signed in to change notification settings - Fork 715
撤回Recall
HanSon edited this page Mar 16, 2017
·
1 revision
属性 | 类型 | 含义 |
---|---|---|
msg | array | 消息的原始数组 |
origin | Object | 上一条撤回的消息 |
nickname | string | 上一条撤回消息者的昵称 |
Array
(
[MsgId] => 1402455514378948514
[FromUserName] => @2aefd23a286785769c6be1cd61d53efc
[ToUserName] => @2aefd23a286785769c6be1cd61d53efc
[MsgType] => 10002
[Content] => <sysmsg type="revokemsg"><revokemsg><session>fasdsfsa</session><oldmsgid>1661714834</oldmsgid><msgid>5422797170480118739</msgid><replacemsg><![CDATA[你撤回了一条消息]]></replacemsg></revokemsg></sysmsg>
[Status] => 4
[ImgStatus] => 1
[CreateTime] => 1484644930
[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] => 0
[ImgWidth] => 0
[SubMsgType] => 0
[NewMsgId] => 1402455514378948514
[OriContent] =>
)
消息子类
$robot->server->setMessageHandler(function ($message){
// 撤回信息
if ($message instanceof Recall && $message->msg['FromUserName'] !== myself()->username) {
/** @var $message Recall */
if($message->origin instanceof Image){
Text::send($message->msg['FromUserName'], "{$message->nickname} 撤回了一张照片");
Image::sendByMsgId($message->msg['FromUserName'], $message->origin->msg['MsgId']);
}elseif($message->origin instanceof Emoticon){
Text::send($message->msg['FromUserName'], "{$message->nickname} 撤回了一个表情");
Emoticon::sendByMsgId($message->msg['FromUserName'], $message->origin->msg['MsgId']);
}elseif($message->origin instanceof Video){
Text::send($message->msg['FromUserName'], "{$message->nickname} 撤回了一个视频");
Video::sendByMsgId($message->msg['FromUserName'], $message->origin->msg['MsgId']);
}elseif($message->origin instanceof Voice){
Text::send($message->msg['FromUserName'], "{$message->nickname} 撤回了一条语音");
}else{
Text::send($message->msg['FromUserName'], "{$message->nickname} 撤回了一条信息 \"{$message->origin->msg['Content']}\"");
}
}
});