File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,20 +75,15 @@ class Shell extends Adapter {
7575 this . #rl. prompt ( )
7676 break
7777 }
78+ if ( input . length > 0 ) {
79+ fs . appendFileSync ( historyPath , `${ input } \n` )
80+ }
7881 const history = fs . readFileSync ( historyPath , 'utf-8' ) . split ( '\n' ) . reverse ( )
7982 this . #rl. history = history
80- this . #rl. on ( 'line' , line => {
81- const input = line . trim ( )
82- if ( input . length === 0 ) return
83- fs . appendFile ( historyPath , `${ input } \n` , err => {
84- if ( err ) console . error ( err )
85- } )
86- } )
8783 let userId = process . env . HUBOT_SHELL_USER_ID || '1'
8884 if ( userId . match ( / A \d + z / ) ) {
8985 userId = parseInt ( userId )
9086 }
91-
9287 const userName = process . env . HUBOT_SHELL_USER_NAME || 'Shell'
9388 const user = this . robot . brain . userForId ( userId , { name : userName , room : 'Shell' } )
9489 await this . receive ( new TextMessage ( user , input , 'messageId' ) )
You can’t perform that action at this time.
0 commit comments