Add fallback of attachment name if there is no message/embed content#519
Add fallback of attachment name if there is no message/embed content#519sasial-dev wants to merge 2 commits into
Conversation
| const firstAttachment = message.attachments.first(); | ||
| if (!message.cleanContent && !embedCleanContent && firstAttachment) { | ||
| return firstAttachment.name.split(".")[0]; | ||
| } | ||
|
|
There was a problem hiding this comment.
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
Closes #506
I didn't end up adding a variable because
MessageVariables.replacewould then require the whole message to be passed, which is not ideal...