From a9e0288971f009ee9095f59ce49d5be264d45581 Mon Sep 17 00:00:00 2001 From: Eritque arcus <1930893235@qq.com> Date: Mon, 7 Feb 2022 11:58:26 +0800 Subject: [PATCH] fix(cpp): set UnSupportMessage can't be sent Former-commit-id: 186a056f04343f7eafc79a12775d46b996766db0 --- cpp/include/MessageChain.cpp | 2 +- cpp/include/SingleMessage.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cpp/include/MessageChain.cpp b/cpp/include/MessageChain.cpp index 30e8574b0..03342f2ab 100644 --- a/cpp/include/MessageChain.cpp +++ b/cpp/include/MessageChain.cpp @@ -181,7 +181,7 @@ namespace MiraiCP { Logger::logger.error( "MiraiCP碰到了意料之中的错误(原因:接受到的SimpleMessage在MessageSource解析支持之外)\n请到MiraiCP(github.com/Nambers/MiraiCP)发送issue并复制本段信息使MiraiCP可以支持这种消息: MessageSource:" + j.dump()); - mc.add(UnSupportMessage(node["content"])); + mc.add(UnSupportMessage(node.dump())); } } return mc; diff --git a/cpp/include/SingleMessage.h b/cpp/include/SingleMessage.h index b8104613a..3eaf53e63 100644 --- a/cpp/include/SingleMessage.h +++ b/cpp/include/SingleMessage.h @@ -545,13 +545,14 @@ namespace MiraiCP { return this->faceId == mf.faceId; } }; - /// @brief 目前不支持的消息类型 + /// @brief 目前不支持的消息类型, 不支持发送 class UnSupportMessage : public SingleMessage { public: static int type() { return -1; } nlohmann::json toJson() const override; - std::string toMiraiCode() const override { - return content; + /// 不支持发送 + [[deprecated("不支持直接发送UnSupportMessage")]] std::string toMiraiCode() const override { + return ""; } explicit UnSupportMessage(const SingleMessage &s) : SingleMessage(s){};