feat: 统一管理导出路径
This commit is contained in:
parent
c016648ad7
commit
e1f53b1cc6
14
src/bot.ts
14
src/bot.ts
|
@ -4,12 +4,6 @@
|
||||||
* **********
|
* **********
|
||||||
*/
|
*/
|
||||||
import './config/init.js'
|
import './config/init.js'
|
||||||
/**
|
|
||||||
* **********
|
|
||||||
* 全局变量配置
|
|
||||||
* *********
|
|
||||||
*/
|
|
||||||
import './global.js'
|
|
||||||
/**
|
/**
|
||||||
* **********
|
* **********
|
||||||
* 配置读取工具
|
* 配置读取工具
|
||||||
|
@ -25,7 +19,13 @@ import ListenerLoader from './core/events.loader.js'
|
||||||
/**
|
/**
|
||||||
* 扩展
|
* 扩展
|
||||||
*/
|
*/
|
||||||
import { Client } from 'icqq'
|
import { Client, segment } from 'icqq'
|
||||||
|
import { plugin } from './core/plugins/index.js'
|
||||||
|
/**
|
||||||
|
* global
|
||||||
|
*/
|
||||||
|
global.plugin = plugin
|
||||||
|
global.segment = segment
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1 +1,9 @@
|
||||||
export {}
|
export { checkRun } from './check.js'
|
||||||
|
import config from './config.js'
|
||||||
|
export { checkInit, UpdateTitle as checkUpdateTitle } from './init.js'
|
||||||
|
export const ConfigController = config
|
||||||
|
import QQ from './qq.js'
|
||||||
|
export const createQQ = QQ
|
||||||
|
import RedisInit from './redis.js'
|
||||||
|
export const redisInit = RedisInit
|
||||||
|
export * from './system.js'
|
|
@ -101,7 +101,7 @@ export default function setLog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 全局变量 logger */
|
/** 全局变量 logger */
|
||||||
global.logger = createLog()
|
global.logger = createLog() as any
|
||||||
|
|
||||||
logger.chalk = chalk
|
logger.chalk = chalk
|
||||||
logger.red = chalk.red
|
logger.red = chalk.red
|
||||||
|
|
|
@ -56,7 +56,7 @@ export default async function redisInit() {
|
||||||
*
|
*
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export async function aarch64() {
|
async function aarch64() {
|
||||||
if (process.platform == "win32") {
|
if (process.platform == "win32") {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
export { Client, segment } from 'icqq'
|
|
@ -1,3 +1,4 @@
|
||||||
export * from './plugins/index.js'
|
export * from './plugins/index.js'
|
||||||
export * from './plugins/functional.js'
|
export * from './plugins/functional.js'
|
||||||
export * from './plugins/types.js'
|
export * from './plugins/types.js'
|
||||||
|
export * from './icqq.js'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Common } from '../../local.js'
|
import { Common } from '../../miao.js'
|
||||||
import { EventType } from './types.js'
|
import { EventType } from './types.js'
|
||||||
|
|
||||||
const stateArr = {}
|
const stateArr = {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Sequelize, DataTypes, Model } from 'sequelize'
|
import { Sequelize, DataTypes, Model } from 'sequelize'
|
||||||
import { Data } from '../local.js'
|
import { Data } from '../miao.js'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,13 +2,75 @@ import { segment as se } from 'icqq'
|
||||||
import { RedisClientType } from 'redis'
|
import { RedisClientType } from 'redis'
|
||||||
import { Yunzai } from './bot.js'
|
import { Yunzai } from './bot.js'
|
||||||
import { plugin as p } from './core/index.js'
|
import { plugin as p } from './core/index.js'
|
||||||
|
import chalk, { type ChalkInstance } from 'chalk'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全局变量声明
|
*
|
||||||
*/
|
*/
|
||||||
declare global {
|
type LogType = string | Error | unknown
|
||||||
var redis: RedisClientType
|
|
||||||
var Bot: typeof Yunzai.prototype
|
/**
|
||||||
var segment: typeof se
|
*
|
||||||
var plugin: typeof p
|
*/
|
||||||
var logger: any
|
type LoggerType = {
|
||||||
|
trace(...arg: LogType[]): any
|
||||||
|
debug(...arg: LogType[]): any
|
||||||
|
info(...arg: LogType[]): any
|
||||||
|
warn(...arg: LogType[]): any
|
||||||
|
error(...arg: LogType[]): any
|
||||||
|
fatal(...arg: LogType[]): any
|
||||||
|
mark(...arg: LogType[]): any
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated 不推荐使用
|
||||||
|
*/
|
||||||
|
type ChalkInstanceType = {
|
||||||
|
/**
|
||||||
|
* @deprecated 不推荐使用
|
||||||
|
*/
|
||||||
|
red: ChalkInstance.red
|
||||||
|
/**
|
||||||
|
* @deprecated 不推荐使用
|
||||||
|
*/
|
||||||
|
green: ChalkInstance.green
|
||||||
|
/**
|
||||||
|
* @deprecated 不推荐使用
|
||||||
|
*/
|
||||||
|
blue: ChalkInstance.blue
|
||||||
|
/**
|
||||||
|
* @deprecated 不推荐使用
|
||||||
|
*/
|
||||||
|
yellow: ChalkInstance.yellow
|
||||||
|
/**
|
||||||
|
* @deprecated 不推荐使用
|
||||||
|
*/
|
||||||
|
magenta: ChalkInstance.magenta
|
||||||
|
/**
|
||||||
|
* @deprecated 不推荐使用
|
||||||
|
*/
|
||||||
|
cyan: ChalkInstance.cyan
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
/**
|
||||||
|
* @deprecated 不推荐使用
|
||||||
|
*/
|
||||||
|
var redis: RedisClientType
|
||||||
|
/**
|
||||||
|
* @deprecated 不推荐使用
|
||||||
|
*/
|
||||||
|
var Bot: typeof Yunzai.prototype
|
||||||
|
/**
|
||||||
|
* @deprecated 不推荐使用
|
||||||
|
*/
|
||||||
|
var segment: typeof se
|
||||||
|
/**
|
||||||
|
* @deprecated 不推荐使用
|
||||||
|
*/
|
||||||
|
var plugin: typeof p
|
||||||
|
var logger: LoggerType &
|
||||||
|
ChalkInstanceType & {
|
||||||
|
chalk: ChalkInstance
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
import { segment } from 'icqq'
|
|
||||||
import { plugin } from './core/plugins/index.js'
|
|
||||||
/**
|
|
||||||
* global
|
|
||||||
*/
|
|
||||||
global.plugin = plugin
|
|
||||||
global.segment = segment
|
|
|
@ -1,5 +0,0 @@
|
||||||
export * from './config/index.js'
|
|
||||||
export * from './core/index.js'
|
|
||||||
export * from './db/index.js'
|
|
||||||
export * from './mys/index.js'
|
|
||||||
export * from './utils/index.js'
|
|
|
@ -15,7 +15,7 @@ import fetch from 'node-fetch'
|
||||||
|
|
||||||
import { MysUserDB } from '../db/index.js'
|
import { MysUserDB } from '../db/index.js'
|
||||||
|
|
||||||
import { Data } from '../local.js'
|
import { Data } from '../miao.js'
|
||||||
|
|
||||||
const tables = {
|
const tables = {
|
||||||
// ltuid-uid 查询表
|
// ltuid-uid 查询表
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Data } from '../local.js'
|
import { Data } from '../miao.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@ import lodash from 'lodash'
|
||||||
import MysUser from './MysUser.js'
|
import MysUser from './MysUser.js'
|
||||||
import MysUtil from './MysUtil.js'
|
import MysUtil from './MysUtil.js'
|
||||||
import { UserDB } from '../db/index.js'
|
import { UserDB } from '../db/index.js'
|
||||||
import { Data } from '../local.js'
|
import { Data } from '../miao.js'
|
||||||
/**
|
/**
|
||||||
* *******************
|
* *******************
|
||||||
* Bot实际User用户类
|
* Bot实际User用户类
|
||||||
|
|
|
@ -4,7 +4,7 @@ import fs from 'node:fs'
|
||||||
import lodash from 'lodash'
|
import lodash from 'lodash'
|
||||||
import MysInfo from './mysInfo.js'
|
import MysInfo from './mysInfo.js'
|
||||||
import NoteUser from './NoteUser.js'
|
import NoteUser from './NoteUser.js'
|
||||||
import { Character, Weapon } from '../local.js'
|
import { Character, Weapon } from '../miao.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ***********
|
* ***********
|
||||||
|
|
Loading…
Reference in New Issue