discord.js icon indicating copy to clipboard operation
discord.js copied to clipboard

feat: Rename interaction methods

Open Syjalo opened this issue 2 years ago • 2 comments

Please describe the changes this PR makes and why it should be merged: This PR renames some interaction methods to not be confused.

Method Description
.reply() It is ok
.deferReply() It is ok
.fetchReply() -> .fetchResponse() With this method we can fetch not only interaction replies. If we do .update() or .deferUpdate() and then .fetchReply(), we will get the target message
.editReply() -> .editResponse() The same with .fetchReply()
.deleteReply() -> .deleteResponse() The same with .fetchReply()
.followUp() It is ok
.update() -> .updateMessage() When we call that method it looks like we update the interaction (interaction.update()), not the target message
.deferUpdate() -> .deferMessageUpdate() For consistency with .update()

Examples: Before

// This is ok
await interaction.reply();
await interaction.editReply();

await interaction.reply();
await interaction.deleteReply();

// This is confusing since we expect it can do an action only on interaction.reply()
await interaction.deferReply();
await interaction.editReply();

await interaction.update();
await interaction.editReply();

await interaction.update();
await interaction.deleteReply();

await interaction.deferUpdate();
await interaction.editReply();

After

await interaction.deferReply();
await interaction.editResponse();

await interaction.updateMessage();
await interaction.editResponse();

await interaction.updateMessage();
await interaction.deleteResponse();

await interaction.deferMessageUpdate();
await interaction.editResponse();

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 includes breaking changes (methods removed or renamed, parameters moved or removed)

Syjalo avatar Nov 11 '22 14:11 Syjalo

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

2 Ignored Deployments
Name Status Preview Updated
discord-js ⬜️ Ignored (Inspect) Nov 11, 2022 at 2:17PM (UTC)
discord-js-guide ⬜️ Ignored (Inspect) Nov 11, 2022 at 2:17PM (UTC)

vercel[bot] avatar Nov 11 '22 14:11 vercel[bot]

Codecov Report

Merging #8832 (987aa3b) into main (6e348ff) will increase coverage by 0.38%. The diff coverage is 87.62%.

@@            Coverage Diff             @@
##             main    #8832      +/-   ##
==========================================
+ Coverage   85.22%   85.61%   +0.38%     
==========================================
  Files          77       96      +19     
  Lines        6715     9459    +2744     
  Branches      877     1134     +257     
==========================================
+ Hits         5723     8098    +2375     
- Misses        953     1319     +366     
- Partials       39       42       +3     
Flag Coverage Δ
brokers 65.24% <ø> (?)
builders 98.65% <87.87%> (-1.35%) :arrow_down:
collection 100.00% <ø> (ø)
proxy 81.53% <ø> (ø)
rest 91.97% <82.35%> (?)
util 100.00% <ø> (ø)
utilities 100.00% <ø> (ø)
voice 63.70% <ø> (ø)
ws 59.83% <ø> (ø)

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

Impacted Files Coverage Δ
...ackages/rest/src/lib/handlers/SequentialHandler.ts 86.07% <50.00%> (ø)
packages/builders/src/components/Components.ts 87.87% <60.00%> (-12.13%) :arrow_down:
...ers/src/components/selectMenu/ChannelSelectMenu.ts 63.49% <63.49%> (ø)
...src/components/selectMenu/MentionableSelectMenu.ts 90.32% <90.32%> (ø)
...ilders/src/components/selectMenu/RoleSelectMenu.ts 90.32% <90.32%> (ø)
...ilders/src/components/selectMenu/UserSelectMenu.ts 90.32% <90.32%> (ø)
...ilders/src/components/selectMenu/BaseSelectMenu.ts 92.18% <92.18%> (ø)
packages/rest/src/lib/utils/utils.ts 97.33% <92.30%> (ø)
packages/builders/src/components/ActionRow.ts 100.00% <100.00%> (ø)
packages/builders/src/components/Assertions.ts 100.00% <100.00%> (ø)
... and 17 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Nov 11 '22 14:11 codecov[bot]