cpp-mirai-client  v2.6.1
cpp client for mirai-api-http
PokeMessage.hpp
浏览该文件的文档.
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#ifndef MIRAI_POKE_MESSAGE_HPP_
17#define MIRAI_POKE_MESSAGE_HPP_
18
19#include <array>
20#include <string>
21
23
24#include "IMessage.hpp"
25
26namespace Mirai
27{
28
29/**
30 * @brief 戳一戳消息
31 *
32 * 原PC版窗口抖动消息,与头像戳一戳消息不同
33 *
34 * Member Variable | Default Value
35 * --------------- | -------------
36 * `PokeMessage::kind_` | `PokeType::ENUM_END`
37 */
38class PokeMessage final : public IMessageImpl<PokeMessage>
39{
41
42protected:
44
46 static constexpr bool SUPPORT_SEND_ = true;
47
48 bool isValid_() const final { return this->kind_ != PokeType::ENUM_END; }
49
50public:
51 PokeMessage() = default;
52 PokeMessage(PokeType kind) : kind_(kind) {}
53
54 bool operator==(const PokeMessage& rhs) { return this->kind_ == rhs.kind_; }
55
56 bool operator!=(const PokeMessage& rhs) { return !(*this == rhs); }
57
58 /// 获取戳一戳类型
59 PokeType GetPokeKind() const { return this->kind_; }
60
61 /// 设置戳一戳类型
63 {
64 this->kind_ = kind;
65 return *this;
66 }
67
68 struct Serializable;
69};
70
71template<> struct GetType<PokeMessage::GetType()>
72{
74};
75
76} // namespace Mirai
77
78
79#endif
CRTP helper layer
Definition: IMessage.hpp:78
戳一戳消息
Definition: PokeMessage.hpp:39
bool operator==(const PokeMessage &rhs)
Definition: PokeMessage.hpp:54
PokeType GetPokeKind() const
获取戳一戳类型
Definition: PokeMessage.hpp:59
PokeMessage(PokeType kind)
Definition: PokeMessage.hpp:52
static constexpr bool SUPPORT_SEND_
Definition: PokeMessage.hpp:46
static constexpr MessageTypes TYPE_
Definition: PokeMessage.hpp:45
PokeMessage & SetPokeKind(PokeType kind)
设置戳一戳类型
Definition: PokeMessage.hpp:62
bool operator!=(const PokeMessage &rhs)
Definition: PokeMessage.hpp:56
PokeMessage()=default
bool isValid_() const final
Definition: PokeMessage.hpp:48
所有mirai相关的对象的命名空间
PokeType
戳一戳(原窗口抖动)类型
Definition: BasicTypes.hpp:237
用于类型之间转换的辅助模板