hubot 11.1.8 → 11.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/adapters/Shell.mjs +4 -3
package/package.json
CHANGED
package/src/adapters/Shell.mjs
CHANGED
|
@@ -76,10 +76,8 @@ class Shell extends Adapter {
|
|
|
76
76
|
break
|
|
77
77
|
}
|
|
78
78
|
if (input.length > 0) {
|
|
79
|
-
|
|
79
|
+
this.#rl.history.push(input)
|
|
80
80
|
}
|
|
81
|
-
const history = fs.readFileSync(historyPath, 'utf-8').split('\n').reverse()
|
|
82
|
-
this.#rl.history = history
|
|
83
81
|
let userId = process.env.HUBOT_SHELL_USER_ID || '1'
|
|
84
82
|
if (userId.match(/A\d+z/)) {
|
|
85
83
|
userId = parseInt(userId)
|
|
@@ -89,6 +87,9 @@ class Shell extends Adapter {
|
|
|
89
87
|
await this.receive(new TextMessage(user, input, 'messageId'))
|
|
90
88
|
this.#rl.prompt()
|
|
91
89
|
})
|
|
90
|
+
this.#rl.on('history', async (history) => {
|
|
91
|
+
await fs.promises.writeFile(historyPath, history.reverse().join('\n'))
|
|
92
|
+
})
|
|
92
93
|
try {
|
|
93
94
|
this.#rl.prompt()
|
|
94
95
|
this.emit('connected', this)
|