E
E
egorlisss2019-05-22 13:21:59
JavaScript
egorlisss, 2019-05-22 13:21:59

How to fix Cannot read property 'message' of undefined error?

vk.updates.hear(/^(?:\/badge)\s([^]+)?/i, async (message) => {
  badge[message.$match[2]].message.$match[1] = message.$match[3]
    return message.send(`Значение для значка message.$match[1] для [id${message.$match[2]}|Пользователя] установлено на ${message.$match[3]}`); 
});

M2UGVvdFaAQ.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2019-05-22
@egorlisss

Check what exists before accessing its properties. badge[message.$match[2]]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question