feat: 注释废弃变量

This commit is contained in:
ningmengchongshui 2024-06-10 15:28:42 +08:00
parent 6c76096fad
commit eaa2ad1e89
9 changed files with 37 additions and 50 deletions

View File

@ -34,5 +34,5 @@ export class Image {
}
export const imgae = new Image()
// render 是异步的,因此 此处也是异步的
const img = await imgae.getHelloComponent(1715713638, { name: 'word' })
await imgae.getHelloComponent(1715713638, { name: 'word' })
// e.reply(segment.buffer(img))

View File

@ -6,7 +6,7 @@ import { exec } from 'child_process'
*/
exec(
'tailwindcss -i ./src/input.css -o ./public/output.css --watch',
(error, stdout, stderr) => {
(error, _, __) => {
if (error) {
//
}

View File

@ -1,8 +1,6 @@
import cfg from "./config.js"
import { execAsync, sleep } from "../utils/common.js"
import { createClient } from "redis"
import { exec } from "node:child_process"
/**
* redis客户端
@ -25,7 +23,9 @@ export default async function redisInit() {
const cmd = "redis-server --save 900 1 --save 300 10 --daemonize yes" + await aarch64()
logger.info("正在启动 Redis...")
await execSync(cmd)
await execAsync(cmd)
await sleep(1000)
try {
@ -57,34 +57,21 @@ export default async function redisInit() {
* @returns
*/
export async function aarch64() {
if (process.platform == "win32"){
if (process.platform == "win32") {
return ""
}
return await execAsync("uname -m").then( async arch=>{
return await execAsync("uname -m").then(async arch => {
if (arch.stdout && arch.stdout.includes("aarch64")) {
/** 判断redis版本 */
let v = await execAsync("redis-server -v")
if (v.stdout) {
const data = v.stdout.match(/v=(\d)./)
/** 忽略arm警告 */
if (data && Number(data[1]) >= 6){
if (data && Number(data[1]) >= 6) {
return " --ignore-warnings ARM64-COW-BUG"
}
}
}
return ''
})
}
/**
*
* @param cmd
* @returns
*/
export function execSync(cmd) {
return new Promise((resolve, reject) => {
exec(cmd, (error, stdout, stderr) => {
resolve({ error, stdout, stderr })
})
})
}

View File

@ -33,13 +33,13 @@ export default class loginEvent extends EventListener {
*
* @param event
*/
async execute(event) {}
async execute(_) {}
/**
* ip下进行
* @param event
*/
async qrcode(event) {
async qrcode(_) {
logger.mark(
`请使用登录当前QQ的手机${logger.green('扫码')}完成登录,如果显示二维码过期,可以按${logger.green('回车键Enter')}刷新,重新输入密码请执行命令:${logger.green('node app login')}`
)

View File

@ -25,7 +25,7 @@ export default class onlineEvent extends EventListener {
*
* @param e
*/
async execute(e) {
async execute(_) {
logger.mark('----^_^----')
logger.mark(
logger.green(`${BOT_NAME} 上线成功 版本v${cfg.package.version}`)

View File

@ -63,7 +63,7 @@ const Handler = {
* @param e
* @param args
*/
async callAll (key, e, args) {
async callAll (_, __, ___) {
// 暂时屏蔽调用
// return Handler.call(key, e, args, true)
},

View File

@ -17,9 +17,9 @@ class PluginsLoader {
priority = []
handler = {}
task = []
//
dir = join(process.cwd(),'plugins')
dir = join(process.cwd(), 'plugins')
/**
* cd
@ -58,11 +58,11 @@ class PluginsLoader {
if (val.isFile()) continue
const tmp = {
name: val.name,
path: join(this.dir,val.name),
path: join(this.dir, val.name),
}
try {
const dir = join(tmp.path,'index.js')
const dir = join(tmp.path, 'index.js')
if (await fs.stat(dir)) {
tmp.path = dir
ret.push(tmp)
@ -70,11 +70,11 @@ class PluginsLoader {
}
} catch (err) {
//
}
}
//
//
const dir = join(this.dir,val.name)
const dir = join(this.dir, val.name)
const apps = await fs.readdir(dir, { withFileTypes: true })
@ -132,7 +132,7 @@ class PluginsLoader {
* @param file
* @param packageErr
*/
async importPlugin(file, packageErr?:any) {
async importPlugin(file, packageErr?: any) {
try {
let app = await import(`file://${file.path}`)
if (app.apps) app = { ...app.apps }
@ -337,7 +337,7 @@ class PluginsLoader {
return v.event == newEvent.join(".")
}
/**
*
* @param e
@ -510,7 +510,7 @@ class PluginsLoader {
* @param data.recallMsg 0-1200
* @param data.at at用户
*/
e.reply = async (msg:any = '', quote = false, data:any = {}) => {
e.reply = async (msg: any = '', quote = false, data: any = {}) => {
if (!msg) return false
/** 禁言中 */
@ -567,7 +567,7 @@ class PluginsLoader {
return msgRes
}
} else {
e.reply = async (msg = '', quote = false, data = {}) => {
e.reply = async (msg = '', _ = false, __ = {}) => {
if (!msg) return false
this.count(e, msg)
if (e.group_id) {
@ -643,7 +643,7 @@ class PluginsLoader {
*/
collectTask(task) {
for (const i of Array.isArray(task) ? task : [task])
if (i?.cron && i?.name){
if (i?.cron && i?.name) {
this.task.push(i)
}
}
@ -842,13 +842,13 @@ class PluginsLoader {
const key = `${dirName}/${appName}`
/** 监听修改 */
watcher.on('change', path => {
watcher.on('change', () => {
logger.mark(`[修改插件][${dirName}][${appName}]`)
this.changePlugin(key)
})
/** 监听删除 */
watcher.on('unlink', async path => {
watcher.on('unlink', () => {
logger.mark(`[卸载插件][${dirName}][${appName}]`)
/** 停止更新监听 */
this.watcher[`${dirName}.${appName}`].removeAllListeners('change')

View File

@ -128,7 +128,7 @@ export default class Runtime {
if (user) {
// 对象代理
e.user = new Proxy(user, {
get(self, key, receiver) {
get(self, key) {
let game = e.game
let fnMap = {
uid: 'getUid',
@ -232,7 +232,7 @@ export default class Runtime {
/**
* @deprecated
*/
async render(plugin, path, data = {}, cfg = {}) {
async render(_, __, ___ = {}, ____ = {}) {
return false
}
}

View File

@ -108,7 +108,7 @@ class GsCfg {
if (this.watcher[type][key]) return
const watcher = chokidar.watch(file)
watcher.on('change', path => {
watcher.on('change', () => {
delete this[type][key]
logger.mark(`[修改配置文件][${type}][${app}][${name}]`)
if (this[`change_${app}${name}`]) {
@ -323,7 +323,7 @@ class GsCfg {
* @param isSr
* @returns
*/
_getRole(msg, filterMsg = '', isSr = false) {
_getRole(msg, filterMsg = '', _ = false) {
let alias = msg.replace(/#|老婆|老公|([1-9]|18)[0-9]{8}/g, '').trim()
if (filterMsg) {
alias = alias.replace(new RegExp(filterMsg, 'g'), '').trim()
@ -349,7 +349,7 @@ class GsCfg {
* @deprecated
* @returns
*/
getWeaponDataByWeaponHash(hash) {
getWeaponDataByWeaponHash(_) {
console.log('gsCfg.getWeaponDataByWeaponHash() 已废弃')
return {}
}
@ -370,7 +370,7 @@ class GsCfg {
* @param userId
* @returns
*/
getBingCkSingle(userId) {
getBingCkSingle(_) {
console.log('gsCfg.getBingCkSingle() 已废弃')
return {}
}
@ -381,7 +381,7 @@ class GsCfg {
* @param userId
* @param data
*/
saveBingCk(userId, data) {
saveBingCk(_, __) {
console.log('gsCfg.saveBingCk() 已废弃')
}
@ -391,7 +391,7 @@ class GsCfg {
* @param roleName
* @returns
*/
getElementByRoleName(roleName) {
getElementByRoleName(_) {
console.log('gsCfg.getElementByRoleName() 已废弃')
return ''
}
@ -403,7 +403,7 @@ class GsCfg {
* @param roleName
* @returns
*/
getSkillDataByskillId(skillId, roleName) {
getSkillDataByskillId(_, __) {
console.log('gsCfg.getSkillDataByskillId() 已废弃')
return {}
}
@ -414,7 +414,7 @@ class GsCfg {
* @param propId
* @returns
*/
fightPropIdToName(propId) {
fightPropIdToName(_) {
console.log('gsCfg.fightPropIdToName() 已废弃')
return ''
}
@ -425,7 +425,7 @@ class GsCfg {
* @param talentId
* @returns
*/
getRoleTalentByTalentId(talentId) {
getRoleTalentByTalentId(_) {
console.log('gsCfg.getRoleTalentByTalentId 已废弃')
return {}
}