How to fix error Handle update error: TypeError: Cannot read property 'lvl' of undefined?

5dfbb2f79ccac292749955.jpeg
April 3rd 20 at 18:44
2 answers
April 3rd 20 at 18:46
Your error is in the file bot.js in line 4934, 93 symbol. It's written right in the error of the second line.
The first line says that the properties of the "lvl" can't be undefined, which this place uses.
@Clark_Kuvalis, Thanks for the reply, but the problem is, there is no 93 characters, here is the line of code
cmd.hear(/^(?:pet)$/i, async (message, bot) => { - buster.Boyle commented on April 3rd 20 at 18:49
@Clark_Kuvalis, Here is the full part of the code
cmd.hear(/^(?:pet)$/i, async (message, bot) => {
message.user.foolder += 1;
if(message.user.misc.pet < 1) return t(`You have no pet. ${smileerror}`);
else {
return t(`information:
Pet: "${pets[message.user.misc.pet - 1].name}"
The cost of upgrade: ${utils.sp(petsupd[message.user.misc.pet - 1].cost*message.user.pet.lvl)}$
Level: ${message.user.pet.lvl}`, {
attachment: pets[message.user.misc.pet - 1].att
});
}

}); - buster.Boyle commented on April 3rd 20 at 18:52
The properties of the message.user.pet does not exist. - Clark_Kuvalis commented on April 3rd 20 at 18:55
April 3rd 20 at 18:48
No, the problem is not solvable.
This is a global problem, which affects all the community of JS developers.
You need to delete all code and write anew until the error disappears.
all 5206 lines of code to remove? - buster.Boyle commented on April 3rd 20 at 18:51
@buster.Boyle, Yes, once the whole project. - beth_Jacobs49 commented on April 3rd 20 at 18:54
"We need to remove all code and write anew until the error disappears." - buster.Boyle commented on April 3rd 20 at 18:57
@buster.Boyle, Yes, I said so. - beth_Jacobs49 commented on April 3rd 20 at 19:00

Find more questions by tags JavaScriptVKontakteBots