Skip to content

Add fallback of attachment name if there is no message/embed content#519

Open
sasial-dev wants to merge 2 commits into
MarcusOtter:mainfrom
sasial-dev:attachment-name-fallback
Open

Add fallback of attachment name if there is no message/embed content#519
sasial-dev wants to merge 2 commits into
MarcusOtter:mainfrom
sasial-dev:attachment-name-fallback

Conversation

@sasial-dev

Copy link
Copy Markdown

Closes #506

I didn't end up adding a variable because MessageVariables.replace would then require the whole message to be passed, which is not ideal...

Comment on lines +185 to +189
const firstAttachment = message.attachments.first();
if (!message.cleanContent && !embedCleanContent && firstAttachment) {
return firstAttachment.name.split(".")[0];
}

@MarcusOtter MarcusOtter Dec 19, 2025

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is a bit tricky, I would prefer if it always added to the message content so that people can regex on it. Would also be nice to get alt texts from images, not sure if that's a thing (would probably want alt text ?? image name). There's also the problem that this only applies to the first attachment, I can see people wanting all of them.

But adding it to message content would also break backwards compatibility somewhat, so I'm not super keen on adding it unless I have one big breaking change where I can provide a clear migration path forwards for everyone at once.

Not a huge fan of only having a fallback to this if everything else is empty also.. I feel we're stuck between a rock and a hard place when it comes to adding this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💡 Use attachment name / alt text for thread title

2 participants