Skip to content

Commit

Permalink
0.14.5
Browse files Browse the repository at this point in the history
  • Loading branch information
atorber committed Nov 29, 2023
1 parent f01525c commit c44f0a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "WechatGPT",
"version": "0.14.4",
"version": "0.14.5",
"description": "wechat & chatgpt",
"type": "module",
"engines": {
Expand Down
10 changes: 6 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import bodyParser from 'koa-bodyparser'
import { AppRoutes } from './routes.js'
import cors from '@koa/cors'
import websockify from 'koa-websocket'
import { PerformanceObserver } from 'perf_hooks'

const config = getConfig()
const whiteList = config.whiteList
Expand Down Expand Up @@ -546,18 +547,19 @@ bot.on('friendship', async friendship => {
// .then(() => log.info('StarterBot', 'Starter Bot Started.'))
// .catch(e => log.error('StarterBot', e))

function startBot (bot:Wechaty) {
function startBot () {
log.info('开始启动...')
bot.start()
.then(() => log.info('StarterBot', 'Starter Bot Started.'))
.catch(e => {
log.error('StarterBot', e)
log.error('StarterBot 失败...', e)
// 等待一段时间后重启
setTimeout(startBot(bot), 5000) // 5秒后重启
setTimeout(startBot, 5000) // 5秒后重启
})
}

// 启动 bot
startBot(bot)
startBot()

const app = new Koa()
const router = new Router()
Expand Down

0 comments on commit c44f0a9

Please sign in to comment.