Discord.js: oldGuild.iconUrl is not a function when server is deleted

Created on 12 Oct 2020  Â·  4Comments  Â·  Source: discordjs/discord.js

When I listen to the guildUpdate event, and a guild is deleted, the guildUpdate event is triggered. Once it's triggered, the functions oldGuild.iconUrl and newGuild.iconUrl result in a "not a function" error. Both newGuild.available and oldGuild.available are true.

client.on("guildUpdate", (oldGuild, newGuild) => {
    oldGuild.iconUrl();
}

Further details:

  • discord.js version: 12.3.1
  • Node.js version: 14.13.1
  • Operating system: Ubuntu 20.04.1
  • Priority this issue should have – please be realistic and elaborate if possible: Low, guilds are rarely deleted

Relevant client options:

  • partials: none
  • gateway intents: none
  • other: none
  • [ ] I have also tested the issue on latest master, commit hash:
unverified bug

All 4 comments

Correct, it isn't a function. JavasScript is case-sensitive and the method is <Guild>.iconURL()

The issue tracker is only for bug reports and enhancement suggestions. If you have a question, please ask it in the Discord server instead of opening an issue – you will get redirected there anyway.

@monbrey Oops. However, why is this event being triggered at all? I feel that only guildDelete should be triggered

We can't control which events Discord emits.

Again, the issue tracker is only for bug reports and enhancement suggestions. If you have a question, please ask it in the Discord server instead of opening an issue – you will get redirected there anyway.

I was unaware that discord.js was merely forwarding the events that Discord emits, my bad. Thanks for your help

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Acaretia picture Acaretia  Â·  3Comments

smchase picture smchase  Â·  3Comments

Dmitry221060 picture Dmitry221060  Â·  3Comments

ghost picture ghost  Â·  3Comments

kvn1351 picture kvn1351  Â·  3Comments