fix: login
This commit is contained in:
parent
08c4ce093c
commit
8fc6650510
|
@ -17,6 +17,13 @@ import ListenerLoader from './core/loader.js'
|
|||
*/
|
||||
import { Client } from 'icqq'
|
||||
|
||||
import { plugin } from './core/plugin.js'
|
||||
|
||||
/**
|
||||
* global
|
||||
*/
|
||||
global.plugin = plugin
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -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'
|
||||
})
|
||||
|
|
|
@ -16,7 +16,7 @@ class ListenerLoader {
|
|||
|
||||
const files = fs
|
||||
.readdirSync('./src/core/events')
|
||||
.filter(file => file.endsWith('.js'))
|
||||
.filter(file => /(.ts|.js)$/.test(file))
|
||||
|
||||
for (let File of files) {
|
||||
try {
|
||||
|
|
|
@ -5,7 +5,7 @@ import schedule from 'node-schedule'
|
|||
import { segment } from 'icqq'
|
||||
import chokidar from 'chokidar'
|
||||
import moment from 'moment'
|
||||
import path from 'node:path'
|
||||
import path, { join } from 'node:path'
|
||||
import Runtime from './runtime.js'
|
||||
import Handler from './handler.js'
|
||||
|
||||
|
@ -17,12 +17,16 @@ class PluginsLoader {
|
|||
priority = []
|
||||
handler = {}
|
||||
task = []
|
||||
dir = 'plugins'
|
||||
|
||||
//
|
||||
dir = join(process.cwd(),'plugins')
|
||||
|
||||
/**
|
||||
* 命令冷却cd
|
||||
*/
|
||||
groupGlobalCD = {}
|
||||
|
||||
//
|
||||
singleCD = {}
|
||||
|
||||
/**
|
||||
|
@ -43,7 +47,6 @@ class PluginsLoader {
|
|||
*/
|
||||
srReg = /^#?(\*|星铁|星轨|穹轨|星穹|崩铁|星穹铁道|崩坏星穹铁道|铁道)+/
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns
|
||||
|
@ -55,21 +58,31 @@ class PluginsLoader {
|
|||
if (val.isFile()) continue
|
||||
const tmp = {
|
||||
name: val.name,
|
||||
path: `../../${this.dir}/${val.name}`,
|
||||
path: join(this.dir,val.name),
|
||||
}
|
||||
|
||||
try {
|
||||
if (await fs.stat(`${this.dir}/${val.name}/index.js`)) {
|
||||
tmp.path = `${tmp.path}/index.js`
|
||||
const dir = join(tmp.path,'index.js')
|
||||
if (await fs.stat(dir)) {
|
||||
tmp.path = dir
|
||||
ret.push(tmp)
|
||||
continue
|
||||
}
|
||||
} catch (err) { }
|
||||
} catch (err) {
|
||||
//
|
||||
}
|
||||
|
||||
const apps = await fs.readdir(`${this.dir}/${val.name}`, { withFileTypes: true })
|
||||
//
|
||||
|
||||
const dir = join(this.dir,val.name)
|
||||
|
||||
const apps = await fs.readdir(dir, { withFileTypes: true })
|
||||
|
||||
//
|
||||
for (const app of apps) {
|
||||
if (!app.isFile()) continue
|
||||
if (!app.name.endsWith('.js')) continue
|
||||
// .js .ts
|
||||
if (!/^(.js|.ts)$/.test(app.name)) continue
|
||||
ret.push({
|
||||
name: `${tmp.name}/${app.name}`,
|
||||
path: `${tmp.path}/${app.name}`,
|
||||
|
@ -121,7 +134,7 @@ class PluginsLoader {
|
|||
*/
|
||||
async importPlugin(file, packageErr?:any) {
|
||||
try {
|
||||
let app = await import(file.path)
|
||||
let app = await import(`file://${file.path}`)
|
||||
if (app.apps) app = { ...app.apps }
|
||||
const pluginArray = []
|
||||
lodash.forEach(app, p =>
|
||||
|
|
|
@ -9,6 +9,6 @@ declare global {
|
|||
var redis: RedisClientType
|
||||
var Bot: typeof Yunzai.prototype
|
||||
var segment: typeof se
|
||||
var plugin: typeof p.prototype
|
||||
var plugin: typeof p
|
||||
var logger: any
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
export { Common, Date } from '#miao'
|
||||
export { Common, Data } from '#miao'
|
||||
export { Character, Weapon } from '#miao.models'
|
||||
|
|
Loading…
Reference in New Issue