You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Finally you will need to add the environment variables to the website to make sure it runs properly. You can either do it through the GUI (under configuration) or you can use the Azure PowerShell command line, as follows (example is showing slack as an adapter and mynewhubot as the website name).
Copy file name to clipboardExpand all lines: docs/scripting.md
+39-35Lines changed: 39 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -839,7 +839,7 @@ Listener middleware inserts logic between the listener matching a message and th
839
839
840
840
## Listener Middleware Examples
841
841
842
-
A fully functioning example can be found in [hubot-rate-limit](https://github.com/michaelansel/hubot-rate-limit/blob/master/src/rate-limit.coffee) (Note, this is a coffee version, non-async/await).
842
+
A fully functioning example can be found in [hubot-rate-limit](https://github.com/michaelansel/hubot-rate-limit/blob/master/src/rate-limit.coffee) (Note: this is a coffee version, non-async/await, and will not work with the latest Hubot since CoffeeScript support was removed in version 11).
843
843
844
844
A simple example of middleware logging command executions:
845
845
@@ -1005,51 +1005,55 @@ You may also want to install:
1005
1005
1006
1006
[Note: This section is still refering to Coffeescript, but we've update Hubot for Javascript. We'll have to replace this when we get a JavaScript example.]
1007
1007
1008
-
Here is a sample script that tests the first couple of commands in the [Hubot sample script](https://github.com/hubotio/generator-hubot/blob/master/generators/app/templates/scripts/example.coffee). This script uses *Mocha*, *chai*, *coffeescript*, and of course *hubot-test-helper*:
1008
+
Here is a sample script that tests the first couple of commands.
1009
1009
1010
-
**test/example-test.coffee**
1010
+
**test/example-test.mjs**
1011
1011
1012
-
```coffeescript
1013
-
Helper =require('hubot-test-helper')
1014
-
chai = require 'chai'
1015
-
1016
-
expect =chai.expect
1017
-
1018
-
helper =newHelper('../scripts/example.coffee')
1019
-
1020
-
describe 'example script', ->
1021
-
beforeEach ->
1022
-
@room =helper.createRoom()
1012
+
```javascript
1013
+
import { describe, it } from'node:test'
1014
+
importassertfrom'node:assert/strict'
1015
+
importHelperfrom'hubot-test-helper'
1023
1016
1024
-
afterEach ->
1025
-
@room.destroy()
1017
+
consthelper=newHelper('../scripts/example.mjs')
1026
1018
1027
-
it 'doesn\'t need badgers', ->
1028
-
@room.user.say('alice', 'did someone call for a badger?').then=>
1029
-
expect(@room.messages).to.eql [
1030
-
['alice', 'did someone call for a badger?']
1031
-
['hubot', 'Badgers? BADGERS? WE DON\'T NEED NO STINKIN BADGERS']
1032
-
]
1019
+
describe('example script', () => {
1020
+
let room =null
1021
+
beforeEach(() => {
1022
+
room =helper.createRoom()
1023
+
})
1033
1024
1034
-
it 'won\'t open the pod bay doors', ->
1035
-
@room.user.say('bob', '@hubot open the pod bay doors').then=>
1036
-
expect(@room.messages).to.eql [
1037
-
['bob', '@hubot open the pod bay doors']
1038
-
['hubot', '@bob I\'m afraid I can\'t let you do that.']
1039
-
]
1025
+
afterEach(() =>
1026
+
room.destroy()
1027
+
))
1040
1028
1041
-
it 'will open the dutch doors', ->
1042
-
@room.user.say('bob', '@hubot open the dutch doors').then=>
1043
-
expect(@room.messages).to.eql [
1044
-
['bob', '@hubot open the dutch doors']
1045
-
['hubot', '@bob Opening dutch doors']
1046
-
]
1029
+
it("doesn't need badgers", async () => {
1030
+
awaitroom.user.say('alice', 'did someone call for a badger?')
1031
+
assert.deepEqual(room.messages, [
1032
+
['alice', 'did someone call for a badger?']
1033
+
['hubot', 'Badgers? BADGERS? WE DON\'T NEED NO STINKIN BADGERS']
1034
+
])
1035
+
})
1036
+
it("won't open the pod bay doors"), async () => {
1037
+
awaitroom.user.say('bob', '@hubot open the pod bay doors')
1038
+
assert.deepEqual(room.messages, [
1039
+
['bob', '@hubot open the pod bay doors']
1040
+
['hubot', '@bob I\'m afraid I can\'t let you do that.']
1041
+
])
1042
+
})
1043
+
it('will open the dutch doors'), async () => {
1044
+
awaitroom.user.say('bob', '@hubot open the dutch doors')
0 commit comments