Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Latest commit

 

History

History
262 lines (184 loc) · 11.7 KB

README_en.md

File metadata and controls

262 lines (184 loc) · 11.7 KB

中文

English

Tips~ If you are willing to join to develop this project, send email to me (eritque-arcus At eritque-arcus.tech) ( ̄▽ ̄)"

Announcement

please note:

  1. MiraiCP is a C++ community SDK of Mirai, based on the mirai-console and the plugin template of mirai-core.

  2. This project is only available for study and communication only, and cannot be used for commercial activities (open source according to AGPLv3 license agreement).

  3. 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.

  4. This project does not provide any specific function implementation, is just the encapsulated package of the project mirai-console and mirai-core (see mirai).

  5. 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.

About

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

Online API documentation

Docs

Features

  • 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.

test

CI Name status
C++ in linux(mingw) C++ Test
C++ in windows(mingw&msvc) C++ Test
kotlin kotlin Test

How to Use

1. Environment

Mirai needs java version >= 11.

2. Notes

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

  1. 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.

3. Guidance

3.1 How to use miraiCP SDK

3.1.1 Write code in demo

Download MiraiCP_CPP.zip from the latest release. Unzip it and write code in demo.cpp.

3.1.2 Add miraiCP SDK dependency to your code

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.

3.2 Start SDK

3.2.1 Use it directly in loader

This is only suitable for using miraiCP plugins only.

  1. Download MiraiCP-loader-*.jar from the latest release (* is the version name)

  2. 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

  3. Start up:

    java -jar MiraiCP-loader*.jar

3.2.2 Use as an plugin of mirai console loader

download mcl

3.2.2.1 Download MiraiCP automatically using 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"
	}]
}
3.2.2.2 Download MiraiCP manually
  1. Download MiraiCP-plugin-*.mirai.jar from the latest release (* is the version name)

  2. Put the .jar file to the path of plugins in mcl (you need to start mcl once if there is no path of plugins)

  3. Create and write data/miraiCP/miraicp.json, and see 3.2.2.1

  4. Start mcl

If there is any other problem, issues and PR are welcome.

How to Upgrade

  1. download from the latest release

  2. Replace the miraiCP.hpp and miraiCP.cpp with new one

  3. Replace the MiraiCP-loader-*.jar or the MiraiCP-plugin-*.mirai.jar

Community

Forum: miraicp

GitHub issue: miraicp issue

QQ group: 1044565129

Email: [email protected]

TODO

See the milestones of this project

License

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/>.

Dependencies

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
# Stargazers [![Stargazers repo roster for @Nambers/MiraiCP](https://reporoster.com/stars/Nambers/MiraiCP)](https://github.com/Nambers/MiraiCP/stargazers)