From 3d5bb22f9ae62445861e761759fa986496bd4ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8C=8C?= Date: Fri, 24 May 2024 00:22:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20getGroupMemberInfo=20?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E6=8A=A5=E9=94=99=E5=AF=BC=E8=87=B4=E8=BD=AC?= =?UTF-8?q?=E5=8F=91=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/mys/utils.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/model/mys/utils.js b/model/mys/utils.js index a5bd0cb..05c62ba 100644 --- a/model/mys/utils.js +++ b/model/mys/utils.js @@ -44,7 +44,7 @@ export async function redisSet(userId="all", type = 'bbs', data, time=0) { * @param msg 消息 */ export async function relpyPrivate(userId, msg) { - userId = Number(userId) + userId = Number(userId) || userId let friend = Bot.fl.get(userId) if (friend) { Bot.logger.mark(`发送好友消息[${friend.nickname}](${userId})`) @@ -54,13 +54,12 @@ export async function relpyPrivate(userId, msg) { } } export async function replyMake(e, _msg, lenght) { - let nickname = Bot.nickname; - if (e.isGroup) { - if(Bot?.getGroupMemberInfo){ - let info = await Bot?.getGroupMemberInfo(e.group_id, Bot.uin) - nickname = info.card || info.nickname - } - } + const bot = e.bot || Bot + let nickname = bot.nickname; + if (e.isGroup && bot.getGroupMemberInfo) try { + const info = await bot.getGroupMemberInfo(e.group_id, bot.uin) + nickname = info.card || info.nickname + } catch {} let msgList = []; for (let [index, item] of Object.entries(_msg)) { if (index < lenght) { @@ -69,7 +68,7 @@ export async function replyMake(e, _msg, lenght) { msgList.push({ message: item, nickname: nickname, - user_id: Bot.uin + user_id: bot.uin }) } if (e.isGroup) { @@ -139,4 +138,4 @@ export default { redisSet,recallMsg, relpyPrivate, getCookieMap -} +} \ No newline at end of file