    def append(self, msg):
        """
        仅当 self.max_history 为 int 类型，且大于 0 时才保存历史消息
        """
        with self._thread_lock:
            if isinstance(self.max_history, int) and self.max_history > 0:
                del self[:-self.max_history + 1]
                return super(Messages, self).append(msg)
仅当 self.max_history 为 int 类型，且大于 0 时才保存历史消息
wxpy/api/messages/messages.py