Skip to content

Commit

Permalink
feat: 增加配置文件是否保存本地选项
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktunes committed Aug 15, 2021
1 parent e024e21 commit 6ad5759
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Bot/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ export class App {
* BOT构造函数
* @param name 插件名
* @param dirname 插件设置保存位置
* @param saveConfig 是否保存插件设置到本地
*/
constructor(name: string = 'Bot', dirname: string = require.main.path) {
const dir = join(dirname, '../config/')
if (dirname) {
constructor(name: string = 'Bot', dirname?: string, saveConfig: boolean = true) {
let dir: string
if (saveConfig) {
if (!dirname) {
dir = join(require.main.path, '../config/')
}
if (!existsSync(dir)) {
mkdirSync(dir)
}
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export * from './Type'
export * from './Tools'

import { App } from './Bot/App'
export { Bot } from './Bot/Bot'
export default App

0 comments on commit 6ad5759

Please sign in to comment.