Skip to content

Fix Members.UpdateCurrentMember to return discord.Member#458

Merged
topi314 merged 1 commit intodisgoorg:masterfrom
norio-nomura:fix-update-current-member-to-return-discord-member
Jun 21, 2025
Merged

Fix Members.UpdateCurrentMember to return discord.Member#458
topi314 merged 1 commit intodisgoorg:masterfrom
norio-nomura:fix-update-current-member-to-return-discord-member

Conversation

@norio-nomura
Copy link
Contributor

According to the Discord OpenAPI spec, the /guilds/{guild_id}/members/@me endpoint, used by Members.UpdateCurrentMember, returns the same response structure as /users/@me/guilds/{guild_id}/member, which is used by OAuth2.GetCurrentMember and returns a discord.Member.

This fixes the following error caused by attempting to unmarshal into an incorrect response type:

error unmarshalling response body name=rest_client err="json: Unmarshal(nil string)" endpoint=/guilds/***********/members/@me code="200 OK" body="{"avatar":null,"...

According to the [Discord OpenAPI spec](https://github.com/discord/discord-api-spec/blame/c020f56f103767169d22e12d60f57c810ab98a8a/specs/openapi.json#L5121),
the `/guilds/{guild_id}/members/@me` endpoint, used by `Members.UpdateCurrentMember`,
returns the same response structure as `/users/@me/guilds/{guild_id}/member`,
which is used by `OAuth2.GetCurrentMember` and returns a `discord.Member`.

This fixes the following error caused by attempting to unmarshal into an incorrect response type:
```
error unmarshalling response body name=rest_client err="json: Unmarshal(nil string)" endpoint=/guilds/***********/members/@me code="200 OK" body="{"avatar":null,"...
```
@topi314 topi314 merged commit 0af01ec into disgoorg:master Jun 21, 2025
1 check passed
@topi314
Copy link
Member

topi314 commented Jun 21, 2025

good catch, thanks!

@norio-nomura norio-nomura deleted the fix-update-current-member-to-return-discord-member branch June 21, 2025 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants

Comments