Visitar URL original
BannerUrl is always null · Issue #2051 · DSharpPlus/DSharpPlus · GitHub
Skip to content

BannerUrl is always null #2051

Open
Open

Description

@SlimeBluKing

Summary

BannerUrl from the DiscordUser class is always null, even if the target has Nitro.

What version of the library are you using?

v5.0.0-nightly (make sure you are using the latest nightly!)

What .NET version are you using? Make sure to use the latest patch release for your major version.

.NET 8.0

Operating System

Windows 11 23H2 (Build 22631.3880)

Reproduction Steps

Get BannerUrl form a DiscordUser
image
image

Trace Logs

No response

Exceptions or other error messages

No response

Anything else you'd like to share

No response

Activity

  1. Erisa commented on Jul 29, 2024

    @Erisa
    Contributor

    As far as I can tell:

    The reason BannerUrl is null is because BannerHash is null - when you read a user from cache without any REST calls, this always seems to be the case. If you force cache the user with e.g. await ctx.Client.GetUserAsync(user.Id, true); then they have a banner hash and URL. So that is one workaround, and indicates the correct data is served by REST.

    When poking around in Gateway events I got as deep as

    GatewayPayload payload = await this.eventReader.ReadAsync();

    and that payload, specifically in members and in the case of a guild create I tested, also gives null banners (and yes, my user does have a banner):

    Given how raw this is it would make me think Discord is providing null banner hash entries over gateway that are getting cached? But I don't know how the other gateway logic works enough to know for sure if that's just a red herring or not.

    EDIT: In fact, avatar at that stage is null, so it may indeed be a red herring 🤷‍♀️

  2. SlimeBluKing commented on Jul 30, 2024

    @SlimeBluKing
    Author

    Understood

  3. Naamloos commented on Jul 31, 2024

    @Naamloos
    Member

    Keep this open for now, this could very well be a bug with cache.

    Banner and Avatar are optional fields that are not always sent by Discord. It is not unlikely our cache somehow picks this up as "the banner or avatar being removed".

    Honestly, this could very well be an issue caused by library "design"

  4. Naamloos commented on Jul 31, 2024

    @Naamloos
    Member

    I am not 100% sure, but since banner and avatar can both either be "absent" or "empty" and the library returns both of these as "null" to the end user, I think it could very well be a cache oopsie

  5. SlimeBluKing commented on Aug 3, 2024

    @SlimeBluKing
    Author

    I am not 100% sure, but since banner and avatar can both either be "absent" or "empty" and the library returns both of these as "null" to the end user, I think it could very well be a cache oopsie

    maybe...

  6. added this to the v5.0 milestone on Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    Effort

    None yet

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions