fedimbed: fix text only posts sending blank messages, cw entire embed if attachments
This commit is contained in:
parent
8a070bb4b2
commit
cfd95d9ab2
1 changed files with 6 additions and 1 deletions
|
@ -240,7 +240,7 @@ async function processUrl(msg, url) {
|
|||
|
||||
let desc = "";
|
||||
let MAX_LENGTH = 3999;
|
||||
if (cw != "") {
|
||||
if (cw != "" && attachments.length == 0) {
|
||||
desc += "\u26a0 " + cw + "\n\n||" + content + "||";
|
||||
MAX_LENGTH -= 8 - cw.length;
|
||||
} else {
|
||||
|
@ -288,6 +288,7 @@ async function processUrl(msg, url) {
|
|||
|
||||
const embeds = [];
|
||||
|
||||
if (attachments.length > 0) {
|
||||
for (const attachment of attachments) {
|
||||
const embed = Object.assign({}, baseEmbed);
|
||||
embed.image = {
|
||||
|
@ -295,6 +296,9 @@ async function processUrl(msg, url) {
|
|||
};
|
||||
embeds.push(embed);
|
||||
}
|
||||
} else {
|
||||
embeds.push(baseEmbed);
|
||||
}
|
||||
|
||||
// NB: OceanicJS/Oceanic#32
|
||||
//await msg.edit({flags: MessageFlags.SUPPRESS_EMBEDS}).catch(() => {});
|
||||
|
@ -309,6 +313,7 @@ async function processUrl(msg, url) {
|
|||
.catch(() => {});
|
||||
|
||||
await msg.channel.createMessage({
|
||||
content: cw && attachments.length > 0 ? ":warning: " + cw + " || ||";
|
||||
embeds,
|
||||
allowedMentions: {
|
||||
repliedUser: false,
|
||||
|
|
Loading…
Reference in a new issue