Tips~ If you are willing to join to develop this project, send email to me (
eritque-arcus At eritque-arcus.tech
) ( ̄▽ ̄)"
please note:
-
MiraiCP is a C++ community SDK of Mirai, based on the mirai-console and the plugin template of mirai-core.
-
This project is only available for study and communication only, and cannot be used for commercial activities (open source according to AGPLv3 license agreement).
-
This project does not contain any malicious code designed to destroy user computer data and obtain user's privacy or any code tracking or monitoring user's computer, does not collect any personal information, and will not disclose user privacy.
-
This project does not provide any specific function implementation, is just the encapsulated package of the project mirai-console and mirai-core (see mirai).
-
Any unit or individual who believes that this project may be suspected of infringement should promptly provide feedback or issue. We will delete the illegal content and handle other necessary issues related immediately.
Using utf8 encoding since version 2.6.3-RC
/utf8
parameter is needed when using Visual Studio, see Microsoft doc. Not needed when using cmake
Supporting events
You can see all these content inConfig.kt
Event description | method name |
---|---|
Bot Online Event | BotOnlineEvent |
Group Message Event | GroupMessageEvent |
Friend Message Event | PrivateMessageEvent |
New Friend Request | NewFriendRequestEvent |
New Group Invite | GroupInviteEvent |
New group member join | MemberJoinEvent |
group member leave | MemberLeaveEvent |
Message recall | RecallEvent |
Group temporary Message Event | GroupTempMessageEvent |
Timed out event(when the time of a registered time task out) | SchedulingEvent |
Nugde Event | NugdeEvent |
- C++ 17
- Use
cmake
- Use jni to communicate with kotlin
- C++ utf8 encoding
- Release with mirai-core concurrently
- Support two ways of using
- Codes are assembled into a
.hpp
and a.cpp
file. Each time there is a new release, user only need to renew these files.
CI Name | status |
---|---|
C++ in linux(mingw) | |
C++ in windows(mingw&msvc) | |
kotlin |
Mirai needs java version >= 11.
verison rule of MiraiCP: since v2.2.0 (2021/1/31), the first two characters of the version represent the version of Mirai used, and the last character represents the iterative version of this SDK update
- Till now, this project is tested on Windows and Linux. For Linux user, you need to
export JAVA_PATH=/path/to/your/java/library
, and the filename of plugin you compiled will ends with.so
, not.dll
.
Download MiraiCP_CPP.zip from the latest release. Unzip it and write code in demo.cpp
.
Download MiraiCP_CPP.zip from the latest release. Create dynamic link library in cmakelist, where target name must be MiraiCP, and add everything you need. You need to include the directory include
as well.
add_library(MiraiCP SHARED include/miraiCP.cpp demo.cpp)
# add miraiCPdependence
add_subdirectory(include)
Add #include "MiraiCP.hpp"
and using namespace MiraiCP;
to your codes need miraiCP.
This is only suitable for using miraiCP plugins only.
-
Download MiraiCP-loader-*.jar from the latest release (* is the version name)
-
Create
config.json
and write:{ "accounts": [{ "id": qqid, "passwords": "password", "protocol": "pad", "heatBeat": "STAT_HB", "md5": false, "autoLogin": true }], "cppPath": ".dll or .so path" }
For the details, see config.md
-
Start up:
java -jar MiraiCP-loader*.jar
download mcl
./mcl --update-package io.github.nambers:MiraiCP-plugin --channel nightly --type plugin
Then create and write config in data/miraiCP/miraicp.json
:
{
"pluginConfig":[{
"path":"/path/to/miraiCP/plugin/plugin.dll/or/plugin.so"
}]
}
-
Download MiraiCP-plugin-*.mirai.jar from the latest release (* is the version name)
-
Put the
.jar
file to the path of plugins in mcl (you need to start mcl once if there is no path of plugins) -
Create and write
data/miraiCP/miraicp.json
, and see 3.2.2.1 -
Start mcl
If there is any other problem, issues and PR are welcome.
-
download from the latest release
-
Replace the
miraiCP.hpp
andmiraiCP.cpp
with new one -
Replace the MiraiCP-loader-*.jar or the MiraiCP-plugin-*.mirai.jar
Forum: miraicp
GitHub issue: miraicp issue
QQ group: 1044565129
Email: 1930893235@qq.com
See the milestones of this project
Copyright (C) 2020-2021 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/>.
C++ dependencies
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 |
Amalgamate: C++ source file amalgamation | https://github.com/0ph1uch1/amalgamate | Antares0982 | AGPL-3.0 |
PolyM is a very simple C++ message queue intended for inter-thread communication | https://github.com/khuttun/PolyM | khuttun | MIT |
Kotlin dependencies
Dependence name | Url | Author | License |
---|---|---|---|
Jline 3 | https://github.com/jline/jline3 | Jline team | BSD-3 |
Mirai | https://github.com/mamoe/mirai | Mamoe team | AGPL-3.0 |
Jansi | https://github.com/fusesource/jansi | FuseSource team | Apache License 2.0 |
Mordant: Colorful styling for command-line applications | https://github.com/ajalt/mordant | AJ Alt | Apache License 2.0 |
Junit 5 | https://github.com/junit-team/junit5 | Junit team | Eclipse Public License - v 2.0 |