hubotio / hubot

A customizable life embetterment robot.

Home Page:https://hubotio.github.io/hubot/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Slack-specific functions not available in shell adapter

bsamsom opened this issue · comments

The Hubot shell adapter that get used when running bin/hubot uses an older version of Slack, part of my code uses robot.fileShared which throws the following error:
TypeError: robot.fileShared is not a function

using the slack adapter by running the following:
HUBOT_SLACK_TOKEN=xoxb-YOUR-TOKEN-HERE ./bin/hubot --adapter slack
with hubot-slack version 4.6.0 works fine.

However I wish to run commands from the command line for testing, and the slack adapter does not support that, the shell does.

This is a tough one. The Slack adapter adds a bunch of methods to robot, and the core hubot package (this repo) and other adapters have no way to do it.

I think ideally, the pattern is abstracted and included in hubot core. Or alternatively, we define an place for adapter specific methods, that can be stubbed out for shell?

As a work around, your script using it could do something like:

robot.
if (!robot.fileShared) {
  // stub fileShared for adapters it's not available on
}

Another approach is to create a new shell adapter that implements the Slack adapter functionality.