From 1f5dcf769b8d369eebfd9eb88dd42b4d8cea9959 Mon Sep 17 00:00:00 2001 From: lucas8485 <1443937075@qq.com> Date: Sun, 9 Oct 2022 17:19:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8F=9C=E5=8D=95=E5=92=8C?= =?UTF-8?q?=E5=85=B3=E4=BA=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/InstructionProcessor.cpp | 64 +++++++++++++++++++++++++++++++++++- src/main.cpp | 4 +++ 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/src/InstructionProcessor.cpp b/src/InstructionProcessor.cpp index 42c6794..7695ef1 100644 --- a/src/InstructionProcessor.cpp +++ b/src/InstructionProcessor.cpp @@ -300,7 +300,7 @@ void InstructionProcessor::signOn(const MessageDispatcher::SingleInstruction &in "你获得了 %d 个铜钱\n" "你现在有 %d 个铜钱\n" "你已经连续签到 %d 天", copperCoinsDifference, currentCopperCoins, person.continuousSignOnDays()); - group.sendMessage(MiraiCP::At(instruction.event.sender.id()),MiraiCP::PlainText(s)); + group.sendMessage(MiraiCP::At(instruction.event.sender.id()), MiraiCP::PlainText(s)); } } @@ -320,3 +320,65 @@ void InstructionProcessor::otherMessage(const MessageDispatcher::SingleInstructi } } +void InstructionProcessor::menu(const MessageDispatcher::SingleInstruction &instruction) { + auto group = instruction.event.group; + group.sendMessage(MiraiCP::PlainText(std::string{"菜单:\n" + "1.复读\n" + "使用方法:\n" + ".复读 [内容]\n" + "2.营销号\n" + "使用方法:\n" + ".营销号 [事物]\n" + ".营销号 [事物] [别称]\n" + ".营销号 [事物] [事件] [结果]\n" + "3.说废话\n" + "使用方法:\n" + ".废话 [主题]\n" + "4.发病\n" + "使用方法:\n" + ".发病 [主题]\n" + "5.倒垃圾\n" + "使用方法:\n" + ".倒垃圾\n" + "6.疯狂星期四V我50\n" + "使用方法:\n" + ".kfc\n" + "7.东方Project图片生成\n" + "使用方法:\n" + ".东方\n" + ".车万\n" + "8.签到\n" + "使用方法:\n" + ".签到\n" + ".打卡\n" + "9.钓鱼 [开发中]\n" + "使用方法:\n" + ".钓鱼\n" + "10.打工 [开发中]\n" + "使用方法:\n" + ".打工\n" + "11.五千兆表情包生成 [开发中]\n" + "使用方法:\n" + ".五千兆 [上排文字] [下排文字]\n" + "12.菜单" + "使用方法:\n" + ".菜单\n" + "13.关于\n" + "使用方法:\n" + ".关于\n"})); +} + +void InstructionProcessor::about(const MessageDispatcher::SingleInstruction &instruction) { + auto group = instruction.event.group; + group.sendMessage(MiraiCP::PlainText(std::string{"作者:Lucas\n" + "项目地址:\n" + "https://gitme.fun/lucas8485/Lucas-Bot\n" + "遵循AGPLv3协议开源\n" + "使用的第三方库:\n" + "MiraiCP\n" + "nlohmann/json\n" + "libcurl\n" + "utf8-for-cpp"})); + +} + diff --git a/src/main.cpp b/src/main.cpp index ec04fe1..0b6fc93 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -63,6 +63,10 @@ public: InstructionProcessor::touhouProject); MessageDispatcher::registerInstructionProcedure(MessageDispatcher::InstructionType::SignOn, InstructionProcessor::signOn); + MessageDispatcher::registerInstructionProcedure(MessageDispatcher::InstructionType::Menu, + InstructionProcessor::menu); + MessageDispatcher::registerInstructionProcedure(MessageDispatcher::InstructionType::About, + InstructionProcessor::about); MessageDispatcher::registerInstructionProcedure(MessageDispatcher::InstructionType::OtherMessage, InstructionProcessor::otherMessage); // 添加消息监听事件