hubot 11.1.6 → 11.1.7
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/README.md +3 -1
- package/package.json +1 -1
- package/src/adapters/Shell.mjs +3 -8
package/README.md
CHANGED
|
@@ -47,4 +47,6 @@ See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).
|
|
|
47
47
|
|
|
48
48
|
[Hubot by Hubotics](https://www.theoldrobots.com/hubot.html)
|
|
49
49
|
|
|
50
|
-
[Automating Inefficiencies](https://zachholman.com/2011/01/automating-inefficiencies/)
|
|
50
|
+
[Automating Inefficiencies](https://zachholman.com/2011/01/automating-inefficiencies/)
|
|
51
|
+
|
|
52
|
+
[Getting Started with Hubot](https://www.youtube.com/watch?v=A7fh6RIzGrw)
|
package/package.json
CHANGED
package/src/adapters/Shell.mjs
CHANGED
|
@@ -75,20 +75,15 @@ class Shell extends Adapter {
|
|
|
75
75
|
this.#rl.prompt()
|
|
76
76
|
break
|
|
77
77
|
}
|
|
78
|
+
if (input.length > 0) {
|
|
79
|
+
fs.appendFileSync(historyPath, `${input}\n`)
|
|
80
|
+
}
|
|
78
81
|
const history = fs.readFileSync(historyPath, 'utf-8').split('\n').reverse()
|
|
79
82
|
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
|
-
})
|
|
87
83
|
let userId = process.env.HUBOT_SHELL_USER_ID || '1'
|
|
88
84
|
if (userId.match(/A\d+z/)) {
|
|
89
85
|
userId = parseInt(userId)
|
|
90
86
|
}
|
|
91
|
-
|
|
92
87
|
const userName = process.env.HUBOT_SHELL_USER_NAME || 'Shell'
|
|
93
88
|
const user = this.robot.brain.userForId(userId, { name: userName, room: 'Shell' })
|
|
94
89
|
await this.receive(new TextMessage(user, input, 'messageId'))
|