3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-11 04:45:02 +00:00

Fix issues around embeds

This commit is contained in:
Dragory 2021-08-19 19:33:47 +03:00
parent dc53de8ae3
commit 81514276e9
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
8 changed files with 111 additions and 21 deletions

View file

@ -82,6 +82,6 @@ export const PostEmbedCmd = postCmd({
);
}
actualPostCmd(pluginData, msg, args.channel, { embed }, args);
actualPostCmd(pluginData, msg, args.channel, { embeds: [embed] }, args);
},
});

View file

@ -22,8 +22,7 @@ export const ScheduledPostsListCmd = postCmd({
let i = 1;
const postLines = scheduledPosts.map(p => {
let previewText =
p.content.content || (p.content.embed && (p.content.embed.description || p.content.embed.title)) || "";
let previewText = p.content.content || p.content.embeds?.[0]?.description || p.content.embeds?.[0]?.title || "";
const isTruncated = previewText.length > SCHEDULED_POST_PREVIEW_TEXT_LENGTH;
@ -37,7 +36,7 @@ export const ScheduledPostsListCmd = postCmd({
.format(timeAndDate.getDateFormat("pretty_datetime"));
const parts = [`\`#${i++}\` \`[${prettyPostAt}]\` ${previewText}${isTruncated ? "..." : ""}`];
if (p.attachments.length) parts.push("*(with attachment)*");
if (p.content.embed) parts.push("*(embed)*");
if (p.content.embeds?.length) parts.push("*(embed)*");
if (p.repeat_until) {
parts.push(`*(repeated every ${humanizeDuration(p.repeat_interval)} until ${p.repeat_until})*`);
}