bot.on('messageCreate', (message) => {
if (message.author.bot) return;
let roles = "";
message.member.roles.cache.map((role) => {
roles += role.name + ", ";
});
console.log(roles); // Вывод: "@Роль1, @Роль2, @everyone"
});
bot.on('message', async (message) => {
if (message.content.startsWith('!myroles')){
let arr = []
message.member.roles.cache.forEach(r => {
arr.push(r)
})
message.channel.send(arr.join(', '))
}
})