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 desc = "";
|
||||||
let MAX_LENGTH = 3999;
|
let MAX_LENGTH = 3999;
|
||||||
if (cw != "") {
|
if (cw != "" && attachments.length == 0) {
|
||||||
desc += "\u26a0 " + cw + "\n\n||" + content + "||";
|
desc += "\u26a0 " + cw + "\n\n||" + content + "||";
|
||||||
MAX_LENGTH -= 8 - cw.length;
|
MAX_LENGTH -= 8 - cw.length;
|
||||||
} else {
|
} else {
|
||||||
|
@ -288,6 +288,7 @@ async function processUrl(msg, url) {
|
||||||
|
|
||||||
const embeds = [];
|
const embeds = [];
|
||||||
|
|
||||||
|
if (attachments.length > 0) {
|
||||||
for (const attachment of attachments) {
|
for (const attachment of attachments) {
|
||||||
const embed = Object.assign({}, baseEmbed);
|
const embed = Object.assign({}, baseEmbed);
|
||||||
embed.image = {
|
embed.image = {
|
||||||
|
@ -295,6 +296,9 @@ async function processUrl(msg, url) {
|
||||||
};
|
};
|
||||||
embeds.push(embed);
|
embeds.push(embed);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
embeds.push(baseEmbed);
|
||||||
|
}
|
||||||
|
|
||||||
// NB: OceanicJS/Oceanic#32
|
// NB: OceanicJS/Oceanic#32
|
||||||
//await msg.edit({flags: MessageFlags.SUPPRESS_EMBEDS}).catch(() => {});
|
//await msg.edit({flags: MessageFlags.SUPPRESS_EMBEDS}).catch(() => {});
|
||||||
|
@ -309,6 +313,7 @@ async function processUrl(msg, url) {
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
|
|
||||||
await msg.channel.createMessage({
|
await msg.channel.createMessage({
|
||||||
|
content: cw && attachments.length > 0 ? ":warning: " + cw + " || ||";
|
||||||
embeds,
|
embeds,
|
||||||
allowedMentions: {
|
allowedMentions: {
|
||||||
repliedUser: false,
|
repliedUser: false,
|
||||||
|
|
Loading…
Reference in a new issue