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

refactor(Emoji)!: make imageURL() changing extension dynamically #10613

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Idris1401
Copy link
Contributor

Please describe the changes this PR makes and why it should be merged:

I think it'd be better if Emoji#imageURL() changes the extension dynamically as others ...URL() functions.

Status and versioning classification:

  • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)

@Idris1401 Idris1401 requested a review from a team as a code owner November 23, 2024 19:06
Copy link

vercel bot commented Nov 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
discord-js ⬜️ Ignored (Inspect) Visit Preview Dec 12, 2024 2:17pm
discord-js-guide ⬜️ Ignored (Inspect) Visit Preview Dec 12, 2024 2:17pm

kyranet
kyranet previously requested changes Dec 9, 2024
packages/discord.js/src/structures/Emoji.js Outdated Show resolved Hide resolved
@Idris1401 Idris1401 requested a review from kyranet December 17, 2024 16:53
@@ -46,7 +46,7 @@ class Emoji extends Base {
* @returns {?string}
*/
imageURL(options) {
return this.id && this.client.rest.cdn.emoji(this.id, options);
return this.id && this.client.rest.cdn.emoji(this.id, this.animated ? { extension: 'gif', ...options } : options);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, while this works, it might be worth adding support for the forceStatic option like the other dynamic image URL methods

You'd have to change the parameter type to ImageURLOptions and handle the forceStatic option here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about adding an animated option for the emoji function in /rest?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Review in Progress
Development

Successfully merging this pull request may close these issues.

4 participants