hubotio / hubot

A customizable life embetterment robot.
https://hubotio.github.io/hubot/
MIT License
16.66k stars 3.75k forks source link

Slack-specific functions not available in shell adapter #1525

Closed bsamsom closed 1 year ago

bsamsom commented 4 years ago

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.

technicalpickles commented 1 year ago

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
}
joeyguerra commented 1 year ago

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