Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stahnma/hubot-external-commands
Register and run external (non javascript or coffeescript) commands via hubot.
https://github.com/stahnma/hubot-external-commands
Last synced: 26 days ago
JSON representation
Register and run external (non javascript or coffeescript) commands via hubot.
- Host: GitHub
- URL: https://github.com/stahnma/hubot-external-commands
- Owner: stahnma
- License: mit
- Created: 2023-11-14T22:55:25.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-02-16T05:36:09.000Z (9 months ago)
- Last Synced: 2024-09-18T00:34:02.015Z (about 2 months ago)
- Language: CoffeeScript
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hubot-external-commands
This is a hubot extension designed to allow you to break free from node, coffeescript, and javascript and still have all the chat operations you'd like.
You load executable commands in the `HUBOT_EXTERNAL_COMMANDS_DIR` directory. Hubot then loads each file that has executable permissions as a command. Optionally if you have a `.desc` along side the `` executable file, it will read in the lines from the desc onto the help menu.
# Setup
## Install & Configure
npm install --save hubot-external-commands
edit your `external-scripts.json` file and add `hubot-external-commands` to it.
Set `HUBOT_EXTERNAL_COMMANDS_DIR`. (In this example it's set to `$HUBOT_HOME/shell`.
shell/
├── foo
├── sprint
└── sprint.descWhen loading, hubot will process the command foo with no help string. Sprint will be processed and the sprint.desc will be read for the help strings.
## The contents of sprint.desc
sprint help - Display help message
sprint left - Display time left in sprint
sprint progress - Display sprint remaining information
sprint scope - Display scope change information## After loading
> !help foo
!botsnack - give the bot a food
!foo
> !help sprint
!sprint
!sprint help - Display help message
!sprint left - Display time left in sprint
!sprint progress - Display sprint remaining information
!sprint scope - Display scope change information# Rich Text and Slack Blocks
This plugin now has initial support for [Slack blocks[(https://api.slack.com/block-kit/building). The plugin will only work with slack blocks if it detects slack as the adapter in play with hubot. (e.g. it won't attempt blocks if using discord, irc, or shell adapters).
To use slack blocks, you can test them out using the [Slack Block Kit Builder](https://app.slack.com/block-kit-builder/).
The stdout of the external program you write needs to emit the full JSON document that will be send via the bot. The bot will then add channel information and send the payload without additional modification.
:warning: If you want to send an image, that is not yet supported, however linking to existing image is via block kit.
The deafult mode is strings on stdout. If those strings contain URIs, slack will make them links even without doing a full JSON block.
# Caveats
* You cannot use a file with a dot "." in the filename. This breaks several the command/help processing subsystem.
* Executables/scripts must be executable and have ownership open to the hubot user
* Placing scripts in subdirectories of `HUBOT_EXTERNAL_COMMANDS_DIR` will not work.
* THe bot must be addressed directly to use the command. (respond vs hear). This may change in the future.# Contributors
* [rick](https://github.com/rick)
* [stahnma](https://github.com/stahnma)# License
MIT