细节优化

This commit is contained in:
🌌 2023-05-26 16:53:00 +08:00
parent 7257bd9c24
commit ca457af8b6
5 changed files with 26 additions and 19 deletions

View File

@ -92,7 +92,13 @@ export default class ComWeChatAdapter {
}
async getFriendArray(data) {
return (await data.sendApi("get_friend_list", {})).data
const array = []
for (const i of (await data.sendApi("get_friend_list", {})).data.filter(item => !item.user_id?.endsWith("@chatroom")))
array.push({
...i,
nickname: i.user_remark == "null" ? i.user_displayname || i.user_name : i.user_remark,
})
return array
}
async getFriendList(data) {
@ -116,7 +122,13 @@ export default class ComWeChatAdapter {
}
async getGroupArray(data) {
return (await data.sendApi("get_group_list", {})).data
const array = (await data.sendApi("get_group_list", {})).data
for (const i of (await data.sendApi("get_friend_list", {})).data.filter(item => item.user_id?.endsWith("@chatroom")))
array.push({
group_id: i.user_id,
group_name: i.user_remark == "null" ? i.user_displayname || i.user_name : i.user_remark,
})
return array
}
async getGroupList(data) {

View File

@ -3,11 +3,8 @@ import redisInit from './redis.js'
import { checkRun } from './check.js'
import cfg from './config.js'
// 添加一些多余的标题内容
let title = 'TRSS-Yunzai'
/** 设置标题 */
process.title = title
process.title = 'TRSS Yunzai'
/** 设置时区 */
process.env.TZ = 'Asia/Shanghai'
@ -24,9 +21,9 @@ process.on('unhandledRejection', (error, promise) => {
/** 退出事件 */
process.on('exit', async (code) => {
if (typeof redis != 'undefined' && typeof test == 'undefined') {
if (typeof redis != 'undefined' && typeof test == 'undefined')
await redis.save()
}
logger.mark(logger.green('TRSS-Yunzai 已停止运行'))
})
await checkInit()

View File

@ -700,18 +700,18 @@ class PluginsLoader {
if (e.test) return true
/** 黑名单qq */
if (other.blackQQ && other.blackQQ.includes(Number(e.user_id) || String(e.user_id))) {
if (other.blackQQ?.length && other.blackQQ.includes(Number(e.user_id) || String(e.user_id))) {
return false
}
if (e.group_id) {
/** 白名单群 */
if (other.whiteGroup) {
if (other.whiteGroup?.length) {
if (other.whiteGroup.includes(Number(e.group_id) || String(e.group_id))) return true
return false
}
/** 黑名单群 */
if (other.blackGroup && other.blackGroup.includes(Number(e.group_id) || String(e.group_id))) {
if (other.blackGroup?.length && other.blackGroup.includes(Number(e.group_id) || String(e.group_id))) {
return false
}
}

View File

@ -20,29 +20,27 @@
"chalk": "^5.2.0",
"chokidar": "^3.5.3",
"express": "^4.18.2",
"https-proxy-agent": "6.1.0",
"https-proxy-agent": "7.0.0",
"image-size": "^1.0.2",
"inquirer": "^9.2.2",
"lodash": "^4.17.21",
"log4js": "^6.9.1",
"md5": "^2.3.0",
"moment": "^2.29.4",
"node-fetch": "^3.3.1",
"node-schedule": "^2.1.1",
"node-xlsx": "^0.21.2",
"pm2": "^5.3.0",
"puppeteer": "^20.2.0",
"puppeteer": "^20.4.0",
"redis": "^4.6.6",
"sequelize": "^6.31.1",
"sqlite3": "^5.1.6",
"ws": "^8.13.0",
"yaml": "^2.2.2"
"yaml": "^2.3.0"
},
"devDependencies": {
"eslint": "^8.40.0",
"eslint": "^8.41.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-n": "^16.0.0",
"eslint-plugin-promise": "^6.1.1"
},
"imports": {

View File

@ -104,7 +104,7 @@ export class update extends plugin {
let type = '更新'
if (this.e.msg.includes('强制')) {
type = '强制更新'
cm = `git reset --hard origin/master && ${cm}`
cm = `git fetch --all && git reset --hard && ${cm}`
}
if (plugin) {