diff --git a/cpp/Procession.cpp b/cpp/Procession.cpp index e847dc853..1b786b1a5 100644 --- a/cpp/Procession.cpp +++ b/cpp/Procession.cpp @@ -20,18 +20,48 @@ void onEnable() { ... 参数都在param变量里,在lambda块中使用param.xxx来调用 */ + // 邀请事件 procession->registerEvent([](NewFriendRequestEvent e) { e.accept(); }); + procession->registerEvent([](GroupInviteEvent e) { + e.accept(); + }); + // 消息事件 procession->registerEvent([](PrivateMessageEvent e) { std::thread func1(func, e.sender.id); e.sender.SendMsg(e.message); + std::vector temp = Image::GetImgIdsFromMiraiCode(e.message); func1.detach(); // 线程应该在lambda中决定要detach还是join, 否则会报错 + for (std::string a : temp) { + e.sender.SendMsg(a); + } + }); + procession->registerEvent([](GroupMessageEvent e) { + e.group.SendMsg("HI"); + e.group.SendMiraiCode(At(e.sender)); + e.group.SendMsg("撤回测试").recall(); + // 可以用new传miraicodeable指针进去,也可以用.toMiraiCode() + e.group.SendMiraiCode(new LightApp(LightAppStyle1())); + e.group.SendMiraiCode(LightApp(LightAppStyle2()).toMiraiCode()); + e.group.SendMiraiCode(new LightApp(LightAppStyle3())); + ForwardMessage(&e.group, + { + ForwardNode(1930893235, "Eritque arcus", "hahaha", 1), + ForwardNode(1930893235, "Eritque arcus", "hahaha", -100) + }).sendTo(&e.group); }); procession->registerEvent([](GroupTempMessageEvent e) { e.sender.SendMsg("hi"); }); + // 群事件 + procession->registerEvent([](MemberJoinEvent e) { + e.group.SendMiraiCode(At(e.group.getOwner()) + std::to_string(e.member.id) + "加入了群聊"); + }); + procession->registerEvent([](MemberLeaveEvent e) { + e.group.SendMiraiCode(At(e.group.getOwner()) + std::to_string(e.member.id) + "退出了群聊"); + }); } void onDisable() { /*插件结束,正常退出才会调用*/ diff --git a/cpp/tools.cpp b/cpp/tools.cpp index dabda4002..6bc56bba9 100644 --- a/cpp/tools.cpp +++ b/cpp/tools.cpp @@ -247,7 +247,6 @@ MessageSource Friend::SendMsg(std::string msg, JNIEnv* env){ if (re == "E1") { throw FriendException(); } - logger->Info("C-Source:\""+re+"\""); return MessageSource(re); }