Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot initiate a private message channel from the bot #32

Closed
cdelmas opened this issue Mar 6, 2017 · 3 comments
Closed

Cannot initiate a private message channel from the bot #32

cdelmas opened this issue Mar 6, 2017 · 3 comments

Comments

@cdelmas
Copy link

cdelmas commented Mar 6, 2017

Using this code:

robot.hear /plop/i, (res) ->
    robot.messageRoom res.message.user.name, "Hello!"
    robot.send {room: res.message.user.name}, "Hello!"

I expect the bot to write a private message to the user. It does work, but only if the user has already open a private message channel to the bot. The bot cannot open it on its initiative the very first time.

I get the following trace:

ERROR TypeError: Cannot read property 'toLowerCase' of undefined
  at Brain.userForName (xxxx\basic\node_modules\hubot\src\brain.coffee:120:17, <js>:106:23)
  at Matteruser.send (xxxx\basic\node_modules\hubot-matteruser\src\matteruser.coffee:101:16, <js>:160:31)
  at runAdapterSend (xxxx\basic\node_modules\hubot\src\response.coffee:82:34, <js>:87:50)
  at allDone (xxxx\basic\node_modules\hubot\src\middleware.coffee:44:37, <js>:34:16)
  at xxxx\basic\node_modules\async\lib\async.js:274:13
  at Object.async.eachSeries (xxxx\basic\node_modules\async\lib\async.js:142:20)
  at Object.async.reduce (xxxx\basic\node_modules\async\lib\async.js:268:15)
  at xxxx\basic\node_modules\hubot\src\middleware.coffee:49:7, <js>:37:22
  at _combinedTickCallback (internal/process/next_tick.js:67:7)
  at process._tickCallback (internal/process/next_tick.js:98:9)

Reproduced on node 6.9.4, npm 3.10.10.

@Judokus
Copy link
Contributor

Judokus commented Mar 16, 2017

I guess you are using Mattermost 3.5 or 3.7?

From the readme:

For example, if you're using Mattermost server version 3.6.0 or 3.6.1, the major version is "3.6", and you need version 3.6 of hubot-matteruser and mattermost-client. Neither version 3.5 or 3.7 will work, since the Mattermost server doesn't yet support API deprecation. See releases archive for older versions.

@Judokus
Copy link
Contributor

Judokus commented Mar 16, 2017

Upon further inspection and having the same issue with 3.6... mattermost-client makes a call to /teams/{teamId}/channels//create_direct ...

@loafoe
Copy link
Owner

loafoe commented Mar 16, 2017

@cdelmas should be fixed in v3.7.0, thanks to @Judokus

@loafoe loafoe closed this as completed Mar 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants