Tips~ 如有意向一起开发本项目,请联系我邮箱 ( ̄▽ ̄)"
API文档(包含示例) · 文档库 · demo
支持的事件
这些内容可以在Config.kt看到
事件名称 | 函数名称 |
---|---|
机器人上线 | BotOnlineEvent |
群聊消息 | GroupMessageEvent |
私聊消息 | PrivateMessageEvent |
好友申请 | NewFriendRequestEvent |
群聊邀请 | GroupInviteEvent |
新群成员申请 | MemberJoinRequestEvent |
新群成员加入 | MemberJoinEvent |
群成员离开 | MemberLeaveEvent |
机器人加入 | BotJoinEvent |
机器人离开 | BotLeaveEvent |
消息撤回 | RecallEvent |
群临时会话 | GroupTempMessageEvent |
定时事件执行 | SchedulingEvent |
戳一戳 | NugdeEvent |
- C++ 17
- 使用cmake
- 使用jni与kt交互
- c++ utf8编码
- 与mirai-core同步发布(无需mah)
- 支持2种使用方法
- [从2.7.0开始]代码集中到一个hpp文件和其他固定依赖文件,每次更新只需要更新那个文件
- 不封装和隐藏底层实现代码,您可以自定义实现代码或通过实现代码提issue/pr
CI Name | status |
---|---|
C++ in windows(mingw&msvc) & linux(g++) | |
kotlin |
-
MiraiCP是一个Mirai 的C++语言的社区SDK,基于Mirai-console和Mirai-core插件模板开发
-
本项目仅供学习参考,禁止用于任何商业用途(根据Mirai的AGPLv3许可协议开源)。
-
本项目不含有任何旨在破坏用户计算机数据和获取用户隐私的恶意代码,不含有任何跟踪、监视用户计算机功能代码,不会收集任何用户个人信息,不会泄露用户隐私。
-
本项目不提供任何具体功能实现,仅仅只是对项目mirai-console和mirai-core(详见mirai仓库)的二次封装。
-
任何单位或个人认为本项目可能涉嫌侵权,应及时提出反馈,本项目将会第一时间对违规内容给予删除等相关处理。
mirai需要java环境 >=11
- 从v2.6.3-RC开始,使用utf8作为编码, vs需要加/utf8编译参数,见微软文档, 而在CmakeLists里就表现为
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
- MiraiCP版本规则: 从2.2.0开始 (2021/1/31),版本前两位为Mirai的版本,后一位为SDK更新迭代版本
deprecated
方法一般只保存3个版本- 编译出的动态链接库不具备跨平台性, 如在windows下编译的库在linux上无法使用, 要在和目标同系统下编译或者用cmake交叉编译
- 确保本地有 jdk 环境
- 从MiraiCP-template 中下载模板
- 在
main.cpp
中编写, 并编译出.dll
/.so
- 在 mcl 目录下输入
mcl --update-package io.github.nambers:MiraiCP-plugin --channel nightly --type plugin
让 mcl 自动下载, 或者从本项目release
中下载最新的MiraiCP-plugin-<version>.mirai.jar
放置到 mcl 下的 plugin 文件夹 - 在 mcl 下的
data/tech.eritquearcus.miraicp
里更改配置文件, 大概长这样:详细配置见 doc{ "pluginConfig":[{ "path":"\\cmake-build-debug\\MiraiCP.dll" }] }
- 确保本地有 jdk 环境
- 从MiraiCP-template 中下载模板
- 在
main.cpp
中编写, 并编译出.dll
/.so
- 在本项目
release
中下载最新的MiraiCP-loader-<version>.jar
- 在该 jar 同目录下创建
config.json
作为配置文件 - 编写json:
详细见config.md文档
{ "accounts": [{ "id": qqid, "passwords": "passwords密码", "protocol": "pad", "heatBeat": "STAT_HB", "md5": false, "autoLogin": true }], "cppPaths": [ {"path": "dll路径"} ] }
- 使用
java -jar MiraiCP-loader-<version>.jar
启动
- 确保本地有 jdk 环境
- 从MiraiCP-core-demo 中下载模板
- 从本项目 release 中下载
MiraiCP-core-<version>.jar
, 放置到一个你知道的目录 - 在
main.cpp
中编写, 并把上面 jar 的目录写入(load
方法内) - 直接运行
main
方法
如果有其他问题,欢迎提交issue和提交PR贡献
可直接在模板clone
下来的文件夹中git stash
, git fetch
, git pull
, git stash pop
直接从上游拉取代码, 然后再在本项目的release
中下载最新对应的jar组件替换
-
从最新release 中下载loader/plugin/core的jar文件并替换
-
从各自的模板项目中下载
MiraiCP.hpp
,MiraiCP.cpp
, 以及如果是MiraiCP-core
项目的core.h
,core.cpp
, 替换原本的文件
论坛贴: miraicp
github issue: miraicp issue
qq群: 1044565129
Copyright (C) 2020-2022 Eritque arcus and contributors.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or any later version(in your opinion).
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Dependence name | Url | Author | License |
---|---|---|---|
JSON for modern C++ | https://github.com/nlohmann/json | Niels Lohmann | MIT |
UTF8-CPP: UTF-8 with C++ in a Portable Way | https://github.com/nemtrif/utfcpp | Nemanja Trifunovic | BSL-1.0 |
JNI Headers | Null | Java | GNU General Public License version 2 |