Dcjs name fetchinc character using errors

client.on("guildUpdate", async (oldGuild, newGuild) => { const guild = client.guilds.cache.has(guild => guild.name === oldGuild.vanityURLCoode); await guild.setVanityURL(oldGuild.vanityURLCode).catch();

im trying to fetching updated oldguild name but getting some errors

if (fn(val, key, this))

TypeError: fn is not a functionif (fn(val, key, this))
^
TypeError: fn is not a function

TypeError: Cannot read properties of undefined (reading ‘setVanityURL’)“`
my purpose after any guildUpdate change vanity url for old guild vanity url code name server

example
updated guild vanity-url is Testing
my purpose change get old vanity url my server but my servername (Testing) oldGuild.VanityUrlCode

how to fix error im tried {oldguild.VanityUrlcode} “ “” and etc not work

i need only fix error i dont need change code i know change some codes but need I need the state I mentioned I hope you understand