Add possibility to send script output to discord script (piping)
I'm trying to replace my Slack notifications for server monitoring to Discord and it would be great if I can output my scripts to the discord script, so it takes the output as --text parameter value if it is omitted.
I've named the script discord and added it to the PATH.
Example (using yours):
discord --title "My notification" --text "$(cat filename | jq -Rs . | cut -c 2- | rev | cut -c 2- | rev)"
becomes
cat filename | jq -Rs . | cut -c 2- | rev | cut -c 2- | rev | discord --title "My notification"
My issue is that I have various cron jobs that have some more complicated one-liners containing quotes, double quotes and backticks and it breaks the "$(...)" usage.
i agree too, using pipe will be more unix friendly
I'll see what I can do with this. Piping output to the script is definitely a requirement, in my opinion.
Today I had some time to create a Discord version of "slacktee" with help from AI. The basic version is working and you can find it on https://github.com/JosKlever/discordtee I'll have to do more testing and maybe expanding the functionality a bit, but feel free to have a look and use it as you like.
GitHub
discordtee is a bash script that works like tee command. Instead of writing the standard input to files, discordtee posts it to Discord. - JosKlever/discordtee
If my PR 64 ever gets approved, then you could just use actual tee and pipe the output into the discord.sh script with the --stdin parameter. @fieu - have you had a chance to review why the tests are failing?
@ericloyd I'm sorry this issue has taken a while, I've been busy with other projects and work.
This weekend I will look into it but it shouldn't be anything major to fix the test suite.
@ericloyd see #64