|
cpp-mirai-client
v2.6.1
cpp client for mirai-api-http
|
提供与mirai-api-http网络交互的封装 更多...
#include <Client.hpp>
Public 类型 | |
| template<typename Event > | |
| using | EventCallback = std::function< void(Event)> |
| using | string = std::string |
Public 成员函数 | |
| MiraiClient () | |
| MiraiClient (std::unique_ptr< IAdaptor > adaptor) | |
| template<typename Adaptor , typename... Args, typename std::enable_if_t< std::is_base_of_v< IAdaptor, Adaptor >, int > = 0> | |
| MiraiClient (Args &&... args) | |
| MiraiClient (const MiraiClient &)=delete | |
| MiraiClient & | operator= (const MiraiClient &)=delete |
| MiraiClient (MiraiClient &&rhs) noexcept=delete | |
| MiraiClient & | operator= (MiraiClient &&rhs) noexcept=delete |
| ~MiraiClient () | |
| std::optional< std::string > | GetSessionKey () const |
获取连接mirai-api-http的session key,若尚未建立链接则返回 std::nullopt 更多... | |
| std::size_t | SetPoolSize (std::size_t size) |
| 设置线程池大小 更多... | |
| void | SetLogger (std::shared_ptr< ILogger > logger) |
| 设置日志记录类 更多... | |
| std::shared_ptr< ILogger > | GetLogger () const |
| 获取日志记录类 更多... | |
| void | Connect () |
| 连接mirai-api-http 更多... | |
| void | Disconnect (bool WaitForFinish=false) |
| 断开与mirai-api-http的连接 更多... | |
| bool | isConnected () const |
| 返回是否已成功连接mirai-api-http 更多... | |
| constexpr std::string_view | GetCompatibleVersion () const |
| 返回兼容的mirai-api-http的版本号 更多... | |
| string | GetMiraiApiHttpVersion () const |
| 获取mirai-api-http插件的版本号 更多... | |
| QQ_t | GetBotQQ () const |
| 获取Bot账号 更多... | |
| std::vector< QQ_t > | GetBotList () const |
| 获取mirai中可用的QQBot列表 更多... | |
| FriendMessageEvent | GetFriendMessage (MessageId_t id, QQ_t qq) const |
| 从消息id获取好友消息 更多... | |
| GroupMessageEvent | GetGroupMessage (MessageId_t id, GID_t GroupId) const |
| 从消息id获取群聊消息 更多... | |
| TempMessageEvent | GetTempMessage (MessageId_t id, GID_t GroupId) const |
| 从消息id获取临时消息 更多... | |
| StrangerMessageEvent | GetStrangerMessage (MessageId_t id, QQ_t qq) const |
| 从消息id获取陌生人消息 更多... | |
| std::vector< User > | GetFriendList () const |
| 获取好友列表 更多... | |
| std::vector< Group > | GetGroupList () const |
| 获取群聊列表 更多... | |
| std::vector< GroupMember > | GetMemberList (GID_t GroupId) const |
| 获取群成员列表 更多... | |
| std::vector< GroupMember > | GetLatestMemberList (GID_t GroupId) const |
| 获取最新群成员列表 更多... | |
| UserProfile | GetBotProfile () const |
| 获取Bot用户资料 更多... | |
| UserProfile | GetFriendProfile (QQ_t qq) const |
| 获取好友用户资料 更多... | |
| UserProfile | GetMemberProfile (GID_t GroupId, QQ_t MemberId) const |
| 获取群成员用户资料 更多... | |
| UserProfile | GetUserProfile (QQ_t qq) const |
| 获取用户资料 更多... | |
| void | SendNudge (const NudgeTarget &target) const |
| 发送头像戳一戳消息 更多... | |
| void | NudgeFriend (QQ_t qq) const |
| 发送好友戳一戳消息 更多... | |
| void | NudgeGroup (QQ_t MemberId, GID_t GroupId) const |
| 发送群聊戳一戳消息 更多... | |
| void | NudgeStranger (QQ_t qq) const |
| 发送陌生人戳一戳消息 更多... | |
| void | RecallFriendMessage (MessageId_t id, QQ_t qq) const |
| 撤回好友消息 更多... | |
| void | RecallGroupMessage (MessageId_t id, GID_t GroupId) const |
| 撤回群聊消息 更多... | |
| std::vector< MessageChain > | GetRoamingFriendMessage (QQ_t qq, std::time_t TimeStart=0, std::time_t TimeEnd=std::numeric_limits< std::time_t >::max()) const |
| 获取好友漫游消息 更多... | |
| std::vector< GroupFileInfo > | GetGroupFileList (GID_t GroupId, const FilePath &dir={}, int64_t offset=0, int64_t size=0, bool withDownloadInfo=false) const |
| 获取群文件列表 更多... | |
| GroupFileInfo | GetGroupFileInfo (GID_t GroupId, const FilePath &dir, bool withDownloadInfo=false) const |
| 获取群文件信息 更多... | |
| void | GetGroupFileInfo (GID_t GroupId, GroupFileInfo &file, bool withDownloadInfo=false) const |
| 获取群文件信息 更多... | |
| GroupFileInfo | CreateGroupFileDirectory (GID_t GroupId, string directory) const |
| 创建群文件夹 更多... | |
| void | RemoveGroupFile (GID_t GroupId, const FilePath &dir) const |
| 删除群文件 更多... | |
| void | MoveGroupFile (GID_t GroupId, const FilePath &FileDir, const FilePath &MoveToDir) const |
| 移动群文件 更多... | |
| void | RenameGroupFile (GID_t GroupId, const FilePath &FileDir, string NewName) const |
| 重命名群文件 更多... | |
| GroupFileInfo | UploadGroupFile (GID_t GroupId, string UploadPath, string name, string content) const |
| 上传群文件 更多... | |
| GroupFileInfo | UploadGroupFile (GID_t GroupId, string UploadPath, string name, std::istream &file) const |
| 上传群文件 更多... | |
| GroupFileInfo | UploadGroupFile (GID_t GroupId, string UploadPath, string name, std::function< bool(size_t offset, std::ostream &sink, bool &finish)> ContentProvider) const |
| 上传群文件 更多... | |
| FriendImage | UploadFriendImage (string content) const |
| 上传好友图片 更多... | |
| FriendImage | UploadFriendImage (std::istream &file) const |
| 上传好友图片 更多... | |
| FriendImage | UploadFriendImage (std::function< bool(size_t offset, std::ostream &sink, bool &finish)> ContentProvider) const |
| 上传好友图片 更多... | |
| GroupImage | UploadGroupImage (string content) const |
| 上传群聊图片 更多... | |
| GroupImage | UploadGroupImage (std::istream &file) const |
| 上传群聊图片 更多... | |
| GroupImage | UploadGroupImage (std::function< bool(size_t offset, std::ostream &sink, bool &finish)> ContentProvider) const |
| 上传群聊图片 更多... | |
| TempImage | UploadTempImage (string content) const |
| 上传临时会话图片 更多... | |
| TempImage | UploadTempImage (std::istream &file) const |
| 上传临时会话图片 更多... | |
| TempImage | UploadTempImage (std::function< bool(size_t offset, std::ostream &sink, bool &finish)> ContentProvider) const |
| 上传临时会话图片 更多... | |
| GroupAudio | UploadGroupAudio (string content) const |
| 上传群聊语音 更多... | |
| GroupAudio | UploadGroupAudio (std::istream &file) const |
| 上传群聊语音 更多... | |
| GroupAudio | UploadGroupAudio (std::function< bool(size_t offset, std::ostream &sink, bool &finish)> ContentProvider) const |
| 上传群聊语音 更多... | |
| void | DeleteFriend (QQ_t qq) const |
| 删除好友 更多... | |
| void | Mute (GID_t GroupId, QQ_t member, std::chrono::seconds time) const |
| 禁言群成员 更多... | |
| void | Mute (const GroupMember &member, std::chrono::seconds time) const |
| 禁言群成员 更多... | |
| void | Unmute (GID_t GroupId, QQ_t member) const |
| 解除群成员禁言 更多... | |
| void | Unmute (const GroupMember &member) const |
| 解除群成员禁言 更多... | |
| void | Kick (GID_t GroupId, QQ_t member, string message, bool block=false) const |
| 移除群成员 更多... | |
| void | Kick (const GroupMember &member, string message, bool block=false) const |
| 移除群成员 更多... | |
| void | LeaveGroup (GID_t GroupId) const |
| 退出群聊 更多... | |
| void | MuteAll (GID_t GroupId) const |
| 禁言全体成员 更多... | |
| void | UnmuteAll (GID_t GroupId) const |
| 解除全体禁言 更多... | |
| void | SetEssence (GID_t GroupId, MessageId_t MessageId) const |
| 设置群精华消息 更多... | |
| GroupConfig | GetGroupConfig (GID_t GroupId) const |
| 获取群设置 更多... | |
| void | SetGroupConfig (GID_t GroupId, string name="", std::optional< bool > AllowMemberInvite=std::nullopt) const |
| 修改群设置 更多... | |
| GroupMember | GetMemberInfo (GID_t GroupId, QQ_t member) const |
| 获取群成员资料 更多... | |
| void | SetMemberInfo (GID_t GroupId, QQ_t member, string name="", string title="") const |
| 设置群成员资料 更多... | |
| void | SetGroupAdmin (GID_t GroupId, QQ_t member, bool assign=true) const |
| 设置群管理员 更多... | |
| std::vector< GroupAnnouncement > | GetAnnouncementList (GID_t GroupId, int64_t offset=0, int64_t size=0) const |
| 获取群公告列表 更多... | |
| GroupAnnouncement | PublishAnnouncement (GID_t GroupId, string content, MiraiImage cover={}, bool ToNewMember=false, bool pinned=false, bool ShowEditCard=false, bool ShowPopup=false, bool RequireConfirm=false) const |
| 发布群公告 更多... | |
| void | DeleteAnnouncement (GID_t GroupId, string fid) const |
| 删除群公告 更多... | |
| void | DeleteAnnouncement (const GroupAnnouncement &announcement) const |
| 删除群公告 更多... | |
| void | RespNewFriendRequestEvent (int64_t EventId, QQ_t FromId, GID_t GroupId, NewFriendRequestOp operation, string message) const |
处理添加好友申请事件 NewFriendRequestEvent 更多... | |
| void | RespNewFriendRequestEvent (const NewFriendRequestEvent &event, NewFriendRequestOp operation, string message) const |
处理添加好友申请事件 NewFriendRequestEvent 更多... | |
| void | RespMemberJoinRequestEvent (int64_t EventId, QQ_t FromId, GID_t GroupId, MemberJoinRequestOp operation, string message) const |
处理用户申请入群事件 MemberJoinRequestEvent 更多... | |
| void | RespMemberJoinRequestEvent (const MemberJoinRequestEvent &event, MemberJoinRequestOp operation, string message) const |
处理用户申请入群事件 MemberJoinRequestEvent 更多... | |
| void | RespBotInvitedJoinGroupRequestEvent (int64_t EventId, QQ_t FromId, GID_t GroupId, BotInvitedJoinGroupRequestOp operation, string message) const |
处理Bot被邀请入群事件 BotInvitedJoinGroupRequestEvent 更多... | |
| void | RespBotInvitedJoinGroupRequestEvent (const BotInvitedJoinGroupRequestEvent &event, BotInvitedJoinGroupRequestOp operation, string message) const |
处理Bot被邀请入群事件 BotInvitedJoinGroupRequestEvent 更多... | |
| void | RegisterCommand (string name, std::vector< string > alias, string usage, string description) const |
| 注册指令 更多... | |
| string | CallAPI (const string &path, const string &method, const string &data) const |
| 直接向mirai-api-http发送请求 更多... | |
| template<> | |
| void | On (EventCallback< ClientConnectionEstablishedEvent > callback) |
| template<> | |
| void | On (EventCallback< ClientConnectionErrorEvent > callback) |
| template<> | |
| void | On (EventCallback< ClientConnectionClosedEvent > callback) |
| template<> | |
| void | On (EventCallback< ClientParseErrorEvent > callback) |
| std::unique_ptr< IAdaptor > | SetAdaptor (std::unique_ptr< IAdaptor > adaptor) |
| 设置适配器 更多... | |
| template<typename Adaptor , typename... Args, typename std::enable_if_t< std::is_base_of_v< IAdaptor, Adaptor >, int > = 0> | |
| std::unique_ptr< IAdaptor > | SetAdaptor (Args &&... args) |
| 设置适配器 更多... | |
| template<typename EventType > | |
| void | On (EventCallback< EventType > callback) |
| 注册事件回调函数 更多... | |
| template<EventTypes Type> | |
| void | On (EventCallback< GetEventType_t< Type > > callback) |
| 注册事件回调函数 更多... | |
| MessageId_t | SendFriendMessage (QQ_t qq, const MessageChain &message, std::optional< MessageId_t > QuoteId=std::nullopt) const |
| 发送好友消息 更多... | |
| MessageId_t | SendFriendMessage (QQ_t qq, MessageChain &&message, std::optional< MessageId_t > QuoteId=std::nullopt) const |
| 发送好友消息 更多... | |
| MessageId_t | SendGroupMessage (GID_t GroupId, const MessageChain &message, std::optional< MessageId_t > QuoteId=std::nullopt) const |
| 发送群聊消息 更多... | |
| MessageId_t | SendGroupMessage (GID_t GroupId, MessageChain &&message, std::optional< MessageId_t > QuoteId=std::nullopt) const |
| 发送群聊消息 更多... | |
| MessageId_t | SendTempMessage (QQ_t MemberId, GID_t GroupId, const MessageChain &message, std::optional< MessageId_t > QuoteId=std::nullopt) const |
| 发送临时会话消息 更多... | |
| MessageId_t | SendTempMessage (QQ_t MemberId, GID_t GroupId, MessageChain &&message, std::optional< MessageId_t > QuoteId=std::nullopt) const |
| 发送临时会话消息 更多... | |
| void | ExecuteCommand (const MessageChain &command) const |
| 执行指令 更多... | |
| void | ExecuteCommand (MessageChain &&command) const |
| 执行指令 更多... | |
Protected 类型 | |
| using | EventHandler = traits::EventCallbackVariant |
Protected 成员函数 | |
| std::string | GetSessionKey_ () const |
Protected 属性 | |
| std::shared_mutex | mtx_ |
| std::string | SessionKey_ {} |
| bool | connected_ = false |
| size_t | PoolSize_ = std::thread::hardware_concurrency() |
| std::shared_ptr< ILogger > | logger_ = std::make_shared<NullLogger>() |
| std::unique_ptr< IAdaptor > | adaptor_ |
| std::unique_ptr< Utils::ThreadPool > | pool_ |
| EventCallback< ClientConnectionEstablishedEvent > | ConnectionEstablishedCallback_ |
| EventCallback< ClientConnectionClosedEvent > | ConnectionClosedCallback_ |
| EventCallback< ClientConnectionErrorEvent > | ConnectionErrorCallback_ |
| EventCallback< ClientParseErrorEvent > | ParseErrorCallback_ |
| std::unordered_map< EventTypes, EventHandler > | EventHandlers_ {} |
提供与mirai-api-http网络交互的封装
所有与mirai的交互都需要通过该类来实现。使用时可以通过调用网络api 以及注册事件回调函数来完成消息的处理与发送。
连接设置保存在 SessionConfigs 类中,更改设置后需要重新连接mirai来使新配置生效。
所有非常量方法均有可能会抛出异常,异常的种类见 Exceptions.hpp。
在文件 Client.hpp 第 60 行定义.
| using Mirai::MiraiClient::EventCallback = std::function<void(Event)> |
在文件 Client.hpp 第 104 行定义.
|
protected |
在文件 Client.hpp 第 123 行定义.
| using Mirai::MiraiClient::string = std::string |
在文件 Client.hpp 第 253 行定义.
|
default |
| Mirai::MiraiClient::MiraiClient | ( | std::unique_ptr< IAdaptor > | adaptor | ) |
在文件 Client.cpp 第 45 行定义.
|
inline |
在文件 Client.hpp 第 138 行定义.
|
delete |
|
deletenoexcept |
| Mirai::MiraiClient::~MiraiClient | ( | ) |
在文件 Client.cpp 第 108 行定义.
|
inlineprotected |
在文件 Client.hpp 第 126 行定义.
|
delete |
|
deletenoexcept |
|
inline |
获取连接mirai-api-http的session key,若尚未建立链接则返回 std::nullopt
在文件 Client.hpp 第 150 行定义.
|
inline |
|
inline |
设置日志记录类
在文件 Client.hpp 第 197 行定义.
|
inline |
获取日志记录类
在文件 Client.hpp 第 200 行定义.
|
inline |
|
inline |
| void Mirai::MiraiClient::Connect | ( | ) |
连接mirai-api-http
若成功返回说明已成功建立连接,否则会抛出异常。 Connect() 返回前会调用 ClientConnectionEstablishedEvent 的回调函数
在文件 Client.cpp 第 114 行定义.
| void Mirai::MiraiClient::Disconnect | ( | bool | WaitForFinish = false | ) |
断开与mirai-api-http的连接
若成功返回说明已成功断开连接,否则会抛出异常。 Disconnect() 返回前会调用 ClientConnectionClosedEvent 的回调函数,并等待所有正在运行中的事件回调函数结束。
断开与mirai-api-http的连接
若成功返回说明已成功断开连接,否则会抛出异常。 Disconnect() 返回前会调用 ClientConnectionClosedEvent 的回调函数,并等待所有正在运行中的事件回调函数结束。
| WaitForFinish | 是否等待线程池中的任务完成 |
在文件 Client.cpp 第 256 行定义.
|
inline |
返回是否已成功连接mirai-api-http
在文件 Client.hpp 第 246 行定义.
|
inlineconstexpr |
| string Mirai::MiraiClient::GetMiraiApiHttpVersion | ( | ) | const |
| QQ_t Mirai::MiraiClient::GetBotQQ | ( | ) | const |
| std::vector< QQ_t > Mirai::MiraiClient::GetBotList | ( | ) | const |
| FriendMessageEvent Mirai::MiraiClient::GetFriendMessage | ( | MessageId_t | id, |
| QQ_t | |||
| ) | const |
| GroupMessageEvent Mirai::MiraiClient::GetGroupMessage | ( | MessageId_t | id, |
| GID_t | GroupId | ||
| ) | const |
| TempMessageEvent Mirai::MiraiClient::GetTempMessage | ( | MessageId_t | id, |
| GID_t | GroupId | ||
| ) | const |
| StrangerMessageEvent Mirai::MiraiClient::GetStrangerMessage | ( | MessageId_t | id, |
| QQ_t | |||
| ) | const |
| std::vector< User > Mirai::MiraiClient::GetFriendList | ( | ) | const |
| std::vector< Group > Mirai::MiraiClient::GetGroupList | ( | ) | const |
| std::vector< GroupMember > Mirai::MiraiClient::GetMemberList | ( | GID_t | GroupId | ) | const |
| std::vector< GroupMember > Mirai::MiraiClient::GetLatestMemberList | ( | GID_t | GroupId | ) | const |
| UserProfile Mirai::MiraiClient::GetBotProfile | ( | ) | const |
| UserProfile Mirai::MiraiClient::GetFriendProfile | ( | QQ_t | ) | const |
| UserProfile Mirai::MiraiClient::GetMemberProfile | ( | GID_t | GroupId, |
| QQ_t | MemberId | ||
| ) | const |
| UserProfile Mirai::MiraiClient::GetUserProfile | ( | QQ_t | ) | const |
| MessageId_t Mirai::MiraiClient::SendFriendMessage | ( | QQ_t | qq, |
| const MessageChain & | message, | ||
| std::optional< MessageId_t > | QuoteId = std::nullopt |
||
| ) | const |
| MessageId_t Mirai::MiraiClient::SendFriendMessage | ( | QQ_t | qq, |
| MessageChain && | message, | ||
| std::optional< MessageId_t > | QuoteId = std::nullopt |
||
| ) | const |
| MessageId_t Mirai::MiraiClient::SendGroupMessage | ( | GID_t | GroupId, |
| const MessageChain & | message, | ||
| std::optional< MessageId_t > | QuoteId = std::nullopt |
||
| ) | const |
| MessageId_t Mirai::MiraiClient::SendGroupMessage | ( | GID_t | GroupId, |
| MessageChain && | message, | ||
| std::optional< MessageId_t > | QuoteId = std::nullopt |
||
| ) | const |
| MessageId_t Mirai::MiraiClient::SendTempMessage | ( | QQ_t | MemberId, |
| GID_t | GroupId, | ||
| const MessageChain & | message, | ||
| std::optional< MessageId_t > | QuoteId = std::nullopt |
||
| ) | const |
发送临时会话消息
| MemberId | 群成员id |
| GroupId | 群聊id |
| message | 消息内容 |
| QuoteId | 引用回复内容的消息id |
在文件 Client.cpp 第 398 行定义.
| MessageId_t Mirai::MiraiClient::SendTempMessage | ( | QQ_t | MemberId, |
| GID_t | GroupId, | ||
| MessageChain && | message, | ||
| std::optional< MessageId_t > | QuoteId = std::nullopt |
||
| ) | const |
发送临时会话消息
| MemberId | 群成员id |
| GroupId | 群聊id |
| message | 消息内容 |
| QuoteId | 引用回复内容的消息id |
在文件 Client.cpp 第 404 行定义.
| void Mirai::MiraiClient::SendNudge | ( | const NudgeTarget & | target | ) | const |
| void Mirai::MiraiClient::NudgeFriend | ( | QQ_t | ) | const |
| void Mirai::MiraiClient::NudgeStranger | ( | QQ_t | ) | const |
| void Mirai::MiraiClient::RecallFriendMessage | ( | MessageId_t | id, |
| QQ_t | |||
| ) | const |
| void Mirai::MiraiClient::RecallGroupMessage | ( | MessageId_t | id, |
| GID_t | GroupId | ||
| ) | const |
| std::vector< MessageChain > Mirai::MiraiClient::GetRoamingFriendMessage | ( | QQ_t | qq, |
| std::time_t | TimeStart = 0, |
||
| std::time_t | TimeEnd = std::numeric_limits<std::time_t>::max() |
||
| ) | const |
获取好友漫游消息
| 好友QQ | |
| TimeStart | 消息起始时间 |
| TimeEnd | 消息结束时间 |
std::vector<MessageChain> 在文件 Client.cpp 第 444 行定义.
| std::vector< GroupFileInfo > Mirai::MiraiClient::GetGroupFileList | ( | GID_t | GroupId, |
| const FilePath & | dir = {}, |
||
| int64_t | offset = 0, |
||
| int64_t | size = 0, |
||
| bool | withDownloadInfo = false |
||
| ) | const |
获取群文件列表
| GroupId | 群聊id |
| dir | 父文件夹路径,默认为根目录 |
| offset | 分页偏移 |
| size | 分页大小,默认为不分页(即返回所有结果) |
| withDownloadInfo | 是否附带下载地址 |
std::vector<GroupFileInfo> 在文件 Client.cpp 第 451 行定义.
| GroupFileInfo Mirai::MiraiClient::GetGroupFileInfo | ( | GID_t | GroupId, |
| const FilePath & | dir, | ||
| bool | withDownloadInfo = false |
||
| ) | const |
| void Mirai::MiraiClient::GetGroupFileInfo | ( | GID_t | GroupId, |
| GroupFileInfo & | file, | ||
| bool | withDownloadInfo = false |
||
| ) | const |
| GroupFileInfo Mirai::MiraiClient::CreateGroupFileDirectory | ( | GID_t | GroupId, |
| string | directory | ||
| ) | const |
| GroupFileInfo Mirai::MiraiClient::UploadGroupFile | ( | GID_t | GroupId, |
| string | UploadPath, | ||
| string | name, | ||
| string | content | ||
| ) | const |
| GroupFileInfo Mirai::MiraiClient::UploadGroupFile | ( | GID_t | GroupId, |
| string | UploadPath, | ||
| string | name, | ||
| std::istream & | file | ||
| ) | const |
| GroupFileInfo Mirai::MiraiClient::UploadGroupFile | ( | GID_t | GroupId, |
| string | UploadPath, | ||
| string | name, | ||
| std::function< bool(size_t offset, std::ostream &sink, bool &finish)> | ContentProvider | ||
| ) | const |
上传群文件
Experimental: chunked data transfer is only supported in HTTP/1.1
| GroupId | 群聊id |
| UploadPath | 上传路径 |
| name | 文件名称 |
| ContentProvider | 文件内容,返回false表示取消请求 |
在文件 Client.cpp 第 508 行定义.
| FriendImage Mirai::MiraiClient::UploadFriendImage | ( | string | content | ) | const |
| FriendImage Mirai::MiraiClient::UploadFriendImage | ( | std::istream & | file | ) | const |
| FriendImage Mirai::MiraiClient::UploadFriendImage | ( | std::function< bool(size_t offset, std::ostream &sink, bool &finish)> | ContentProvider | ) | const |
上传好友图片
Experimental: chunked data transfer is only supported in HTTP/1.1
| ContentProvider | 图片内容,返回false表示取消请求 |
FriendImage 在文件 Client.cpp 第 531 行定义.
| GroupImage Mirai::MiraiClient::UploadGroupImage | ( | string | content | ) | const |
| GroupImage Mirai::MiraiClient::UploadGroupImage | ( | std::istream & | file | ) | const |
| GroupImage Mirai::MiraiClient::UploadGroupImage | ( | std::function< bool(size_t offset, std::ostream &sink, bool &finish)> | ContentProvider | ) | const |
上传群聊图片
Experimental: chunked data transfer is only supported in HTTP/1.1
| ContentProvider | 图片内容,返回false表示取消请求 |
GroupImage 在文件 Client.cpp 第 553 行定义.
| TempImage Mirai::MiraiClient::UploadTempImage | ( | std::istream & | file | ) | const |
| TempImage Mirai::MiraiClient::UploadTempImage | ( | std::function< bool(size_t offset, std::ostream &sink, bool &finish)> | ContentProvider | ) | const |
上传临时会话图片
Experimental: chunked data transfer is only supported in HTTP/1.1
| ContentProvider | 图片内容,返回false表示取消请求 |
TempImage 在文件 Client.cpp 第 576 行定义.
| GroupAudio Mirai::MiraiClient::UploadGroupAudio | ( | string | content | ) | const |
| GroupAudio Mirai::MiraiClient::UploadGroupAudio | ( | std::istream & | file | ) | const |
| GroupAudio Mirai::MiraiClient::UploadGroupAudio | ( | std::function< bool(size_t offset, std::ostream &sink, bool &finish)> | ContentProvider | ) | const |
上传群聊语音
Experimental: chunked data transfer is only supported in HTTP/1.1
| ContentProvider | 语音内容,返回false表示取消请求 |
GroupAudio 在文件 Client.cpp 第 597 行定义.
| void Mirai::MiraiClient::DeleteFriend | ( | QQ_t | ) | const |
| void Mirai::MiraiClient::Mute | ( | const GroupMember & | member, |
| std::chrono::seconds | time | ||
| ) | const |
| void Mirai::MiraiClient::Unmute | ( | const GroupMember & | member | ) | const |
| void Mirai::MiraiClient::Kick | ( | const GroupMember & | member, |
| string | message, | ||
| bool | block = false |
||
| ) | const |
| void Mirai::MiraiClient::LeaveGroup | ( | GID_t | GroupId | ) | const |
| void Mirai::MiraiClient::MuteAll | ( | GID_t | GroupId | ) | const |
| void Mirai::MiraiClient::UnmuteAll | ( | GID_t | GroupId | ) | const |
| void Mirai::MiraiClient::SetEssence | ( | GID_t | GroupId, |
| MessageId_t | MessageId | ||
| ) | const |
| GroupConfig Mirai::MiraiClient::GetGroupConfig | ( | GID_t | GroupId | ) | const |
| void Mirai::MiraiClient::SetGroupConfig | ( | GID_t | GroupId, |
| string | name = "", |
||
| std::optional< bool > | AllowMemberInvite = std::nullopt |
||
| ) | const |
修改群设置
目前仅能修改群名称与是否允许邀请入群
| GroupId | 群聊id |
| name | 群聊名称,默认保持原设置 |
| AllowMemberInvite | 是否允许邀请入群,默认保持原设置 |
在文件 Client.cpp 第 665 行定义.
| GroupMember Mirai::MiraiClient::GetMemberInfo | ( | GID_t | GroupId, |
| QQ_t | member | ||
| ) | const |
| std::vector< GroupAnnouncement > Mirai::MiraiClient::GetAnnouncementList | ( | GID_t | GroupId, |
| int64_t | offset = 0, |
||
| int64_t | size = 0 |
||
| ) | const |
获取群公告列表
| GroupId | 群聊id |
| offset | 分页偏移 |
| size | 分页大小,默认为不分页(即返回所有结果) |
std::vector<GroupAnnouncement> 在文件 Client.cpp 第 686 行定义.
| GroupAnnouncement Mirai::MiraiClient::PublishAnnouncement | ( | GID_t | GroupId, |
| string | content, | ||
| MiraiImage | cover = {}, |
||
| bool | ToNewMember = false, |
||
| bool | pinned = false, |
||
| bool | ShowEditCard = false, |
||
| bool | ShowPopup = false, |
||
| bool | RequireConfirm = false |
||
| ) | const |
发布群公告
| GroupId | 群聊id |
| content | 公告内容 |
| cover | 公告图片,传空值为不附带图片 |
| ToNewMember | 是否发给新成员 |
| pinned | 是否置顶 |
| ShowEditCard | 是否引导群成员修改群名片 |
| ShowPopup | 是否弹出公告 |
| RequireConfirm | 是否需要群员确认 |
在文件 Client.cpp 第 691 行定义.
| void Mirai::MiraiClient::DeleteAnnouncement | ( | const GroupAnnouncement & | announcement | ) | const |
| void Mirai::MiraiClient::RespNewFriendRequestEvent | ( | int64_t | EventId, |
| QQ_t | FromId, | ||
| GID_t | GroupId, | ||
| NewFriendRequestOp | operation, | ||
| string | message | ||
| ) | const |
处理添加好友申请事件 NewFriendRequestEvent
| EventId | 事件id |
| FromId | 申请人qq |
| GroupId | 申请人来自的群聊id,可能为 0_gid |
| operation | 处理操作 |
| message | 回复消息 |
在文件 Client.cpp 第 710 行定义.
| void Mirai::MiraiClient::RespNewFriendRequestEvent | ( | const NewFriendRequestEvent & | event, |
| NewFriendRequestOp | operation, | ||
| string | message | ||
| ) | const |
| void Mirai::MiraiClient::RespMemberJoinRequestEvent | ( | int64_t | EventId, |
| QQ_t | FromId, | ||
| GID_t | GroupId, | ||
| MemberJoinRequestOp | operation, | ||
| string | message | ||
| ) | const |
处理用户申请入群事件 MemberJoinRequestEvent
| EventId | 事件id |
| FromId | 申请人qq |
| GroupId | 群聊id |
| operation | 处理操作 |
| message | 回复消息 |
在文件 Client.cpp 第 724 行定义.
| void Mirai::MiraiClient::RespMemberJoinRequestEvent | ( | const MemberJoinRequestEvent & | event, |
| MemberJoinRequestOp | operation, | ||
| string | message | ||
| ) | const |
处理用户申请入群事件 MemberJoinRequestEvent
| event | 用户申请入群事件 |
| operation | 处理操作 |
| message | 回复消息 |
在文件 Client.cpp 第 731 行定义.
| void Mirai::MiraiClient::RespBotInvitedJoinGroupRequestEvent | ( | int64_t | EventId, |
| QQ_t | FromId, | ||
| GID_t | GroupId, | ||
| BotInvitedJoinGroupRequestOp | operation, | ||
| string | message | ||
| ) | const |
处理Bot被邀请入群事件 BotInvitedJoinGroupRequestEvent
| EventId | 事件id |
| FromId | 申请人qq |
| GroupId | 群聊id |
| operation | 处理操作 |
| message | 回复消息 |
在文件 Client.cpp 第 738 行定义.
| void Mirai::MiraiClient::RespBotInvitedJoinGroupRequestEvent | ( | const BotInvitedJoinGroupRequestEvent & | event, |
| BotInvitedJoinGroupRequestOp | operation, | ||
| string | message | ||
| ) | const |
处理Bot被邀请入群事件 BotInvitedJoinGroupRequestEvent
| event | Bot被邀请入群事件 |
| operation | 处理操作 |
| message | 回复消息 |
在文件 Client.cpp 第 746 行定义.
| void Mirai::MiraiClient::ExecuteCommand | ( | const MessageChain & | command | ) | const |
| void Mirai::MiraiClient::ExecuteCommand | ( | MessageChain && | command | ) | const |
| string Mirai::MiraiClient::CallAPI | ( | const string & | path, |
| const string & | method, | ||
| const string & | data | ||
| ) | const |
直接向mirai-api-http发送请求
备用方法,可用于hack新功能或提供临时替代,正常情况下不推荐使用
| path | 路径 |
| method | 内容格式,可能是 "POST" "GET" 或subcommand等,取决于具体的Adaptor |
| data | 请求数据 |
std::string 在文件 Client.cpp 第 771 行定义.
|
inline |
在文件 Client.hpp 第 961 行定义.
|
inline |
在文件 Client.hpp 第 966 行定义.
|
inline |
在文件 Client.hpp 第 971 行定义.
|
inline |
在文件 Client.hpp 第 976 行定义.
|
mutableprotected |
在文件 Client.hpp 第 108 行定义.
|
protected |
在文件 Client.hpp 第 110 行定义.
|
protected |
在文件 Client.hpp 第 111 行定义.
|
protected |
在文件 Client.hpp 第 112 行定义.
|
protected |
在文件 Client.hpp 第 114 行定义.
|
protected |
在文件 Client.hpp 第 115 行定义.
|
protected |
在文件 Client.hpp 第 116 行定义.
|
protected |
在文件 Client.hpp 第 118 行定义.
|
protected |
在文件 Client.hpp 第 119 行定义.
|
protected |
在文件 Client.hpp 第 120 行定义.
|
protected |
在文件 Client.hpp 第 121 行定义.
|
protected |
在文件 Client.hpp 第 124 行定义.