From 930678c7d041c61ff65a357dd4791b53bba06762 Mon Sep 17 00:00:00 2001 From: 2y8e9h22 <70102795+2y8e9h22@users.noreply.github.com> Date: Sat, 18 Mar 2023 11:44:33 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=A2=91=E9=81=93=E6=94=AF=E6=8C=81]=20?= =?UTF-8?q?=E6=97=A0=E5=85=B3=E7=B4=A7=E8=A6=81=E7=9A=84=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=20(#33)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 频道支持#1 --- lib/common/common.js | 6 +++++- lib/plugins/loader.js | 9 +++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/common/common.js b/lib/common/common.js index 037d404..2ea6084 100644 --- a/lib/common/common.js +++ b/lib/common/common.js @@ -1,4 +1,3 @@ - import { pipeline } from 'stream' import { promisify } from 'util' import fetch from 'node-fetch' @@ -67,11 +66,16 @@ function mkdirs (dirname) { * @param dec 转发描述 */ async function makeForwardMsg (e, msg = [], dec = '') { + // 是频道直接返回 join + if (e.isGuild) return msg.join("\n") + let nickname = Bot.nickname + if (e.isGroup) { let info = await Bot.getGroupMemberInfo(e.group_id, Bot.uin) nickname = info.card || info.nickname } + let userInfo = { user_id: Bot.uin, nickname diff --git a/lib/plugins/loader.js b/lib/plugins/loader.js index 3db9b30..a5c0eca 100644 --- a/lib/plugins/loader.js +++ b/lib/plugins/loader.js @@ -53,9 +53,7 @@ class PluginsLoader { if (tmp.apps) tmp = { ...tmp.apps } let isAdd = false lodash.forEach(tmp, (p, i) => { - if (!p.prototype) { - return - } + if (!p.prototype) return isAdd = true /* eslint-disable new-cap */ let plugin = new p() @@ -71,7 +69,6 @@ class PluginsLoader { priority: plugin.priority }) }) - if (isAdd) pluCount++ } catch (error) { if (error.stack.includes('Cannot find package')) { @@ -148,7 +145,6 @@ class PluginsLoader { /** 监听热更新 */ this.watch(val.name, app.name) - } } @@ -508,7 +504,8 @@ class PluginsLoader { logger.error(err) } - if (recallMsg > 0 && msgRes?.message_id) { + // 频道一下是不是频道 + if (!e.isGuild && recallMsg > 0 && msgRes?.message_id) { if (e.isGroup) { setTimeout(() => e.group.recallMsg(msgRes.message_id), recallMsg * 1000) } else if (e.friend) {