archangelic / pinhook

the pluggable python framework for IRC bots and Twitch bots
https://archangelic.github.io/pinhook/
MIT License
31 stars 4 forks source link

Add a decorator for "pipe"able commands #56

Open RussellChamp opened 5 years ago

RussellChamp commented 5 years ago

One thing I've seen some bot creators do is create commands that can "chain" or "pipe" into each other. This would use the output of one command as the input for the next one. As an example, a bot may support the commands "!rainbow" and "!superhero". Chaining the two commands together (like "!superhero | !rainbow") would result in a random super hero printed in a rainbow color; the output from "!superhero" would be used to call "!rainbow ". The decorator would go on any plugin that is allowed to be "piped" into another. In this case, it would be on "!superhero" and the decorator would mean that only the user input up to the first pipe '|' would be sent to that command. I'd be interested in doing this at some point ~in the future!~

archangelic commented 5 years ago

This might actually have to be done in the bot class rather than as a decorator, but I love the idea!