interaction fetchReply attachment URL is different than the actual URL

I'm trying to retrieve the image URL from the attachment using fetchReply, yet the URL/ID seems to be a different one than the one that was actually posted. console.log url: see image actual url: https://cdn.discordapp.com/attachments/897014664561578034/1111120710912442448/image.png
if (attachment) {
message = await interaction.editReply({
content: name
, files: [attachment.url]
, fetchReply: true
});
} else if (url) {
message = await interaction.editReply({
content: name
, files: [url]
, fetchReply: true
});
}
console.log(message.attachments);
persistentImageURL = message.attachments.map(attachment => attachment.url);
if (attachment) {
message = await interaction.editReply({
content: name
, files: [attachment.url]
, fetchReply: true
});
} else if (url) {
message = await interaction.editReply({
content: name
, files: [url]
, fetchReply: true
});
}
console.log(message.attachments);
persistentImageURL = message.attachments.map(attachment => attachment.url);
Is there a way to get the persistent url for fetching at a later time (so it doesn't get deleted from cache)
9 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
MrMythical
MrMythical2y ago
Yeah the attachments are meant to be ephemeral
alan
alanOP2y ago
The links aren't ephemeral though duckthinking would there be a way to get the persistent link? one that hopefully lasts forever
MrMythical
MrMythical2y ago
Sorry I'm wrong, it is not meant to be ephemeral So the link just doesn't work after some time?
alan
alanOP2y ago
Yep correct If I manually copy link from the message output, it's a different link and that one would be permanent But the fetchReply gets a different ID somehow
MrMythical
MrMythical2y ago
When you edit the image in it should be fetching and creating a new attachment iirc
alan
alanOP2y ago
Oh so I shouldn't edit that post after fetching the url?
MrMythical
MrMythical2y ago
I mean the attachment in the edited message should have a new url
alan
alanOP2y ago
Hmmm I could try
Want results from more Discord servers?
Add your server