diff --git a/example/ding-dong-bot.ts b/example/ding-dong-bot.ts index bb9767f15c9553d46f58e44471b44eebe7e7fd16..456febd42ec0537d0ea3c010c3499ca4a476a514 100644 --- a/example/ding-dong-bot.ts +++ b/example/ding-dong-bot.ts @@ -106,7 +106,7 @@ bot bot.start() .catch(e => { - log.error('Bot', 'init() fail: %s', e) + log.error('Bot', 'start() fail: %s', e) bot.stop() process.exit(-1) }) @@ -119,10 +119,11 @@ bot.on('error', async e => { await bot.stop() }) -finis((code, signal) => { +finis(async (code, signal) => { const exitMsg = `Wechaty exit ${code} because of ${signal} ` console.log(exitMsg) if (bot.logonoff()) { - bot.say(exitMsg).catch(console.error) + await bot.say(exitMsg).catch(console.error) } + process.exit(code) })