diff options
| author | June McEnroe <june@causal.agency> | 2026-09-30 20:31:56 -0400 |
|---|---|---|
| committer | June McEnroe <june@causal.agency> | 2026-09-30 20:31:56 -0400 |
| commit | 06ac3a49a0321c74580b4b2b89b741650f658cad (patch) | |
| tree | d45b7d6fdef418e77b6af704da0b7885a371afe1 | |
| parent | Add The Fortunate Fall (diff) | |
| download | src-master.tar.gz src-master.zip | |
| -rw-r--r-- | etc/pronouns/bot.sh | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/etc/pronouns/bot.sh b/etc/pronouns/bot.sh index 8b7c9802..13ddb239 100644 --- a/etc/pronouns/bot.sh +++ b/etc/pronouns/bot.sh @@ -2,6 +2,13 @@ set -eu Instance=https://mstdn.isometry.group +Allowed=' + campfi.rs + mtl.rocks + multiocular.ooo + quiet.horse + social.implicitmatrix.com +' if ! test -f access_token; then echo 'No access_token!' >&2 @@ -31,7 +38,7 @@ followers=$( curl -Ss \ -H "Authorization: Bearer ${access_token}" \ "${Instance}/api/v1/accounts/${account_id}/followers?limit=80" | - jq -r 'map(select(.acct | contains("@") | not)) | .[].id' + jq -r '.[].id' ) for follower_id in $followers 112284333737697665; do @@ -40,7 +47,22 @@ for follower_id in $followers 112284333737697665; do -H "Authorization: Bearer ${access_token}" \ ${Instance}/api/v1/accounts/${follower_id} ) - username=$(printf '%s' "${account}" | jq -r .username) + acct=$(printf '%s' "${account}" | jq -r .acct) + instance=${acct#*@} + allowed=false + if [ "$instance" = "$acct" ]; then + allowed=true + else + for allowed_instance in $Allowed; do + if [ "$instance" = "$allowed_instance" ]; then + allowed=true + break + fi + done + fi + if ! $allowed; then + continue + fi pronouns=$( printf '%s' "${account}" | jq -r ' @@ -61,7 +83,7 @@ for follower_id in $followers 112284333737697665; do -H "Authorization: Bearer ${access_token}" \ -F visibility=unlisted \ --form-string \ - "status=@${username} has changed pronouns to: ${text}" \ + "status=@${acct} has changed pronouns to: ${text}" \ ${Instance}/api/v1/statuses >/dev/null fi printf '%s' "${pronouns}" >$follower_id |