Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
fix(cpp): set UnSupportMessage can't be sent
Browse files Browse the repository at this point in the history
Former-commit-id: 186a056
  • Loading branch information
Nambers committed Feb 7, 2022
1 parent 1991566 commit a9e0288
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cpp/include/MessageChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions cpp/include/SingleMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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){};
Expand Down

0 comments on commit a9e0288

Please sign in to comment.