fix: 事件监听失效
This commit is contained in:
parent
52d8992562
commit
aec1927b99
|
@ -27,17 +27,13 @@ export async function checkRun() {
|
|||
*
|
||||
*/
|
||||
if (status.stdout.includes('online')) {
|
||||
//
|
||||
logger.mark('检测到后台正在运行')
|
||||
logger.mark('已停止后台进程,防止重复运行')
|
||||
|
||||
execAsync(`pm2 stop ${cfg.apps[0].name}`).catch(logger.error)
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
}).catch(logger.error)
|
||||
}).catch(()=>{})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import fs, { promises } from "node:fs"
|
||||
import yaml from "yaml"
|
||||
import { BOT_NAME } from "./system.js"
|
||||
import { BOT_NAME, CONFIG_INIT_PATH } from "./system.js"
|
||||
import createQQ from "./qq.js"
|
||||
import setLog from "./log.js"
|
||||
import redisInit from "./redis.js"
|
||||
|
@ -17,7 +17,7 @@ export async function UpdateTitle() {
|
|||
let title = BOT_NAME
|
||||
|
||||
//
|
||||
const qq = await promises.readFile("./config/config/qq.yaml", 'utf-8').then(yaml.parse).catch(() => null)
|
||||
const qq = await promises.readFile(`./${CONFIG_INIT_PATH}qq.yaml`, 'utf-8').then(yaml.parse).catch(() => null)
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import EventListener from './listener.js'
|
||||
import { sleep } from '../utils/common.js'
|
||||
import EventListener from '../listener.js'
|
||||
import { sleep } from '../../utils/common.js'
|
||||
import inquirer from 'inquirer'
|
||||
import lodash from 'lodash'
|
||||
import fetch from 'node-fetch'
|
||||
|
@ -71,7 +71,7 @@ export default class loginEvent extends EventListener {
|
|||
*/
|
||||
inquirer
|
||||
.prompt({
|
||||
type: 'input',
|
||||
// type: 'input',
|
||||
message: '回车刷新二维码,等待扫码中...\n',
|
||||
name: 'enter'
|
||||
})
|
||||
|
@ -134,7 +134,7 @@ export default class loginEvent extends EventListener {
|
|||
|
||||
if (!ticket) {
|
||||
let res = await inquirer.prompt({
|
||||
type: 'input',
|
||||
// type: 'input',
|
||||
message: '请输入ticket:',
|
||||
name: 'ticket',
|
||||
validate(value) {
|
||||
|
@ -211,7 +211,7 @@ export default class loginEvent extends EventListener {
|
|||
|
||||
//
|
||||
await inquirer.prompt({
|
||||
type: 'input',
|
||||
// type: 'input',
|
||||
message: '验证完成后按回车确认,等待在操作中...',
|
||||
name: 'enter'
|
||||
})
|
||||
|
@ -261,7 +261,7 @@ export default class loginEvent extends EventListener {
|
|||
console.log('\n' + logger.green(event.url) + '\n')
|
||||
console.log('请打开上面链接,完成验证后按回车')
|
||||
await inquirer.prompt({
|
||||
type: 'input',
|
||||
// type: 'input',
|
||||
message: '等待操作中...',
|
||||
name: 'enter'
|
||||
})
|
||||
|
@ -272,7 +272,7 @@ export default class loginEvent extends EventListener {
|
|||
await sleep(200)
|
||||
logger.info(`验证码已发送:${event.phone}\n`)
|
||||
let res = await inquirer.prompt({
|
||||
type: 'input',
|
||||
// type: 'input',
|
||||
message: '请输入短信验证码:',
|
||||
name: 'sms'
|
||||
})
|
|
@ -1,4 +1,4 @@
|
|||
import EventListener from './listener.js'
|
||||
import EventListener from '../listener.js'
|
||||
|
||||
/**
|
||||
* 监听群聊消息
|
|
@ -1,4 +1,4 @@
|
|||
import EventListener from './listener.js'
|
||||
import EventListener from '../listener.js'
|
||||
|
||||
/**
|
||||
* 监听群聊消息
|
|
@ -1,7 +1,7 @@
|
|||
import EventListener from './listener.js'
|
||||
import EventListener from '../listener.js'
|
||||
import fetch from 'node-fetch'
|
||||
import cfg from '../config/config.js'
|
||||
import { BOT_NAME } from '../config/system.js'
|
||||
import cfg from '../../config/config.js'
|
||||
import { BOT_NAME } from '../../config/system.js'
|
||||
|
||||
/**
|
||||
* 监听下线事件
|
|
@ -1,7 +1,7 @@
|
|||
import EventListener from './listener.js'
|
||||
import cfg from '../config/config.js'
|
||||
import { relpyPrivate } from '../core/common.js'
|
||||
import { BOT_NAME } from '../config/system.js'
|
||||
import EventListener from '../listener.js'
|
||||
import cfg from '../../config/config.js'
|
||||
import { relpyPrivate } from '../common.js'
|
||||
import { BOT_NAME } from '../../config/system.js'
|
||||
|
||||
/**
|
||||
* 监听上线事件
|
|
@ -1,4 +1,4 @@
|
|||
import EventListener from './listener.js'
|
||||
import EventListener from '../listener.js'
|
||||
|
||||
/**
|
||||
* 监听群聊消息
|
|
@ -15,12 +15,12 @@ class ListenerLoader {
|
|||
this.client = client
|
||||
|
||||
const files = fs
|
||||
.readdirSync('./lib/events')
|
||||
.readdirSync('./src/core/events')
|
||||
.filter(file => file.endsWith('.js'))
|
||||
|
||||
for (let File of files) {
|
||||
try {
|
||||
let listener = await import(`../events/${File}`)
|
||||
let listener = await import(`./events/${File}`)
|
||||
|
||||
/* eslint-disable new-cap */
|
||||
if (!listener.default) continue
|
||||
|
|
Loading…
Reference in New Issue