hubot 11.2.3 → 11.3.1

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 CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Hubot
8
8
 
9
- **Note: v10.0.4 accidentaly contains the removal of CoffeeScript; v10.0.5 puts it back in**
9
+ **Note: v10.0.4 accidentally contains the removal of CoffeeScript; v10.0.5 puts it back in**
10
10
  **Note: v11 removes CoffeeScript and converts this codebase to ESM**
11
11
 
12
12
  Hubot is a framework to build chat bots, modeled after GitHub's Campfire bot of the same name, hubot.
package/bin/Hubot.mjs CHANGED
@@ -16,7 +16,8 @@ const switches = [
16
16
  ['-n', '--name HUBOT_NAME', 'The name of the robot in chat'],
17
17
  ['-r', '--require PATH', 'Alternative scripts path'],
18
18
  ['-t', '--config-check', "Test hubot's config to make sure it won't fail at startup"],
19
- ['-v', '--version', 'Displays the version of hubot installed']
19
+ ['-v', '--version', 'Displays the version of hubot installed'],
20
+ ['-e', '--execute', 'Runs the command as if it were a hubot command']
20
21
  ]
21
22
 
22
23
  const options = {
@@ -66,6 +67,10 @@ Parser.on('name', (opt, value) => {
66
67
  options.name = value
67
68
  })
68
69
 
70
+ Parser.on('execute', (opt, value) => {
71
+ options.execute = value
72
+ })
73
+
69
74
  Parser.on('require', (opt, value) => {
70
75
  options.scripts.push(value)
71
76
  })
@@ -141,7 +146,12 @@ async function loadExternalScripts () {
141
146
  process.exit(0)
142
147
  }
143
148
 
144
- robot.adapter.once('connected', loadScripts)
145
-
149
+ robot.adapter.once('connected', async () => {
150
+ await loadScripts()
151
+ if (options.execute) {
152
+ await robot.receive(new Hubot.TextMessage(new Hubot.User('shell', { room: '#shell' }), `@${robot.name} ${options.execute.trim()}`))
153
+ robot.shutdown()
154
+ }
155
+ })
146
156
  await robot.run()
147
157
  })()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hubot",
3
- "version": "11.2.3",
3
+ "version": "11.3.1",
4
4
  "author": "hubot",
5
5
  "keywords": [
6
6
  "github",