gfaraj / super-bot

A simple but extensible bot written in Node (with Whatsapp, Slack, and Discord interfaces)
MIT License
24 stars 15 forks source link

Add ability to funnel the response of one command to another #12

Closed gfaraj closed 4 years ago

gfaraj commented 4 years ago

I would like to pass the output of one command as the input of another command effortlessly.

One way that this can be implemented is similar to pipes in a command-line:

!translate es Hello, how are you? | translate en

The above example executes the first command - which translates "Hello, how are you?" into Spanish - and then pipes the response - "¿Hola, como estas?" to the next command in the pipeline. This would end up calling "translate en ¿Hola, como estas?" which would re-translate that to English.

You should be able to have more than one pipe in a single line.

If there are better ways of achieving something similar, we can discuss them as well.

gfaraj commented 4 years ago

This is now done and merged to master.