diff --git a/lib/common/common.js b/lib/common/common.js
index 84a8a17..f476349 100644
--- a/lib/common/common.js
+++ b/lib/common/common.js
@@ -9,7 +9,7 @@ import path from 'node:path'
* @param user_id qq号
* @param msg 消息
*/
-async function relpyPrivate (userId, msg) {
+async function relpyPrivate(userId, msg) {
userId = Number(userId)
let friend = Bot.fl.get(userId)
@@ -25,7 +25,7 @@ async function relpyPrivate (userId, msg) {
* 休眠函数
* @param ms 毫秒
*/
-function sleep (ms) {
+function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
@@ -34,7 +34,7 @@ function sleep (ms) {
* @param fileUrl 下载地址
* @param savePath 保存路径
*/
-async function downFile (fileUrl, savePath, param = {}) {
+async function downFile(fileUrl, savePath, param = {}) {
try {
mkdirs(path.dirname(savePath))
logger.debug(`[下载文件] ${fileUrl}`)
@@ -48,7 +48,7 @@ async function downFile (fileUrl, savePath, param = {}) {
}
}
-function mkdirs (dirname) {
+function mkdirs(dirname) {
if (fs.existsSync(dirname)) {
return true
} else {
@@ -61,19 +61,19 @@ function mkdirs (dirname) {
/**
* 制作转发消息
- * @param e icqq消息e
+ * @param e 消息事件
* @param msg 消息数组
* @param dec 转发描述
* @param msgsscr 转发信息是否为Bot
*/
-async function makeForwardMsg (e, msg = [], dec = '', msgsscr = false) {
- // 是频道直接返回 join
- if (e.isGuild) return msg.join('\n')
+async function makeForwardMsg(e, msg = [], dec = '', msgsscr = false) {
let name = msgsscr ? this.e.sender.card || this.e.user_id : Bot.nickname
let id = msgsscr ? this.e.user_id : Bot.uin
+
if (e.isGroup) {
- let info = await e.bot.getGroupMemberInfo(e.group_id, e.bot.uin)
+ let info = await e.bot.getGroupMemberInfo(e.group_id, id)
+ name = info.card || info.nickname
}
let userInfo = {
@@ -82,28 +82,34 @@ async function makeForwardMsg (e, msg = [], dec = '', msgsscr = false) {
}
let forwardMsg = []
- msg.forEach(msg => {
+ for (const message of msg)
forwardMsg.push({
...userInfo,
- message: msg
+ message
})
- })
/** 制作转发内容 */
- if (e.isGroup) {
+ if (e?.group?.makeForwardMsg) {
forwardMsg = await e.group.makeForwardMsg(forwardMsg)
- } else if (e.friend) {
+ } else if (e?.friend?.makeForwardMsg) {
forwardMsg = await e.friend.makeForwardMsg(forwardMsg)
} else {
- return false
+ return msg.join('\n')
}
if (dec) {
/** 处理描述 */
- forwardMsg.data = forwardMsg.data
- .replace(/\n/g, '')
- .replace(/
(.+?)<\/title>/g, '___')
- .replace(/___+/, `${dec}`)
+ if (typeof (forwardMsg.data) === 'object') {
+ let detail = forwardMsg.data?.meta?.detail
+ if (detail) {
+ detail.news = [{ text: dec }]
+ }
+ } else {
+ forwardMsg.data = forwardMsg.data
+ .replace(/\n/g, '')
+ .replace(/(.+?)<\/title>/g, '___')
+ .replace(/___+/, `${dec}`)
+ }
}
return forwardMsg
diff --git a/plugins/genshin/apps/abbrSet.js b/plugins/genshin/apps/abbrSet.js
index ca56b5a..26f4d48 100644
--- a/plugins/genshin/apps/abbrSet.js
+++ b/plugins/genshin/apps/abbrSet.js
@@ -1,4 +1,5 @@
import plugin from '../../../lib/plugins/plugin.js'
+import common from '../../../lib/common/common.js'
import fs from 'node:fs'
import gsCfg from '../model/gsCfg.js'
import YAML from 'yaml'
@@ -125,8 +126,7 @@ export class abbrSet extends plugin {
}
async delAbbr() {
- let role = gsCfg.getRole(this.e.msg, '#|星铁|删除|别名|昵称', this.e.isSr)
-
+ let role = gsCfg.getRole(this.e.msg, '#|删除|别名|昵称')
if (!role) return false
let nameArr = gsCfg.getConfig('role', 'name')
@@ -164,7 +164,7 @@ export class abbrSet extends plugin {
let title = `${role.name}别名,${list.length}个`
- msg = await this.makeForwardMsg(this.e.bot.uin, title, msg)
+ msg = await common.makeForwardMsg(this.e, msg, title)
await this.e.reply(msg)
}
diff --git a/plugins/genshin/model/gachaLog.js b/plugins/genshin/model/gachaLog.js
index 443126c..bad215a 100644
--- a/plugins/genshin/model/gachaLog.js
+++ b/plugins/genshin/model/gachaLog.js
@@ -64,11 +64,6 @@ export default class GachaLog extends base {
MakeMsg.push(tmpMsg)
MakeMsg.push(`抽卡记录更新完成,您还可回复\n【#${this?.e?.isSr?'星铁光锥':'武器'}记录】统计${this?.e?.isSr?'星铁光锥':'武器'}池数据\n【#${this?.e?.isSr?'星铁':''}角色统计】按卡池统计数据\n【#导出记录】导出记录数据`)
let Msg = await common.makeForwardMsg(this.e, MakeMsg, tmpMsg)
- Msg.data=Msg.data
- .replace(/\n/g, '')
- .replace(/(.+?)<\/title>/g, '___')
- .replace(/___+/, `${tmpMsg}`)
-
await this.e.reply(Msg)
this.isLogUrl = true
diff --git a/plugins/genshin/model/mys/mysInfo.js b/plugins/genshin/model/mys/mysInfo.js
index fe3bb79..31bb030 100644
--- a/plugins/genshin/model/mys/mysInfo.js
+++ b/plugins/genshin/model/mys/mysInfo.js
@@ -177,7 +177,7 @@ export default class MysInfo {
}
for (let i in res) {
- res[i] = await mysInfo.checkCode(res[i], res[i].api)
+ res[i] = await mysInfo.checkCode(res[i], res[i].api, mysApi)
if (res[i]?.retcode === 0) continue
@@ -185,7 +185,7 @@ export default class MysInfo {
}
} else {
res = await mysApi.getData(api, data)
- res = await mysInfo.checkCode(res, api)
+ res = await mysInfo.checkCode(res, api, mysApi)
}
return res
@@ -335,7 +335,7 @@ export default class MysInfo {
return this.ckUser?.ck
}
- async checkCode(res, type) {
+ async checkCode(res, type, mysApi = {}) {
if (!res) {
this.e.reply('米游社接口请求失败,暂时无法查询')
return false
diff --git a/plugins/genshin/model/mysNews.js b/plugins/genshin/model/mysNews.js
index 7a5cd58..22ac2e3 100644
--- a/plugins/genshin/model/mysNews.js
+++ b/plugins/genshin/model/mysNews.js
@@ -264,9 +264,7 @@ export default class MysNews extends base {
return img[0]
} else {
let msg = [titile, ...img]
- return await common.makeForwardMsg(this.e, msg, titile).catch((err) => {
- logger.error(err)
- })
+ return await common.makeForwardMsg(this.e, msg, titile)
}
}
diff --git a/plugins/genshin/model/mysSrNews.js b/plugins/genshin/model/mysSrNews.js
index 2a2093b..68e7125 100644
--- a/plugins/genshin/model/mysSrNews.js
+++ b/plugins/genshin/model/mysSrNews.js
@@ -186,9 +186,7 @@ export default class MysSrNews extends base {
return img[0]
} else {
let msg = [titile, ...img]
- return await common.makeForwardMsg(this.e, msg, titile).catch((err) => {
- logger.error(err)
- })
+ return await common.makeForwardMsg(this.e, msg, titile)
}
}
diff --git a/plugins/other/sendLog.js b/plugins/other/sendLog.js
index 03ea644..ca5232c 100644
--- a/plugins/other/sendLog.js
+++ b/plugins/other/sendLog.js
@@ -1,10 +1,11 @@
import plugin from '../../lib/plugins/plugin.js'
+import common from '../../lib/common/common.js'
import fs from 'node:fs'
import lodash from 'lodash'
import moment from 'moment'
export class sendLog extends plugin {
- constructor () {
+ constructor() {
super({
name: '发送日志',
dsc: '发送最近100条运行日志',
@@ -25,7 +26,7 @@ export class sendLog extends plugin {
this.errFile = './logs/error.log'
}
- async sendLog () {
+ async sendLog() {
let lineNum = this.e.msg.match(/\d+/g)
if (lineNum) {
this.lineNum = lineNum[0]
@@ -49,12 +50,12 @@ export class sendLog extends plugin {
return
}
- let forwardMsg = await this.makeForwardMsg(`最近${log.length}条${type}日志`, log)
+ let forwardMsg = await common.makeForwardMsg(this.e, log, `最近${log.length}条${type}日志`)
await this.reply(forwardMsg)
}
- getLog (logFile) {
+ getLog(logFile) {
let log = fs.readFileSync(logFile, { encoding: 'utf-8' })
log = log.split('\n')
@@ -78,42 +79,4 @@ export class sendLog extends plugin {
return tmp
}
-
- async makeForwardMsg (title, msg) {
- let nickname = this.e.bot.nickname
- if (this.e.isGroup) {
- let info = await this.e.bot.getGroupMemberInfo(this.e.group_id, this.e.bot.uin)
- 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/other/update.js b/plugins/other/update.js
index 5c42e26..d49a4eb 100644
--- a/plugins/other/update.js
+++ b/plugins/other/update.js
@@ -11,7 +11,7 @@ const { exec, execSync } = require('child_process')
let uping = false
export class update extends plugin {
- constructor () {
+ constructor() {
super({
name: '更新',
dsc: '#更新 #强制更新',
@@ -37,7 +37,7 @@ export class update extends plugin {
this.typeName = 'Miao-Yunzai'
}
- async update () {
+ async update() {
if (!this.e.isMaster) return false
if (uping) {
await this.reply('已有命令更新中..请勿重复操作')
@@ -64,7 +64,7 @@ export class update extends plugin {
}
}
- async checkGit () {
+ async checkGit() {
let ret = await execSync('git --version', { encoding: 'utf-8' })
if (!ret || !ret.includes('git version')) {
await this.reply('请先安装git')
@@ -74,21 +74,19 @@ export class update extends plugin {
return true
}
- getPlugin (plugin = '') {
+ getPlugin(plugin = '') {
if (!plugin) {
plugin = this.e.msg.replace(/#|更新|强制/g, '')
if (!plugin) return ''
}
- let path = `./plugins/${plugin}/.git`
-
- if (!fs.existsSync(path)) return false
+ if (!fs.existsSync(`plugins/${plugin}/.git`)) return false
this.typeName = plugin
return plugin
}
- async execSync (cmd) {
+ async execSync(cmd) {
return new Promise((resolve, reject) => {
exec(cmd, { windowsHide: true }, (error, stdout, stderr) => {
resolve({ error, stdout, stderr })
@@ -96,7 +94,7 @@ export class update extends plugin {
})
}
- async runUpdate (plugin = '') {
+ async runUpdate(plugin = '') {
this.isNowUp = false
let cm = 'git pull --no-rebase'
@@ -104,17 +102,15 @@ export class update extends plugin {
let type = '更新'
if (this.e.msg.includes('强制')) {
type = '强制更新'
- cm = `git fetch --all && git reset --hard && ${cm}`
+ cm = `git reset --hard && git pull --rebase --allow-unrelated-histories`
}
if (plugin) {
- if (this.e.msg.includes('强制')) {
- type = '强制更新'
- cm = `git -C ./plugins/${plugin}/ fetch --all && git -C ./plugins/${plugin}/ reset --hard && git -C ./plugins/${plugin}/ pull`
- }else{
- cm = `git -C ./plugins/${plugin}/ pull --no-rebase`
- }
-}
+ if (type == '强制更新')
+ cm = `cd "plugins/${plugin}" && git reset --hard && git pull --rebase --allow-unrelated-histories`
+ else
+ cm = `cd "plugins/${plugin}" && git pull --no-rebase`
+ }
this.oldCommitId = await this.getcommitId(plugin)
@@ -147,10 +143,10 @@ export class update extends plugin {
return true
}
- async getcommitId (plugin = '') {
+ async getcommitId(plugin = '') {
let cm = 'git rev-parse --short HEAD'
if (plugin) {
- cm = `git -C ./plugins/${plugin}/ rev-parse --short HEAD`
+ cm = `cd "plugins/${plugin}" && git rev-parse --short HEAD`
}
let commitId = await execSync(cm, { encoding: 'utf-8' })
@@ -159,10 +155,10 @@ export class update extends plugin {
return commitId
}
- async getTime (plugin = '') {
- let cm = 'git log -1 --oneline --pretty=format:"%cd" --date=format:"%m-%d %H:%M"'
+ async getTime(plugin = '') {
+ let cm = 'git log -1 --pretty=format:"%cd" --date=format:"%F %T"'
if (plugin) {
- cm = `cd ./plugins/${plugin}/ && git log -1 --oneline --pretty=format:"%cd" --date=format:"%m-%d %H:%M"`
+ cm = `cd "plugins/${plugin}" && git log -1 --pretty=format:"%cd" --date=format:"%F %T"`
}
let time = ''
@@ -177,7 +173,7 @@ export class update extends plugin {
return time
}
- async gitErr (err, stdout) {
+ async gitErr(err, stdout) {
let msg = '更新失败!'
let errMsg = err.toString()
stdout = stdout.toString()
@@ -207,7 +203,7 @@ export class update extends plugin {
await this.reply([errMsg, stdout])
}
- async updateAll () {
+ async updateAll() {
let dirs = fs.readdirSync('./plugins/')
await this.runUpdate()
@@ -225,14 +221,14 @@ export class update extends plugin {
}
}
- restart () {
+ restart() {
new Restart(this.e).restart()
}
- async getLog (plugin = '') {
- let cm = 'git log -20 --oneline --pretty=format:"%h||[%cd] %s" --date=format:"%m-%d %H:%M"'
+ async getLog(plugin = '') {
+ let cm = 'git log -20 --pretty=format:"%h||[%cd] %s" --date=format:"%F %T"'
if (plugin) {
- cm = `cd ./plugins/${plugin}/ && ${cm}`
+ cm = `cd "plugins/${plugin}" && ${cm}`
}
let logAll
@@ -261,57 +257,12 @@ export class update extends plugin {
let end = ''
- log = await this.makeForwardMsg(`${plugin || 'Miao-Yunzai'}更新日志,共${line}条`, log, end)
+ log = await common.makeForwardMsg(this.e, [log, end], `${plugin || 'Miao-Yunzai'}更新日志,共${line}条`)
return log
}
- async makeForwardMsg (title, msg, end) {
- let nickname = this.e.bot.nickname
- if (this.e.isGroup) {
- let info = await this.e.bot.getGroupMemberInfo(this.e.group_id, this.e.bot.uin)
- nickname = info.card ?? info.nickname
- }
- let userInfo = {
- user_id: this.e.bot.uin,
- nickname
- }
-
- let forwardMsg = [
- {
- ...userInfo,
- message: title
- },
- {
- ...userInfo,
- message: msg
- }
- ]
-
- if (end) {
- forwardMsg.push({
- ...userInfo,
- message: end
- })
- }
-
- /** 制作转发内容 */
- 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
- }
-
- async updateLog () {
+ async updateLog() {
let log = await this.getLog()
await this.reply(log)
}
diff --git a/plugins/system/add.js b/plugins/system/add.js
index 6bb0ce6..eadea11 100644
--- a/plugins/system/add.js
+++ b/plugins/system/add.js
@@ -1,9 +1,8 @@
-
import cfg from '../../lib/config/config.js'
import plugin from '../../lib/plugins/plugin.js'
+import common from '../../lib/common/common.js'
import fs from 'node:fs'
import lodash from 'lodash'
-import { segment } from 'icqq'
import { pipeline } from 'stream'
import { promisify } from 'util'
import fetch from 'node-fetch'
@@ -12,7 +11,7 @@ import moment from 'moment'
let textArr = {}
export class add extends plugin {
- constructor () {
+ constructor() {
super({
name: '添加表情',
dsc: '添加表情,文字等',
@@ -45,7 +44,7 @@ export class add extends plugin {
this.isGlobal = false
}
- async init () {
+ async init() {
if (!fs.existsSync(this.path)) {
fs.mkdirSync(this.path)
}
@@ -54,7 +53,7 @@ export class add extends plugin {
}
}
- async accept () {
+ async accept() {
/** 处理消息 */
if (this.e.atBot && this.e.msg && this.e?.msg.includes('添加') && !this.e?.msg.includes('#')) {
this.e.msg = '#' + this.e.msg
@@ -62,12 +61,12 @@ export class add extends plugin {
}
/** 群号key */
- get grpKey () {
+ get grpKey() {
return `Yz:group_id:${this.e.user_id}`
}
/** #添加 */
- async add () {
+ async add() {
this.isGlobal = this.e?.msg.includes("全局");
await this.getGroupId()
@@ -95,14 +94,13 @@ export class add extends plugin {
}
/** 获取群号 */
- async getGroupId () {
-
+ async getGroupId() {
/** 添加全局表情,存入到机器人qq文件中 */
if (this.isGlobal) {
this.group_id = this.e.bot.uin;
return this.e.bot.uin;
}
-
+
if (this.e.isGroup) {
this.group_id = this.e.group_id
redis.setEx(this.grpKey, 3600 * 24 * 30, String(this.group_id))
@@ -119,7 +117,7 @@ export class add extends plugin {
return false
}
- checkAuth () {
+ checkAuth() {
if (this.e.isMaster) return true
let groupCfg = cfg.getGroup(this.group_id)
@@ -148,7 +146,7 @@ export class add extends plugin {
return true
}
- checkKeyWord () {
+ checkKeyWord() {
if (this.e.img && this.e.img.length > 1) {
this.e.reply('添加错误:只能发送一个表情当关键词')
return false
@@ -171,7 +169,7 @@ export class add extends plugin {
}
/** 单独添加 */
- async singleAdd () {
+ async singleAdd() {
if (this.e.message.length != 2) return false
let msg = lodash.keyBy(this.e.message, 'type')
if (!this.e.msg || !msg.image) return false
@@ -194,7 +192,7 @@ export class add extends plugin {
}
/** 获取添加关键词 */
- getKeyWord () {
+ getKeyWord() {
this.e.isGlobal = this.e.msg.includes("全局");
this.keyWord = this.e.toString()
@@ -214,7 +212,7 @@ export class add extends plugin {
}
/** 过滤别名 */
- trimAlias (msg) {
+ trimAlias(msg) {
let groupCfg = cfg.getGroup(this.group_id)
let alias = groupCfg.botAlias
if (!Array.isArray(alias)) {
@@ -230,7 +228,7 @@ export class add extends plugin {
}
/** 添加内容 */
- async addContext () {
+ async addContext() {
this.isGlobal = this.e.isGlobal || this.getContext()?.addContext?.isGlobal;
await this.getGroupId()
/** 关键词 */
@@ -287,7 +285,7 @@ export class add extends plugin {
}
/** 添加成功回复消息 */
- getRetMsg () {
+ getRetMsg() {
let retMsg = this.getContext()
let msg = ''
if (retMsg?.addContext?.message) {
@@ -316,7 +314,7 @@ export class add extends plugin {
return lodash.compact(msg)
}
- saveJson () {
+ saveJson() {
let obj = {}
for (let [k, v] of textArr[this.group_id]) {
obj[k] = v
@@ -324,7 +322,7 @@ export class add extends plugin {
fs.writeFileSync(`${this.path}${this.group_id}.json`, JSON.stringify(obj, '', '\t'))
}
-
+
saveGlobalJson() {
let obj = {};
for (let [k, v] of textArr[this.e.bot.uin]) {
@@ -337,7 +335,7 @@ export class add extends plugin {
);
}
- async saveImg (url, keyWord) {
+ async saveImg(url, keyWord) {
let groupCfg = cfg.getGroup(this.group_id)
let savePath = `${this.facePath}${this.group_id}/`
@@ -375,9 +373,9 @@ export class add extends plugin {
return savePath
}
- async getText () {
+ async getText() {
if (!this.e.message) return false
-
+
this.isGlobal = false
await this.getGroupId()
@@ -385,7 +383,7 @@ export class add extends plugin {
if (!this.group_id) return false
this.initTextArr()
-
+
this.initGlobalTextArr()
let keyWord = this.e.toString()
@@ -410,7 +408,7 @@ export class add extends plugin {
if (lodash.isEmpty(msg) && lodash.isEmpty(globalMsg)) return false
msg = [...msg, ...globalMsg]
-
+
if (num >= 0 && num < msg.length) {
msg = msg[num]
} else {
@@ -446,7 +444,7 @@ export class add extends plugin {
return true
}
- expiredMsg (keyWord, num) {
+ expiredMsg(keyWord, num) {
logger.mark(`[发送表情]${this.e.logText} ${keyWord} 表情已过期失效`)
let arr = textArr[this.group_id].get(keyWord)
@@ -462,7 +460,7 @@ export class add extends plugin {
}
/** 初始化已添加内容 */
- initTextArr () {
+ initTextArr() {
if (textArr[this.group_id]) return
textArr[this.group_id] = new Map()
@@ -510,7 +508,7 @@ export class add extends plugin {
fs.mkdirSync(facePath)
}
}
-
+
/** 初始化全局已添加内容 */
initGlobalTextArr() {
if (textArr[this.e.bot.uin]) return;
@@ -568,7 +566,7 @@ export class add extends plugin {
}
}
- async del () {
+ async del() {
this.isGlobal = this.e?.msg.includes("全局");
await this.getGroupId()
if (!this.group_id) return false
@@ -652,14 +650,14 @@ export class add extends plugin {
img = item[0]
}
if (img.local) {
- fs.unlink(img.local, () => {})
+ fs.unlink(img.local, () => { })
}
})
this.saveJson()
}
- async list () {
+ async list() {
this.isGlobal = this.e?.msg.includes("全局");
let page = 1
@@ -727,9 +725,8 @@ export class add extends plugin {
num++
}
- let end = ''
if (type == 'list' && count > 100) {
- end = `更多内容请翻页查看\n如:#表情列表${Number(page) + 1}`
+ msg.push(`更多内容请翻页查看\n如:#表情列表${Number(page) + 1}`)
}
let title = `表情列表,第${page}页,共${count}条`
@@ -737,63 +734,19 @@ export class add extends plugin {
title = `表情${search},${count}条`
}
- let forwardMsg = await this.makeForwardMsg(this.e.bot.uin, title, msg, end)
+ let forwardMsg = await common.makeForwardMsg(this.e, msg, title)
this.e.reply(forwardMsg)
}
- async makeForwardMsg (qq, title, msg, end = '') {
- 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
- }
- ]
-
- let msgArr = lodash.chunk(msg, 40)
- msgArr.forEach(v => {
- v[v.length - 1] = lodash.trim(v[v.length - 1], '\n')
- forwardMsg.push({ ...userInfo, message: v })
- })
-
- if (end) {
- forwardMsg.push({ ...userInfo, message: end })
- }
-
- /** 制作转发内容 */
- 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
- }
-
/** 分页 */
- pagination (pageNo, pageSize, array) {
+ pagination(pageNo, pageSize, array) {
let offset = (pageNo - 1) * pageSize
return offset + pageSize >= array.length ? array.slice(offset, array.length) : array.slice(offset, offset + pageSize)
}
/** 关键词转换成可发送消息 */
- async keyWordTran (msg) {
+ async keyWordTran(msg) {
/** 图片 */
if (msg.includes('{image')) {
let tmp = msg.split('{image')
@@ -825,4 +778,4 @@ export class add extends plugin {
return msg
}
-}
+}
\ No newline at end of file