fedimbed.bluesky: forgot all parts dont have features
This commit is contained in:
parent
e4bcdf6f8a
commit
edc0bf902d
1 changed files with 20 additions and 19 deletions
|
@ -253,28 +253,29 @@ async function bluesky(msg, url, spoiler = false) {
|
||||||
splitString.push({text: mainEmbed.description.substring(start)});
|
splitString.push({text: mainEmbed.description.substring(start)});
|
||||||
|
|
||||||
for (const part of splitString) {
|
for (const part of splitString) {
|
||||||
for (const feature of part.features) {
|
if (part.features)
|
||||||
switch (feature.$type) {
|
for (const feature of part.features) {
|
||||||
case "app.bsky.richtext.facet#link": {
|
switch (feature.$type) {
|
||||||
if (part.text == feature.uri.replace(/^https?:\/\//, "")) {
|
case "app.bsky.richtext.facet#link": {
|
||||||
part.text = feature.uri;
|
if (part.text == feature.uri.replace(/^https?:\/\//, "")) {
|
||||||
} else {
|
part.text = feature.uri;
|
||||||
part.text = `[${part.text}](${feature.uri})`;
|
} else {
|
||||||
|
part.text = `[${part.text}](${feature.uri})`;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
case "app.bsky.richtext.facet#mention": {
|
||||||
|
part.text = `[${part.text}](https://bsky.app/profile/${feature.did})`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "app.bsky.richtext.facet#tag": {
|
||||||
|
part.text = `[${part.text}](https://bsky.app/hashtag/${feature.tag})`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case "app.bsky.richtext.facet#mention": {
|
|
||||||
part.text = `[${part.text}](https://bsky.app/profile/${feature.did})`;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "app.bsky.richtext.facet#tag": {
|
|
||||||
part.text = `[${part.text}](https://bsky.app/hashtag/${feature.tag})`;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mainEmbed.description = splitString.map((part) => part.text).join("");
|
mainEmbed.description = splitString.map((part) => part.text).join("");
|
||||||
|
|
Loading…
Reference in a new issue