适配一下`WeChat-plugin` (#236)

`ComWeChatBotClient`的`user_id`和`group_id`都是字符串,在此的情况下,不能正确识别id,导致黑白名单和主人无法生效问题
This commit is contained in:
Zyy955 2023-08-29 02:31:48 +08:00 committed by GitHub
parent cebae48eba
commit c09d0d2629
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -67,8 +67,6 @@ function mkdirs(dirname) {
* @param msgsscr 转发信息是否伪装 * @param msgsscr 转发信息是否伪装
*/ */
async function makeForwardMsg(e, msg = [], dec = '', msgsscr = false) { async function makeForwardMsg(e, msg = [], dec = '', msgsscr = false) {
/** 是频道插件直接返回 */
if (e.QQGuild) return msg
if (!Array.isArray(msg)) msg = [msg] if (!Array.isArray(msg)) msg = [msg]

View File

@ -440,7 +440,7 @@ class PluginsLoader {
e.isGuild = true e.isGuild = true
} }
if (e.user_id && cfg.masterQQ.includes(Number(e.user_id))) { if (e.user_id && cfg.masterQQ.includes(Number(e.user_id) || e.user_id)) {
e.isMaster = true e.isMaster = true
} }
@ -486,7 +486,7 @@ class PluginsLoader {
text = lodash.truncate(e.sender.card, { length: 10 }) text = lodash.truncate(e.sender.card, { length: 10 })
} }
if (at === true) { if (at === true) {
at = Number(e.user_id) at = Number(e.user_id) || e.user_id
} else if (!isNaN(at)) { } else if (!isNaN(at)) {
if (e.isGuild) { if (e.isGuild) {
text = e.sender?.nickname text = e.sender?.nickname
@ -703,18 +703,18 @@ class PluginsLoader {
if (e.test) return true if (e.test) return true
/** 黑名单qq */ /** 黑名单qq */
if (other.blackQQ && other.blackQQ.includes(Number(e.user_id))) { if (other.blackQQ && other.blackQQ.includes(Number(e.user_id) || e.user_id)) {
return false return false
} }
if (e.group_id) { if (e.group_id) {
/** 白名单群 */ /** 白名单群 */
if (Array.isArray(other.whiteGroup) && other.whiteGroup.length > 0) { if (Array.isArray(other.whiteGroup) && other.whiteGroup.length > 0) {
return other.whiteGroup.includes(Number(e.group_id)) return other.whiteGroup.includes(Number(e.group_id) || e.group_id)
} }
/** 黑名单群 */ /** 黑名单群 */
if (Array.isArray(other.blackGroup) && other.blackGroup.length > 0) { if (Array.isArray(other.blackGroup) && other.blackGroup.length > 0) {
return !other.blackGroup.includes(Number(e.group_id)) return !other.blackGroup.includes(Number(e.group_id) || e.group_id)
} }
} }