fixed length limit

This commit is contained in:
Tomoya Matsuura(MacBookPro) 2024-03-11 23:18:42 +09:00
parent 7356c4bb93
commit e6ff6aeee5

View File

@ -102,9 +102,13 @@ async function postToBluesky(text, images) {
} }
const richText = new RichText({ text: completetext }); const richText = new RichText({ text: completetext });
await richText.detectFacets(agent); await richText.detectFacets(agent);
let text = richText.text;
if (richText.graphemeLength > 300) {
text = text.substr(0,299) + '…';
}
return agent.post({ return agent.post({
text: richText.text, text: text,
facets: richText.facets, facets: richText.facets,
}); });
} }