Skip to content

Commit

Permalink
🔥 fix:删减一些无用的代码
Browse files Browse the repository at this point in the history
  • Loading branch information
sj817 committed Apr 19, 2024
1 parent 01b67cb commit 21e888c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 25 deletions.
4 changes: 3 additions & 1 deletion lib/adapter/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import express from 'express'
import { createServer } from 'http'
import { WebSocketServer } from 'ws'
import { Cfg, logger, Bot } from '#Karin'
import loader from '../../../lib/plugins/loader.js'

const app = express()
export const server = createServer(app)
Expand Down Expand Up @@ -36,6 +37,7 @@ export default async function Server () {
const http_port = Cfg.Config.http_port
server.listen(http_port, () => {
logger.mark(`[服务器][启动成功][HTTP][http://0.0.0.0:${http_port}]`)
Bot.emit('init', '')
/** 加载插件 */
loader.load()
})
}
9 changes: 0 additions & 9 deletions lib/bot/bot.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import '../adapter/kritor/index.js'
import { EventEmitter } from 'events'
import loader from '../plugins/loader.js'
import logger from '../config/log.js'
import message from '../event/message.js'
import notice from '../event/notice.js'
Expand All @@ -14,8 +13,6 @@ class Bot extends EventEmitter {
this.adapter = {}
/** WebSocket适配器 */
this.WebSocket = {}
/** 初始化事件 */
this.on('init', data => this.init())
/** 错误事件 */
this.on('error', data => logger.error(data))
/** 消息事件 */
Expand All @@ -37,12 +34,6 @@ class Bot extends EventEmitter {
logger.mark(`[适配器][WebSocket][注册][${data.url}]`)
})
}

/** 初始化 */
async init () {
/** 加载插件 */
await loader.load()
}
}

export default new Bot()
7 changes: 6 additions & 1 deletion lib/config/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import title from './init.js'
import logger from './log.js'
import redis from './redis.js'
import Bot from '../bot/bot.js'
Expand All @@ -7,6 +6,12 @@ import httpServer from '../adapter/server/server.js'
import OneBot11 from '../adapter/onebot/OneBot11.js'
import puppeteer from '../Renderer/puppeteer.js'

const title = 'Karin'
/** 设置标题 */
process.title = title
/** 设置时区 */
process.env.TZ = 'Asia/Shanghai'

export default class Karin {
static async start () {
logger.mark(`${title} 启动中...`)
Expand Down
14 changes: 0 additions & 14 deletions lib/config/init.js

This file was deleted.

0 comments on commit 21e888c

Please sign in to comment.