discord.sh icon indicating copy to clipboard operation
discord.sh copied to clipboard

Add possibility to send script output to discord script (piping)

Open JosKlever opened this issue 1 year ago • 1 comments

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.

JosKlever avatar Dec 29 '24 16:12 JosKlever

i agree too, using pipe will be more unix friendly

Kogitae avatar Dec 30 '24 07:12 Kogitae

I'll see what I can do with this. Piping output to the script is definitely a requirement, in my opinion.

ericloyd avatar May 21 '25 12:05 ericloyd

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

JosKlever avatar Jun 02 '25 13:06 JosKlever

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 avatar Jun 02 '25 13:06 ericloyd

@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.

fieu avatar Jun 02 '25 21:06 fieu

@ericloyd see #64

fieu avatar Oct 27 '25 09:10 fieu