Почему возникает ошибка TypeError: Cannot read properties of undefined (reading 'map')

Фрагмент кода

const possibleLinks = m.user.presence.activities.map((a) => [ a.state, a.details, a.name ]).flat();
const inviteLinks = possibleLinks.filter((l) => /(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(l));
if(inviteLinks.length > 0) {

Ошибка

const possibleLinks = m.user.presence.map((a) => [ a.state, a.details, a.name ]).flat();
                                                              ^

TypeError: Cannot read properties of undefined (reading 'map')

Нужно было что-бы написалась информация о инвайт ссылке


Ответы (0 шт):