Fixed a couple bugs, more to go.

This commit is contained in:
stormdragon2976 2023-01-31 01:27:31 -05:00
parent 051d6e51e8
commit f790267a44

View File

@ -232,7 +232,7 @@ done
bgLoop=0 bgLoop=0
while : ; do while : ; do
if [[ -n "${since_id}" ]]; then 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 else
result="$(curl -sS --oauth2-bearer "${oauth_token}" "${instanceURL}/api/v1/timelines/${timeline:-home}")" result="$(curl -sS --oauth2-bearer "${oauth_token}" "${instanceURL}/api/v1/timelines/${timeline:-home}")"
fi fi
@ -259,10 +259,14 @@ while : ; do
if [[ "${since_id}" != "${latest_id}" ]]; then if [[ "${since_id}" != "${latest_id}" ]]; then
# handle new events # handle new events
events="$(jq -r '.[].content' <<< "$result")" events="$(jq -r '.[].content' <<< "$result")"
echo -e "$events" | while read -r event; do stripped_events="$(echo "$events" | sed -E 's/<[^>]+>//g')"
echo "$event" | 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 echo
done done
play_sound new_${timeline}
since_id="$latest_id" since_id="$latest_id"
fi fi
@ -273,7 +277,7 @@ done &
# Handle commands # Handle commands
while : ; do while : ; do
# Command prompt: # Command prompt:
read -er -p "<${softwareName}> " command read -er command
if [[ ! "${command}" =~ ^/ ]]; then if [[ ! "${command}" =~ ^/ ]]; then
post_status "${command}" post_status "${command}"
continue continue
@ -283,7 +287,7 @@ while : ; do
exit 0 exit 0
;; ;;
*) *)
systemMessage="Error: '${command}' is not a valid command." echo "Error: '${command}' is not a valid command."
play_sound error play_sound error
;; ;;
esac esac