Fetch the old iconUrl in guildUpdate event

I’m trying to implement a feature that prevents from changing a guild icon. But I’m encountering an issue because in the guildUpdate event I can only get the old iconUrl but it seems that this url is no longer valid. So how can I do that?
10 Replies
d.js toolkit
d.js toolkit10mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
zevnda
zevnda10mo ago
Store the icon somewhere and if it changes, replace it with the stored one
Warix
WarixOP10mo ago
This is what I thought but what is the best way to store it ?
Amgelo
Amgelo10mo ago
it depends on what you mean by "best" you pretty much only need to store it, it doesn't matter where or how
zevnda
zevnda10mo ago
You can store to base64 image string in a databse?
Amgelo
Amgelo10mo ago
you could save it anywhere and then just keep the buffer/base64 string in memory once you start
Warix
WarixOP10mo ago
I don’t want to take too many ram for a single feature I will do that 👍
Amgelo
Amgelo10mo ago
a single buffer/string shouldn't take much memory it would depend on the image either way
Warix
WarixOP10mo ago
Of course, I don’t know the real cost in memory using buffer to store for example 100 guild icons
Amgelo
Amgelo10mo ago
ah, I assumed it was for a single server then just read it from db, maybe put some kind of cache if needed
Want results from more Discord servers?
Add your server