Remora / Remora.Discord

A data-oriented C# Discord library, focused on high-performance concurrency and robust design.
GNU Lesser General Public License v3.0
246 stars 44 forks source link

Remove global_name from User objects to comply with OpenAPI spec UserPIIResponse and UserResponse objects #316

Closed b-rad15 closed 10 months ago

b-rad15 commented 10 months ago

The spec as defined by https://github.com/discord/discord-api-spec/blob/main/specs/openapi.json Resolves issue #313 Wasn't sure how to mark it as intentionally left out so let me know if I should change that (or if anyone else wants to just fix it go for it). I also have generated patch files that could revert this once discord actually implements global_name fully, though I assume those could also be generate after the fact just from this pr.

MazeXP commented 10 months ago

The PR looks good to me!

Remark: The field is only not provided for webhooks as Discord is treating them not a valid user, not because it is not implemented

Discord docs under the definition of message object:

The author object follows the structure of the user object, but is only a valid user in the case where the message is generated by a user or bot user. If the message is generated by a webhook, the author object corresponds to the webhook's id, username, and avatar. You can tell if a message is generated by a webhook by checking for the webhook_id on the message object.

aPinat commented 8 months ago

I feel like there should've been a different solution for #313 than removing it outright, as this name as a user's display name is commonly used and there is no other way to get it now.

Discord themselves say to follow the docs instead of the OpenAPI spec as well, as it is still in preview.

This is a preview and it may be not correct. If you find discrepancies between the spec and our docs, other than the ones mentioned below, let us know, and follow the docs, not the spec.