Support all mastodon links

This commit is contained in:
Nexus 2024-08-11 15:18:31 +01:00
parent 41b2e75865
commit b28d146d5a

View file

@ -31,12 +31,12 @@ class MisskeyPreviewModule(niobot.Module):
continue
elif len(sent) >= 5:
break
resp = await client.post("https://%s/api/notes/show" % parsed.netloc, json={"noteId": post_id})
resp = await client.get("https://%s/api/v1/statuses/%s" % (parsed.netloc, post_id))
if resp.status_code != 200:
continue
data = resp.json()
username = data["user"]["username"]
if not data["text"]:
username = data["user"]["fqn"]
if not data.get("text"):
continue
text = textwrap.shorten(data["text"], width=1000)