':type msg: QMessageç±», äŸåŠ GroupMsg, PrivateMsg, SessMsg
:type reply_content: string, åå€çåå®¹.
:return: æå¡åšçååºåå®¹. åŠæ return_function äžº True, åè¿åçæ¯äžäžªä»æ reply_content åæ°çäŸ¿æ·åå€åœæ°.'

def reply_msg(self, msg, reply_content=None, return_function=False):

    msg_id = randint(1, 100000)
    import functools
    assert isinstance(msg, QMessage)
    if isinstance(msg, GroupMsg):
        if return_function:
            return functools.partial(self.send_group_msg, group_code=msg.group_code, msg_id=msg_id)
        return self.send_group_msg(reply_content=reply_content, group_code=msg.group_code, msg_id=msg_id)
    elif isinstance(msg, PrivateMsg):
        if return_function:
            return functools.partial(self.send_friend_msg, uin=msg.from_uin, msg_id=msg_id)
        return self.send_friend_msg(reply_content=reply_content, uin=msg.from_uin, msg_id=msg_id)
    elif isinstance(msg, SessMsg):
        pass
    elif isinstance(msg, DiscussMsg):
        if return_function:
            return functools.partial(self.send_discuss_msg, did=msg.did, msg_id=msg_id)
        return self.send_discuss_msg(reply_content=reply_content, did=msg.did, msg_id=msg_id)
