Skip to content

Commit

Permalink
0.14.7
Browse files Browse the repository at this point in the history
  • Loading branch information
atorber committed Dec 7, 2023
1 parent 3516977 commit c8194cc
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 19 deletions.
137 changes: 125 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.6",
"version": "0.14.7",
"description": "wechat & chatgpt",
"type": "module",
"engines": {
Expand Down
30 changes: 24 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,13 +549,31 @@ bot.on('friendship', async friendship => {

function startBot () {
log.info('开始启动...')
bot.start()
.then(() => log.info('StarterBot', 'Starter Bot Started.'))
.catch(e => {
log.error('StarterBot 失败...', e)
// 等待一段时间后重启
setTimeout(startBot, 5000) // 5秒后重启
try {
bot.stop().then(() => {
bot.start()
.then(() => log.info('StarterBot', 'Starter Bot Started.'))
.catch(e => {
log.error('StarterBot 失败...', e)
// 等待一段时间后重启
setTimeout(startBot, 5000) // 5秒后重启
})
return true
}).catch(e => {
log.error('机器人启动失败...', e)
bot.start()
.then(() => log.info('StarterBot', 'Starter Bot Started.'))
.catch(e => {
log.error('StarterBot 失败...', e)
// 等待一段时间后重启
setTimeout(startBot, 5000) // 5秒后重启
})
})
} catch (e) {
log.error('机器人停止失败...')
// 等待一段时间后重启
setTimeout(startBot, 5000) // 5秒后重启
}
}

// 启动 bot
Expand Down

0 comments on commit c8194cc

Please sign in to comment.