TypeError: Невозможно прочитать свойство 'oldRole' из неопределенного - PullRequest
0 голосов
/ 29 марта 2019

Я делаю роботов с рейтингом «Роблокс-Дисорд», но внезапно он говорит, что роли не определены.

roblox.promote(4722985, id)
    .then(function(roles){
        console.log(roles);
        var embeds = new Discord.RichEmbed()
            .setTitle("Successfully promoted user")
            .setDescription(`User promoted from ${roles.oldRole.Name} to ${roles.newRole.Name}`)
            .setColor(`#00ff26`)
            .setThumbnail(`https://www.roblox.com/headshot-thumbnail/image?userId=${id}&width=100&height=100&format=png`)

        message.channel.send(embeds)

        let logs = message.guild.channels.find('name', 'ranking-logs');
        var Mod1 = message.author;
        var reason = args.slice(2).join(" ")             
        var logembed = new Discord.RichEmbed()
              .setAuthor(Mod1.tag)
              .setColor('BLACK')
              .setDescription('User has been promoted through Discord.\n\nModerator: `'
                  + Mod1.tag + '`\nROBLOX User: `' + username
                  + '`\nRanked From:`' + roles.oldRole.Name
                  + '`\nRanked To:`' + roles.newRole.Name
                  + '`\nReason:`' + reason + '`')
              .setThumbnail(`https://www.roblox.com/headshot-thumbnail/image?userId=${id}&width=100&height=100&format=png`)
          logs.send(logembed)

      }).catch(function(err){
...