hubot 11.1.6 → 11.1.8
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/Adapter.mjs +6 -6
- package/src/Robot.mjs +4 -4
- 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/Adapter.mjs
CHANGED
|
@@ -79,7 +79,7 @@ class Adapter extends EventEmitter {
|
|
|
79
79
|
// Returns an Array of User objects.
|
|
80
80
|
// @deprecated Use @robot.brain
|
|
81
81
|
users () {
|
|
82
|
-
this.robot.logger.
|
|
82
|
+
this.robot.logger.warn('@users() is going to be deprecated in 11.0.0 use @robot.brain.users()')
|
|
83
83
|
return this.robot.brain.users()
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -88,7 +88,7 @@ class Adapter extends EventEmitter {
|
|
|
88
88
|
// Returns a User instance of the specified user.
|
|
89
89
|
// @deprecated Use @robot.brain
|
|
90
90
|
userForId (id, options) {
|
|
91
|
-
this.robot.logger.
|
|
91
|
+
this.robot.logger.warn('@userForId() is going to be deprecated in 11.0.0 use @robot.brain.userForId()')
|
|
92
92
|
return this.robot.brain.userForId(id, options)
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -97,7 +97,7 @@ class Adapter extends EventEmitter {
|
|
|
97
97
|
// Returns a User instance for the user with the specified name.
|
|
98
98
|
// @deprecated Use @robot.brain
|
|
99
99
|
userForName (name) {
|
|
100
|
-
this.robot.logger.
|
|
100
|
+
this.robot.logger.warn('@userForName() is going to be deprecated in 11.0.0 use @robot.brain.userForName()')
|
|
101
101
|
return this.robot.brain.userForName(name)
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -108,7 +108,7 @@ class Adapter extends EventEmitter {
|
|
|
108
108
|
// Returns an Array of User instances matching the fuzzy name.
|
|
109
109
|
// @deprecated Use @robot.brain
|
|
110
110
|
usersForRawFuzzyName (fuzzyName) {
|
|
111
|
-
this.robot.logger.
|
|
111
|
+
this.robot.logger.warn('@userForRawFuzzyName() is going to be deprecated in 11.0.0 use @robot.brain.userForRawFuzzyName()')
|
|
112
112
|
return this.robot.brain.usersForRawFuzzyName(fuzzyName)
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -119,7 +119,7 @@ class Adapter extends EventEmitter {
|
|
|
119
119
|
// Returns an Array of User instances matching the fuzzy name.
|
|
120
120
|
// @deprecated Use @robot.brain
|
|
121
121
|
usersForFuzzyName (fuzzyName) {
|
|
122
|
-
this.robot.logger.
|
|
122
|
+
this.robot.logger.warn('@userForFuzzyName() is going to be deprecated in 11.0.0 use @robot.brain.userForFuzzyName()')
|
|
123
123
|
return this.robot.brain.usersForFuzzyName(fuzzyName)
|
|
124
124
|
}
|
|
125
125
|
|
|
@@ -131,7 +131,7 @@ class Adapter extends EventEmitter {
|
|
|
131
131
|
// Returns a ScopedClient instance.
|
|
132
132
|
// @deprecated Use node.js fetch.
|
|
133
133
|
http (url) {
|
|
134
|
-
this.robot.logger.
|
|
134
|
+
this.robot.logger.warn('@http() is going to be deprecated in 11.0.0 use @robot.http()')
|
|
135
135
|
return this.robot.http(url)
|
|
136
136
|
}
|
|
137
137
|
}
|
package/src/Robot.mjs
CHANGED
|
@@ -133,8 +133,8 @@ class Robot {
|
|
|
133
133
|
const name = this.name.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
|
|
134
134
|
|
|
135
135
|
if (regexStartsWithAnchor) {
|
|
136
|
-
this.logger.
|
|
137
|
-
this.logger.
|
|
136
|
+
this.logger.warn('Anchors don’t work well with respond, perhaps you want to use \'hear\'')
|
|
137
|
+
this.logger.warn(`The regex in question was ${regex.toString()}`)
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
if (!this.alias) {
|
|
@@ -336,7 +336,7 @@ class Robot {
|
|
|
336
336
|
if (typeof script?.default === 'function') {
|
|
337
337
|
result = await script.default(this)
|
|
338
338
|
} else {
|
|
339
|
-
this.logger.
|
|
339
|
+
this.logger.warn(`Expected ${filePath} (after preparing for import ${forImport}) to assign a function to export default, got ${typeof script}`)
|
|
340
340
|
}
|
|
341
341
|
return result
|
|
342
342
|
}
|
|
@@ -348,7 +348,7 @@ class Robot {
|
|
|
348
348
|
if (typeof script === 'function') {
|
|
349
349
|
result = await script(this)
|
|
350
350
|
} else {
|
|
351
|
-
this.logger.
|
|
351
|
+
this.logger.warn(`Expected ${filePath} (after preparing for import ${forImport}) to assign a function to module.exports, got ${typeof script}`)
|
|
352
352
|
}
|
|
353
353
|
return result
|
|
354
354
|
}
|
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'))
|