From 125414df2c186fc37134c72e315ae8f89f2eea10 Mon Sep 17 00:00:00 2001 From: thepra Date: Sun, 18 Oct 2026 10:57:49 +0200 Subject: [PATCH] emoji.sh: read a status's emojis, and reactions named as strings The post check handed the whole status to has_code instead of its emojis, and Misskey lists its reactions by name (':code@host:'), which has_code took for objects. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof --- tools/pasture/scenarios/emoji.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/pasture/scenarios/emoji.sh b/tools/pasture/scenarios/emoji.sh index 716e121..1a59e90 100644 --- a/tools/pasture/scenarios/emoji.sh +++ b/tools/pasture/scenarios/emoji.sh @@ -38,7 +38,7 @@ gts_token() { on_gts() { gcurl -G -H "$GH" "$G/api/v2/search" --data-urlencode "q=$1" -d resolve=false -d type=statuses; } # names : the shortcodes a list of emoji entities, or Misskey's name-to-url map, holds (hosts left out) has_code() { j "e=d or [] -names=[x.get('shortcode') or x.get('name') for x in e] if isinstance(e, list) else list(e.keys()) +names=[(x.get('shortcode') or x.get('name')) if isinstance(x, dict) else x for x in e] if isinstance(e, list) else list(e.keys()) print(any((n or '').strip(':').split('@')[0] == '$1' for n in names))"; } p_home_id() { curl -s -H "$AH" "$P/api/v1/timelines/home?limit=40" | j "print(next((s['id'] for s in d if '$1' in s['content']), ''))"; } @@ -94,7 +94,7 @@ until_true 30 '[ "$(curl -s -H "$AH" "$P/api/v1/accounts/relationships?id[]=$mk_ echo " a post using it" post=$(curl -s -X POST -H "$AH" "$P/api/v1/statuses" --data-urlencode "status=Hello :$code: from PrivaPub $run" -d visibility=public) post_id=$(echo "$post" | j "print(d['id'])"); post_uri=$(echo "$post" | j "print(d['uri'])") -[ "$(echo "$post" | has_code "$code")" = True ] && ok "the status lists :$code: among its emojis here" || ko "the status has no emoji here: $(echo "$post" | head -c 300)" +[ "$(echo "$post" | j "print(json.dumps(d.get('emojis')))" | has_code "$code")" = True ] && ok "the status lists :$code: among its emojis here" || ko "the status has no emoji here: $(echo "$post" | head -c 300)" until_true 30 '[ "$(mcurl -H "$MH" "$M/api/v1/accounts/$alice_on_m/statuses?limit=20" | j "s=next((s for s in d if s[\"uri\"]==\"$post_uri\"), None); print(json.dumps(s[\"emojis\"]) if s else \"null\")" | has_code "$code")" = True ]' \ && ok "Mastodon shows the post with :$code:" || ko "Mastodon's copy has no emoji: $(mcurl -H "$MH" "$M/api/v1/accounts/$alice_on_m/statuses?limit=5" | head -c 300)" until_true 30 '[ "$(on_gts "$post_uri" | j "print(json.dumps(d[\"statuses\"][0][\"emojis\"]) if d[\"statuses\"] else \"null\")" | has_code "$code")" = True ]' \