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
- 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!Store the icon somewhere and if it changes, replace it with the stored one
This is what I thought but what is the best way to store it ?
it depends on what you mean by "best"
you pretty much only need to store it, it doesn't matter where or how
You can store to base64 image string in a databse?
you could save it anywhere and then just keep the buffer/base64 string in memory once you start
I don’t want to take too many ram for a single feature
I will do that 👍
a single buffer/string shouldn't take much memory
it would depend on the image either way
Of course, I don’t know the real cost in memory using buffer to store for example 100 guild icons
ah, I assumed it was for a single server
then just read it from db, maybe put some kind of cache if needed