(reply)
return funcname, kwargs
将主动回复生成的reply转换为被动回复的方法及变量
        :type reply: wechatpy.replies.BaseReply
将主动回复生成的reply转换为被动回复的方法及变量
        :type reply: wechatpy.replies.BaseReply
将主动回复生成的reply转换为被动回复的方法及变量 : type reply : wechatpy . replies . BaseReply
def reply2send(reply):
        """
        将主动回复生成的reply转换为被动回复的方法及变量
        :type reply: wechatpy.replies.BaseReply
        """
        if not reply or isinstance(reply, replies.EmptyReply):
            return None, None
        type = ""
        kwargs = dict(user_id=reply.target)
        if isinstance(reply, replies.ArticlesReply):
            kwargs["articles"] = deepcopy(reply.articles)
            for article in kwargs["articles"]:
                article["picurl"] = article["image"]
                del article["image"]
            type = "articles"
        elif isinstance(reply, replies.MusicReply):
            kwargs["url"] = reply.music_url
            kwargs["hq_url"] = reply.hq_music_url
            kwargs["thumb_media_id"] = reply.thumb_media_id
            kwargs["title"] = reply.title
            kwargs["description"] = reply.description
        elif isinstance(reply, replies.VideoReply):
            kwargs["media_id"] = reply.media_id
            kwargs["title"] = reply.title
            kwargs["description"] = reply.description
        elif isinstance(reply, (replies.ImageReply, replies.VoiceReply)):
            kwargs["media_id"] = reply.media_id
        elif isinstance(reply, replies.TextReply):
            kwargs["content"] = reply.content
        else:
            raise MessageHandleError("unknown reply type")
        type = type or reply.type
        funcname = "send_" + type
        return funcname, kwargs
def reply2send ( reply ) : if not reply or isinstance ( reply , replies . EmptyReply ) : return None , None type = "" kwargs = dict ( user_id = reply . target ) if isinstance ( reply , replies . ArticlesReply ) : kwargs [ "articles" ] = deepcopy ( reply . articles ) for article in kwargs [ "articles" ] : article [ "picurl" ] = article [ "image" ] del article [ "image" ] type = "articles" elif isinstance ( reply , replies . MusicReply ) : kwargs [ "url" ] = reply . music_url kwargs [ "hq_url" ] = reply . hq_music_url kwargs [ "thumb_media_id" ] = reply . thumb_media_id kwargs [ "title" ] = reply . title kwargs [ "description" ] = reply . description elif isinstance ( reply , replies . VideoReply ) : kwargs [ "media_id" ] = reply . media_id kwargs [ "title" ] = reply . title kwargs [ "description" ] = reply . description elif isinstance ( reply , ( replies . ImageReply , replies . VoiceReply ) ) : kwargs [ "media_id" ] = reply . media_id elif isinstance ( reply , replies . TextReply ) : kwargs [ "content" ] = reply . content else : raise MessageHandleError ( "unknown reply type" ) type = type or reply . type funcname = "send_" + type return funcname , kwargs