Skip to content

Commit

Permalink
fix(shell): Fix tests and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
timkinnane committed Aug 12, 2018
1 parent 80a91b0 commit c67aa2c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/adapters/shell.ts
Expand Up @@ -14,7 +14,7 @@ export class Shell extends bBot.MessageAdapter {
}

/** Update chat window and return to input prompt */
render () {
async render () {
let _ = '\n'
let n = ' '
_ += chalk.cyan('╔═════════════════════════════════════════════════════════▶') + '\n'
Expand All @@ -23,11 +23,11 @@ export class Shell extends bBot.MessageAdapter {
}
_ += chalk.cyan('╚═════════════════════════════════════════════════════════▶') + '\n\n'
this.ui.updateBottomBar(_)
this.prompt()
await this.prompt()
}

/** Route log events to the inquirer UI */
log (transport: string, level: string, msg: string, meta: string) {
log (_transport: string, level: string, msg: string) {
let item = `[${level}]${msg}`
switch (level) {
case 'debug': item = chalk.gray(item)
Expand Down Expand Up @@ -72,7 +72,9 @@ export class Shell extends bBot.MessageAdapter {
name: 'message',
message: chalk.magenta(`[${this.room.name}]`) + chalk.cyan(' ➤')
})
if ((input.message as string).toLowerCase() === 'exit') this.bot.shutdown()
if ((input.message as string).toLowerCase() === 'exit') {
return this.bot.shutdown()
}
this.messages.push([this.user.name, input.message])
await this.bot.receive(new this.bot.TextMessage(this.user, input.message))
return this.render()
Expand All @@ -83,7 +85,7 @@ export class Shell extends bBot.MessageAdapter {
for (let text of (envelope.strings || [])) {
this.messages.push([this.bot.name, text])
}
this.render()
await this.render()
}

/** Close inquirer UI and exit process when shutdown complete */
Expand Down

0 comments on commit c67aa2c

Please sign in to comment.