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

lib: fix always returning png in gs.IconURL #1523

Merged
merged 2 commits into from
Jul 3, 2023

Conversation

l-zeuch
Copy link
Contributor

@l-zeuch l-zeuch commented Jun 30, 2023

I've noticed during testing with an animated guild icon that
.Guild.IconURL always returns a static png. It can be argued that
this is a sort of regression in comparison to the old way, which #1519
attempted to get rid of.

Unfortunately I wasn't able to test with an animated guild icon during
the development of the above mentioned pull request because I refuse
to give Discord money
, because such a guild wasn't available to me at
that time.

I've decided to implement a new endpoint in discordgo that returns the
gif version of the guild icon. Furthermore, I've modified dstate's
GuildSet.IconURL to make use of that new endpoint if it finds indication
that the guild icon is animated.

It'd be really cool if we can get this in before the scheduled release on
monday as a sort of hotfix, but it's not that urgent.


This is a combination of two commits:

  • lib/discordgo: add EndpointGuildIconAnimated

    Add a new endpoint EndpointGuildIconAnimated to retrieve a gif version
    of the guild icon.

    We're going to use this in a future commit to fix a small (but
    non-critical) oversight in dstate's GuildSet.IconURL function, which
    currently only ever returns the guild's icon as a png.

  • lib/dstate: also support gifs in GuildSet.IconURL

    Make use of the previously added EndpointGuildIconAnimated endpoint
    in discordgo, to stop always giving back a png, regardless of
    whether the icon is animated.

Signed-off-by: Luca Zeuch [email protected]

l-zeuch added 2 commits June 30, 2023 20:04
Add a new endpoint EndpointGuildIconAnimated to retrieve a gif version
of the guild icon.

We're going to use this in a future commit to fix a small (but
non-critical) oversight in dstate's GuildSet.IconURL function, which
currently only ever returns the guild's icon as a png.

Signed-off-by: Luca Zeuch <[email protected]>
Make use of the previously added EndpointGuildIconAnimated endpoint in
discordgo, to stop always giving back a png, regardless of whether the
icon is animated.

Signed-off-by: Luca Zeuch <[email protected]>
@ashishjh-bst ashishjh-bst merged commit f3b0ee5 into botlabs-gg:dev Jul 3, 2023
@l-zeuch l-zeuch deleted the fix/animated-guild-icon branch July 3, 2023 06:31
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

Successfully merging this pull request may close these issues.

2 participants