cpp-mirai-client  v2.6.1
cpp client for mirai-api-http
QuoteMessage.cpp
浏览该文件的文档.
1// Copyright (C) 2022 Numendacil and contributors
2//
3// This program is free software: you can redistribute it and/or modify
4// it under the terms of the GNU Affero General Public License as
5// published by the Free Software Foundation, either version 3 of the
6// License, or (at your option) any later version.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU Affero General Public License for more details.
12//
13// You should have received a copy of the GNU Affero General Public License
14// along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16#include "QuoteMessage.hpp"
17
18#include <memory>
19
20#include "MessageChain.hpp"
21
22namespace Mirai
23{
24
26
28: QuoteId_(rhs.QuoteId_), GroupId_(rhs.GroupId_), SenderId_(rhs.SenderId_), TargetId_(rhs.TargetId_)
29{
30 if (rhs.origin_)
31 this->origin_ = std::make_unique<MessageChain>(*rhs.origin_);
32}
33
35{
36 if (&rhs != this)
37 {
38 this->QuoteId_ = rhs.QuoteId_;
39 this->GroupId_ = rhs.GroupId_;
40 this->SenderId_ = rhs.SenderId_;
41 this->TargetId_ = rhs.TargetId_;
42 if (rhs.origin_)
43 {
44 if (!this->origin_)
45 this->origin_ = std::make_unique<MessageChain>(*rhs.origin_);
46 else
47 *this->origin_ = *rhs.origin_;
48 }
49 else
50 this->origin_ = nullptr;
51 }
52 return *this;
53}
54
57
59{
60 if (!this->origin_)
61 return {};
62 return *this->origin_;
63}
64
65} // namespace Mirai
消息链对象,由一系列消息元素组成
引用回复消息
MessageId_t QuoteId_
MessageChain GetOriginMessage() const
获取被引用消息
std::unique_ptr< MessageChain > origin_
QuoteMessage & operator=(const QuoteMessage &)
所有mirai相关的对象的命名空间