diff --git a/backend/src/plugins/Post/util/postMessage.ts b/backend/src/plugins/Post/util/postMessage.ts index f8b375b0..5bb13095 100644 --- a/backend/src/plugins/Post/util/postMessage.ts +++ b/backend/src/plugins/Post/util/postMessage.ts @@ -30,6 +30,7 @@ export async function postMessage( name: attachments[0].name, file: await fsp.readFile(downloadedAttachment.path), }; + content.files = [file.file]; } if (enableMentions) { @@ -38,12 +39,7 @@ export async function postMessage( }; } - let createdMsg; - if (file) { - createdMsg = await channel.send({ ...content, files: [file.file] }); - } else { - createdMsg = await channel.send(content); - } + const createdMsg = await channel.send(content); pluginData.state.savedMessages.setPermanent(createdMsg.id); if (downloadedAttachment) {