diff --git a/lib/common/common.js b/lib/common/common.js
index f476349..8b79e8d 100644
--- a/lib/common/common.js
+++ b/lib/common/common.js
@@ -67,6 +67,7 @@ function mkdirs(dirname) {
* @param msgsscr 转发信息是否为Bot
*/
async function makeForwardMsg(e, msg = [], dec = '', msgsscr = false) {
+ if (!Array.isArray(msg)) msg = [msg]
let name = msgsscr ? this.e.sender.card || this.e.user_id : Bot.nickname
let id = msgsscr ? this.e.user_id : Bot.uin
@@ -82,11 +83,14 @@ async function makeForwardMsg(e, msg = [], dec = '', msgsscr = false) {
}
let forwardMsg = []
- for (const message of msg)
+ for (const message of msg){
+ if(!message) continue
forwardMsg.push({
...userInfo,
- message
+ message: message
})
+ }
+
/** 制作转发内容 */
if (e?.group?.makeForwardMsg) {
diff --git a/plugins/genshin/apps/abbrSet.js b/plugins/genshin/apps/abbrSet.js
index 26f4d48..25eee0a 100644
--- a/plugins/genshin/apps/abbrSet.js
+++ b/plugins/genshin/apps/abbrSet.js
@@ -159,51 +159,13 @@ export class abbrSet extends plugin {
let msg = []
for (let i in list) {
let num = Number(i) + 1
- msg.push(`${num}.${list[i]}\n`)
+ msg.push(`${num}.${list[i]}`)
}
let title = `${role.name}别名,${list.length}个`
- msg = await common.makeForwardMsg(this.e, msg, title)
+ msg = await common.makeForwardMsg(this.e, [title, msg.join("\n")], title)
await this.e.reply(msg)
}
-
- async makeForwardMsg(qq, title, msg) {
- let nickname = this.e.bot.nickname
- if (this.e.isGroup) {
- let info = await this.e.bot.getGroupMemberInfo(this.e.group_id, qq)
- nickname = info.card ?? info.nickname
- }
- let userInfo = {
- user_id: this.e.bot.uin,
- nickname
- }
-
- let forwardMsg = [
- {
- ...userInfo,
- message: title
- },
- {
- ...userInfo,
- message: msg
- }
- ]
-
- /** 制作转发内容 */
- if (this.e.isGroup) {
- forwardMsg = await this.e.group.makeForwardMsg(forwardMsg)
- } else {
- forwardMsg = await this.e.friend.makeForwardMsg(forwardMsg)
- }
-
- /** 处理描述 */
- forwardMsg.data = forwardMsg.data
- .replace(/\n/g, '')
- .replace(/
(.+?)<\/title>/g, '___')
- .replace(/___+/, `${title}`)
-
- return forwardMsg
- }
}
diff --git a/plugins/genshin/model/mysNews.js b/plugins/genshin/model/mysNews.js
index 22ac2e3..0bb40c2 100644
--- a/plugins/genshin/model/mysNews.js
+++ b/plugins/genshin/model/mysNews.js
@@ -258,13 +258,13 @@ export default class MysNews extends base {
return await this.replyMsg(img, `${param.data.post.subject}`)
}
- async replyMsg (img, titile) {
+ async replyMsg (img, title) {
if (!img || img.length <= 0) return false
if (img.length == 1) {
return img[0]
} else {
- let msg = [titile, ...img]
- return await common.makeForwardMsg(this.e, msg, titile)
+ let msg = [title, ...img]
+ return await common.makeForwardMsg(this.e, msg, title)
}
}
diff --git a/plugins/genshin/model/mysSrNews.js b/plugins/genshin/model/mysSrNews.js
index 68e7125..69e6c64 100644
--- a/plugins/genshin/model/mysSrNews.js
+++ b/plugins/genshin/model/mysSrNews.js
@@ -180,13 +180,13 @@ export default class MysSrNews extends base {
return emp
}
- async replyMsg (img, titile) {
+ async replyMsg (img, title) {
if (!img || img.length <= 0) return false
if (img.length == 1) {
return img[0]
} else {
- let msg = [titile, ...img]
- return await common.makeForwardMsg(this.e, msg, titile)
+ let msg = [title, ...img]
+ return await common.makeForwardMsg(this.e, msg, title)
}
}
diff --git a/plugins/other/sendLog.js b/plugins/other/sendLog.js
index ca5232c..6fbd113 100644
--- a/plugins/other/sendLog.js
+++ b/plugins/other/sendLog.js
@@ -49,8 +49,9 @@ export class sendLog extends plugin {
this.reply(`暂无相关日志:${type}`)
return
}
+ let title = `最近${log.length}条${type}日志`
- let forwardMsg = await common.makeForwardMsg(this.e, log, `最近${log.length}条${type}日志`)
+ let forwardMsg = await common.makeForwardMsg(this.e, [title, log.join("")], title)
await this.reply(forwardMsg)
}
diff --git a/plugins/other/update.js b/plugins/other/update.js
index d49a4eb..ed434a4 100644
--- a/plugins/other/update.js
+++ b/plugins/other/update.js
@@ -255,9 +255,9 @@ export class update extends plugin {
if (log.length <= 0) return ''
- let end = ''
+ let title = `${plugin || 'Miao-Yunzai'}更新日志,共${line}条`
- log = await common.makeForwardMsg(this.e, [log, end], `${plugin || 'Miao-Yunzai'}更新日志,共${line}条`)
+ log = await common.makeForwardMsg(this.e, [title, log], title)
return log
}
diff --git a/plugins/system/add.js b/plugins/system/add.js
index eadea11..9568688 100644
--- a/plugins/system/add.js
+++ b/plugins/system/add.js
@@ -734,7 +734,7 @@ export class add extends plugin {
title = `表情${search},${count}条`
}
- let forwardMsg = await common.makeForwardMsg(this.e, msg, title)
+ let forwardMsg = await common.makeForwardMsg(this.e, [title, msg], title)
this.e.reply(forwardMsg)
}