noblox / noblox.js

A Node.js API wrapper for Roblox.
https://noblox.js.org
MIT License
250 stars 140 forks source link

[BUG] setRank no longer returning new role #120

Closed joshua-philip closed 4 years ago

joshua-philip commented 4 years ago

Describe the bug Basically, I'm trying to use the ${newRole.Name} feature but it's not working. The logs say "TypeError: Cannot read property 'Name' of undefined"

The code I'm using this in is:

        if (username){
            message.channel.send(`Checking ROBLOX for ${username}`)
            roblox.getIdFromUsername(username)
            .then(function(id){
                roblox.getRankInGroup(groupId, id)
                .then(function(rank){
                    if(maximumRank <= rank){
                        message.channel.send(`${id} is rank ${rank} and not promotable.`)
                    } else {
                        message.channel.send(`${id} is rank ${rank} and promotable.`)
                        roblox.setRank(groupId, id, rankIdentifier)
                        .then(function(newRole){
                            message.channel.send(`Changed rank to ${newRole.Name}`)
                        }).catch(function(err){
                            console.error(err)
                            message.channel.send("Failed to change rank.")
                        });

Expected behavior I believed that this would have the bot say the user's current rank, but it goes to the error statement.

suufi commented 4 years ago

Hi! This was a mistake on my part when I was updating setRank. It has been reimplemented with commit cb3bf7bdf696acf92c314673ee980ea06bbd6c96.