lib: fix always returning png in gs.IconURL #1523
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've noticed during testing with an animated guild icon that
.Guild.IconURL
always returns a static png. It can be argued thatthis 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, because such a guild wasn't available to me atto give Discord money
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]