From 6fad06b3661e0015b6910f7e6bf1aada143dab54 Mon Sep 17 00:00:00 2001 From: Jerry Date: Wed, 21 May 2025 18:43:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B2=A1=E5=86=99=E5=AE=8C=E7=9A=84=E6=88=B3?= =?UTF-8?q?=E4=B8=80=E6=88=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/poke.js | 60 ++++++++++++++++++++++++++++++++++++++----- config/config.md | 62 +++++++++++++++++++++++++++++++++++++++++++++ config/default.json | 7 +++++ 3 files changed, 123 insertions(+), 6 deletions(-) create mode 100644 config/config.md diff --git a/apps/poke.js b/apps/poke.js index 3e038bc..734d71e 100644 --- a/apps/poke.js +++ b/apps/poke.js @@ -3,10 +3,11 @@ import tool from '../components/tool.js'; import axios from 'axios'; import configControl from '../lib/config/configControl.js'; -const replyText = 0.4; -const replyVoice = 0.2; -const mutePick = 0.1; -const pai = 0.1; +const replyText = configControl.get('poke')?.replyText; +const replyVoice = configControl.get('poke')?.replyVoice; +const mutePick = configControl.get('poke')?.mutePick; +const pai = configControl.get(`poke`)?.pai; +const muteTime = configControl.get('poke')?.muteTime; export default class pockpock extends plugin { constructor() { @@ -31,7 +32,7 @@ async function pokeMaster(e) { if (cfg.masterQQ.includes(e.operator_id) || e.self_id === e.operator_id) { return; } - e.reply(`你几把谁啊,敢戳我亲爱的主人,胆子好大啊你🤚😡🤚`); + e.reply(`你几把谁啊,敢戳我主人,胆子好大啊你🤚😡🤚`); await tool.sleep(1000); e.bot.sendApi('group_poke', { group_id: this.e.group_id, user_id: e.operator_id }); return true; @@ -52,7 +53,54 @@ async function chuochuo(e) { if (returnData?.success) { return await e.reply(returnData.data); } else { - return await e.reply(`戳一戳出错了!${configControl.get('nickName')}不知道要说啥好了..`); + return await e.reply(`戳一戳出错了!${configControl.get('nickName')}不知道该说啥好了..`); + } + } else if (randomNum < replyText + replyVoice) { + const returnData = await axios.get( + `${configControl.get(`coreConfig`)?.coreUrl}/api/words/getText/poke` + ); + if (returnData?.success) { + let message = returnData?.data; + message = cleanText(message); + return; + //await this.e.bot.sendApi('') // TODO 🐎呀忘了api是啥了 + } else { + return await e.reply(`戳一戳出错了!${configControl.get('nickName')}不知道该说啥好了..`); + } + } else if (randomNum < replyText + replyVoice + mutePick) { + // TODO 判断是否管理 + let mutetype = Math.ceil(Math.random() * 4); + if (mutetype === 1) { + e.reply('我生气了!砸挖撸多!木大!木大木大!'); + await tool.sleep(1000); + await e.group.muteMember(e.operator_id, 60 * muteTime); + } + if (mutetype === 2) { + e.reply('不!!'); + await tool.sleep(1000); + e.reply('准!!'); + await tool.sleep(1000); + e.reply('戳!!'); + await tool.sleep(1000); + await e.group.muteMember(e.operator_id, 60 * muteTime); + await tool.sleep(1000); + e.reply('!!'); + return; + } + if (mutetype === 3) { + e.reply('吃我10068拳!'); + await tool.sleep(1000); + e.bot.sendApi('group_poke', { group_id: this.e.group_id, user_id: e.operator_id }); + await e.group.muteMember(e.operator_id, 60 * muteTime); + await tool.sleep(1000); + return; + } + if (mutetype === 4) { + e.reply('哼,我可是会还手的哦——'); + await tool.sleep(1000); + e.bot.sendApi('group_poke', { group_id: this.e.group_id, user_id: e.operator_id }); + await e.group.muteMember(e.operator_id, 60 * muteTime); + return; } } } diff --git a/config/config.md b/config/config.md new file mode 100644 index 0000000..62f7ac7 --- /dev/null +++ b/config/config.md @@ -0,0 +1,62 @@ +### 参考以下注释进行配置,不要带注释粘贴,也不要改动`default.json` + +配置文件位于`yunzai`根目录`/data/crystelf下` + +参考注释: + +``` yaml +{ + "debug": true,\\是否启用调试模式 + "core": true,\\是否启用晶灵核心相关功能 + "coreConfig": { //晶灵核心配置 + "coreUrl": "", //核心网址,需要加https://前缀 + "wsUrl": "", //ws连接地址如ws:// + "wsClientId": "",//端id + "wsSecret": "", wsmiy + "wsReConnectInterval": "5000", + "token": ""//postAPI调用密钥 + }, + "maxFeed": 10,//最大缓存rss流 + "feeds": [//rss相关配置,无需手动更改 + { + "url": "", + "targetGroups": [114,154], + "screenshot": true + } + ], + "fanqieConfig": {//番茄小说功能 + "url": "http://127.0.0.1:6868", + "outDir": "/home/user/debian/cache/Downloads" + }, + "poke": {//戳一戳概率,加起来不超过1,余下的概率为反击概率 + "replyText": 0.4, + "replyVoice": 0.2, + "mutePick": 0.1, + "pai": 0.1, + ""muteTime": 2" + }, + "mode": "deepseek",//deepseekORopenai + "modelType": "deepseek-ai/DeepSeek-V3",//无需更改 + "historyLength": 3, + "maxLength": 3, + "chatTemperature": 1, + "pluginTemperature": 0.5, + "nickName": "寄气人",//昵称 + "checkChat": { + "rdNum": 2,//随机数,0-100 + "masterReply": true,//主人回复 + "userId": [ //一定回复的人 + 114514 + ], + "blackGroups": [//不许使用的群聊 + 114, + 514 + ], + "enableGroups": [//一定回复的群聊 + 11115 + ] + }, + "maxMessageLength": 100//最大上下文 +} + +``` diff --git a/config/default.json b/config/default.json index 823400a..2026107 100644 --- a/config/default.json +++ b/config/default.json @@ -17,6 +17,13 @@ "screenshot": true } ], + "poke": { + "replyText": 0.4, + "replyVoice": 0.2, + "mutePick": 0.1, + "pai": 0.1, + "muteTime": 2 + }, "fanqieConfig": { "url": "http://127.0.0.1:6868", "outDir": "/home/user/debian/cache/Downloads"