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

feat: Rename interaction methods #8832

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

Conversation

Syjalo
Copy link
Contributor

@Syjalo Syjalo commented Nov 11, 2022

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)

@vercel
Copy link

vercel bot commented Nov 11, 2022

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

Name Status Preview Comments Updated (UTC)
discord-js ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 22, 2024 6:14pm
discord-js-guide ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 22, 2024 6:14pm

@codecov
Copy link

codecov bot commented Nov 11, 2022

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%) ⬇️
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%) ⬇️
...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

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

@Jiralite Jiralite added this to the discord.js 15.0.0 milestone Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants