[频道支持] 无关紧要的修改 (#33)

* 频道支持#1
This commit is contained in:
2y8e9h22 2023-03-18 11:44:33 +08:00 committed by GitHub
parent f2b448c550
commit 930678c7d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -1,4 +1,3 @@
import { pipeline } from 'stream' import { pipeline } from 'stream'
import { promisify } from 'util' import { promisify } from 'util'
import fetch from 'node-fetch' import fetch from 'node-fetch'
@ -67,11 +66,16 @@ function mkdirs (dirname) {
* @param dec 转发描述 * @param dec 转发描述
*/ */
async function makeForwardMsg (e, msg = [], dec = '') { async function makeForwardMsg (e, msg = [], dec = '') {
// 是频道直接返回 join
if (e.isGuild) return msg.join("\n")
let nickname = Bot.nickname let nickname = Bot.nickname
if (e.isGroup) { if (e.isGroup) {
let info = await Bot.getGroupMemberInfo(e.group_id, Bot.uin) let info = await Bot.getGroupMemberInfo(e.group_id, Bot.uin)
nickname = info.card || info.nickname nickname = info.card || info.nickname
} }
let userInfo = { let userInfo = {
user_id: Bot.uin, user_id: Bot.uin,
nickname nickname

View File

@ -53,9 +53,7 @@ class PluginsLoader {
if (tmp.apps) tmp = { ...tmp.apps } if (tmp.apps) tmp = { ...tmp.apps }
let isAdd = false let isAdd = false
lodash.forEach(tmp, (p, i) => { lodash.forEach(tmp, (p, i) => {
if (!p.prototype) { if (!p.prototype) return
return
}
isAdd = true isAdd = true
/* eslint-disable new-cap */ /* eslint-disable new-cap */
let plugin = new p() let plugin = new p()
@ -71,7 +69,6 @@ class PluginsLoader {
priority: plugin.priority priority: plugin.priority
}) })
}) })
if (isAdd) pluCount++ if (isAdd) pluCount++
} catch (error) { } catch (error) {
if (error.stack.includes('Cannot find package')) { if (error.stack.includes('Cannot find package')) {
@ -148,7 +145,6 @@ class PluginsLoader {
/** 监听热更新 */ /** 监听热更新 */
this.watch(val.name, app.name) this.watch(val.name, app.name)
} }
} }
@ -508,7 +504,8 @@ class PluginsLoader {
logger.error(err) logger.error(err)
} }
if (recallMsg > 0 && msgRes?.message_id) { // 频道一下是不是频道
if (!e.isGuild && recallMsg > 0 && msgRes?.message_id) {
if (e.isGroup) { if (e.isGroup) {
setTimeout(() => e.group.recallMsg(msgRes.message_id), recallMsg * 1000) setTimeout(() => e.group.recallMsg(msgRes.message_id), recallMsg * 1000)
} else if (e.friend) { } else if (e.friend) {