Closed jpdsc closed 2 years ago
send-discord-log
is meant to be functional yet as simple as possible, so that it can be easily understood and customized as desired.
Respecting the 2000 chars
content limit is reasonable. Shall we replace cat
with head -c
or tail -c
?
As for doing tail -f
and then spamming each line to discord, that would be out-of-scope here, but it's something you can easily do by yourself.
e.g. some untested bash code I copy & pasted together, might just work:
tail -f "$1" | stdbuf -oL uniq | while read -r LINE; do
curl --form "username=PRINT" --form "content=$LINE" "$DISCORD_WEBHOOK_URL"
done
Understood. You know, I thought it was also outputting the log file hence why I mentioned the 2000 char. However, due to the grep on: https://github.com/filebot/plugins/blob/c45e1ed541daebd6293dad6954f0e13f2c5d0582/bash/send-discord-log.sh#L13 It can still output more than 2000 char. Fixed by you now :-)
Regarding the tail -f. I already created something similar myself and working as intended.
No worries. The 2000 char
embedded content limit is a good catch, even if we're unlikely to run into it due to grep
filtering most of the output already. Easily fixed by adding head -c
in our "model" solution.
Hey! First of all thank you for the script! Really useful. However, I think you should try and implement a character limit on the content. The maximum total limit for "content "is 2000 characters. https://discord.com/developers/docs/resources/webhook#execute-webhook-jsonform-params
Thanks!
Also, would you be interested in creating a script which doesn't output a command but reads from a log file and outputs once it changes?