From fe0e6ef8515e1d07c9827f63b74e1081903b43af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AD=89=E9=A3=8E=E6=9D=A5?= <3139373986@qq.com> Date: Fri, 19 Apr 2024 01:29:14 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20=E7=BB=86=E8=8A=82=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/thumbUp.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/thumbUp.js b/apps/thumbUp.js index b11cf5c..854777e 100644 --- a/apps/thumbUp.js +++ b/apps/thumbUp.js @@ -78,13 +78,14 @@ export class ThumbUp extends plugin { let successMsg = `给${isSelf ? "你" : userId}${doType}了${n}下哦,记得回我~ ${isFriend ? "" : `(如${doType}失败请添加好友)`}` const avatar = `https://q1.qlogo.cn/g?b=qq&s=100&nk=${userId}` const successFn = _.sample([ "ganyu", "zan" ]) + const mention = segment.at(userId) if (e.message?.[0]?.text == "#全部赞我")failsMsg = "return" /** 判断点赞是否成功 */ - let msg = await generateResponseMsg(n > 0, successMsg, failsMsg, avatar, successFn) + let msg = await generateResponseMsg(n > 0, successMsg, failsMsg, avatar, successFn, mention) /** 回复 */ - if (msg.length) { return e.reply(msg, true, { at: userId }) } + if (msg.length) { return e.reply(msg, true) } } } // 工具函数:生成失败消息 @@ -98,13 +99,13 @@ function generateFailMsg(doType, originalMsg) { return failsMsg } // 工具函数:生成响应消息 -async function generateResponseMsg(isSuccess, successMsg, failsMsg, avatar, successFn) { +async function generateResponseMsg(isSuccess, successMsg, failsMsg, avatar, successFn, mention) { if (isSuccess) { const imageSegment = segment.image((await memes[successFn](avatar))) - return [ `${successMsg}`, imageSegment ] // Removed the leading newline character + return [ mention, `\n${successMsg}`, imageSegment ] } else { const imageSegment = segment.image((await memes.crawl(avatar))) if (failsMsg == "return") return [] - return [ `${failsMsg}`, imageSegment ] // Removed the leading newline character + return [ mention, `\n${failsMsg}`, imageSegment ] } }