fedimbed: spoiler try 2

This commit is contained in:
Cynthia Foxwell 2023-01-17 12:27:55 -07:00
parent e1af92f9d1
commit d2bbf5c040
1 changed files with 6 additions and 4 deletions

View File

@ -469,11 +469,12 @@ async function processUrl(msg, url, spoiler = false) {
files.push({ files.push({
name: name:
(cw != "" || spoiler ? "SPOILER_" : "") + attachment.type.indexOf("/") > -1 (cw != "" || spoiler ? "SPOILER_" : "") +
(attachment.type.indexOf("/") > -1
? attachment.type.replace("/", ".") ? attachment.type.replace("/", ".")
: attachment.type + : attachment.type +
"." + "." +
(url.match(/\.([a-z0-9]{3,4})$/)?.[0] ?? "mp4"), (url.match(/\.([a-z0-9]{3,4})$/)?.[0] ?? "mp4")),
contents: file, contents: file,
}); });
} }
@ -501,7 +502,8 @@ async function processUrl(msg, url, spoiler = false) {
files.push({ files.push({
name: name:
(cw != "" || spoiler ? "SPOILER_" : "") + attachment.type.indexOf("/") > -1 (cw != "" || spoiler ? "SPOILER_" : "") +
(attachment.type.indexOf("/") > -1
? attachment.type ? attachment.type
.replace("/", ".") .replace("/", ".")
.replace("mpeg", "mp3") .replace("mpeg", "mp3")
@ -509,7 +511,7 @@ async function processUrl(msg, url, spoiler = false) {
.replace("x-wav", "wav") .replace("x-wav", "wav")
: attachment.type + : attachment.type +
"." + "." +
(url.match(/\.([a-z0-9]{3,4})$/)?.[0] ?? "mp3"), (url.match(/\.([a-z0-9]{3,4})$/)?.[0] ?? "mp3")),
contents: file, contents: file,
}); });
} }