From f790267a441f3542c05336791a22658a319a9a2c Mon Sep 17 00:00:00 2001 From: stormdragon2976 Date: Tue, 31 Jan 2023 01:27:31 -0500 Subject: [PATCH] Fixed a couple bugs, more to go. --- ratatoskr.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ratatoskr.sh b/ratatoskr.sh index 21bbc7a..5e8c477 100755 --- a/ratatoskr.sh +++ b/ratatoskr.sh @@ -232,7 +232,7 @@ done bgLoop=0 while : ; do if [[ -n "${since_id}" ]]; then - result="$(curl -sS --oauth2-bearer "${oauth_token}" "${instanceURL}/api/va/timelines/${timeline:-home}?since_id=${since_id}")" + result="$(curl -sS --oauth2-bearer "${oauth_token}" "${instanceURL}/api/v1/timelines/${timeline:-home}" -d "since_id=${since_id}")" else result="$(curl -sS --oauth2-bearer "${oauth_token}" "${instanceURL}/api/v1/timelines/${timeline:-home}")" fi @@ -259,10 +259,14 @@ while : ; do if [[ "${since_id}" != "${latest_id}" ]]; then # handle new events events="$(jq -r '.[].content' <<< "$result")" - echo -e "$events" | while read -r event; do - echo "$event" | sed -e 's/<[^>]*>//g' + stripped_events="$(echo "$events" | sed -E 's/<[^>]+>//g')" + usernames="$(jq -r '.[].account.username' <<< "$result")" + echo -e "$usernames" | while read -r username; do + echo "$username: $(echo "$stripped_events" | head -n 1)" + stripped_events="$(echo "$stripped_events" | tail -n +2)" echo done + play_sound new_${timeline} since_id="$latest_id" fi @@ -273,7 +277,7 @@ done & # Handle commands while : ; do # Command prompt: - read -er -p "<${softwareName}> " command + read -er command if [[ ! "${command}" =~ ^/ ]]; then post_status "${command}" continue @@ -283,7 +287,7 @@ while : ; do exit 0 ;; *) - systemMessage="Error: '${command}' is not a valid command." + echo "Error: '${command}' is not a valid command." play_sound error ;; esac