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(formatters): Add support for object and name param in formatEmoji() #10076

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

Conversation

codershiba
Copy link

@codershiba codershiba commented Jan 7, 2024

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

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR changes the library's interface (methods or parameters added)

Copy link

vercel bot commented Jan 7, 2024

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

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
discord-js ⬜️ Ignored (Inspect) Visit Preview Jan 8, 2024 5:05pm
discord-js-guide ⬜️ Ignored (Inspect) Visit Preview Jan 8, 2024 5:05pm

@sdanialraza
Copy link
Contributor

There's some formatting and linting issues, could you please fix them? And it'd be nice if you added tests for the changes

packages/formatters/src/formatters.ts Outdated Show resolved Hide resolved
packages/formatters/src/formatters.ts Outdated Show resolved Hide resolved
packages/formatters/src/formatters.ts Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jan 7, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (0f1e02b) 58.36% compared to head (c2d37f0) 58.44%.
Report is 3 commits behind head on main.

Files Patch % Lines
packages/formatters/src/formatters.ts 95.55% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10076      +/-   ##
==========================================
+ Coverage   58.36%   58.44%   +0.08%     
==========================================
  Files         242      242              
  Lines       17184    17224      +40     
  Branches     1243     1245       +2     
==========================================
+ Hits        10029    10067      +38     
- Misses       7110     7112       +2     
  Partials       45       45              
Flag Coverage Δ
builders 95.53% <ø> (ø)
formatters 99.10% <95.55%> (-0.18%) ⬇️
next ∅ <ø> (∅)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

packages/formatters/src/formatters.ts Outdated Show resolved Hide resolved
packages/formatters/src/formatters.ts Outdated Show resolved Hide resolved
packages/formatters/src/formatters.ts Outdated Show resolved Hide resolved
packages/formatters/src/formatters.ts Outdated Show resolved Hide resolved
packages/formatters/src/formatters.ts Outdated Show resolved Hide resolved
emojiId,
animated,
name,
}: Required<FormatEmojiOptions<EmojiId, Name>>): `<:${Name}:${EmojiId}>` | `<a:${Name}:${EmojiId}>`;
Copy link
Member

@Jiralite Jiralite Jan 7, 2024

Choose a reason for hiding this comment

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

Looks like more overloads will be required for the specific results here. This is more of a general one.

packages/formatters/src/formatters.ts Outdated Show resolved Hide resolved
@jaw0r3k
Copy link
Contributor

jaw0r3k commented Jan 7, 2024

emojiId is a required parameter, so no need to pass it in options

I would do:

formatEmoji(emojiId: Snowflake, animatedOrOptions?: boolean | { name?: string, animated?: boolean } )

and animated parameter is deprecated as we recommend to use options

packages/formatters/src/formatters.ts Outdated Show resolved Hide resolved
packages/formatters/src/formatters.ts Outdated Show resolved Hide resolved
packages/formatters/src/formatters.ts Outdated Show resolved Hide resolved
@sdanialraza
Copy link
Contributor

Just needs more overloads as Jiralite said here, other than that, looks good

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.

Emoji.toString() doesn't contain the name anymore
4 participants