Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing a a guild member's nickname fails #170

Open
georgeenciu opened this issue Dec 4, 2021 · 1 comment
Open

changing a a guild member's nickname fails #170

georgeenciu opened this issue Dec 4, 2021 · 1 comment

Comments

@georgeenciu
Copy link

Hello,

I noticed that calling modifyGuildMember just for changing a user's nick name will fail as restcord will add the other non required params which will make the following code

    public function modifyMemberNickname($memberId, \User\Entity\User $user)
    {
        $params = [
            'guild.id' => $this->config['guild']['id'],
            'user.id' => $memberId,
            'nick' => sprintf('%s - %s', $user->getFullName(),  $user->getUsername()),
        ];
        return $this->discord->guild->modifyGuildMember($params);
    }

return an error:

Request body

PATCH /api/v6/guilds/11111111111111111/members/1111111111111111 HTTP/1.1 
Content-Length: 44 
Authorization: Bot <TOKEN> 
User-Agent: DiscordBot (https://github.com/aequasi/php-restcord, 0.1.1) 
Host: discord.com 
Content-Type: application/json  

{"nick":"George - 1364858","mute":false,"deaf":false} 

Response Body

HTTP/1.1 400 Bad Request 
Date: Sat, 04 Dec 2021 10:50:32 GMT
Content-Type: application/json
Content-Length: 68 

{"message": "Target user is not connected to voice.", "code": 40032}

Is there a workaround for this?
Thank you!

@LeigerGaming
Copy link

Try removing the mute and deaf keys as they are not required (I see it in the request body example, but not in your original code snippet). The message about not being connected to voice makes me think it might be related to that.

However, I just tried to change a nickname myself to test if it's working for me, and came across a different issue - despite the bot having MANAGE_NICKNAMES permission, I'm getting a 403 Forbidden response. Weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants