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(ChatInputCommandInteraction): use slash command mention instead of a string representation #8532

Closed
wants to merge 1 commit into from

Conversation

GodderE2D
Copy link
Contributor

PR blocked

Can be merged once API docs PR is merged.


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

As all the other classes (e.g. User, TextChannel, Role) follows the documented message formatting for formatting in .toString(), the slash command interactions should too.

This PR replaces the old functionality which returns a string representation that can be pasted into the client to use a slash command, however, is client-sided only and not documented.

  • Old: <ChatInputCommandInteraction>.toString() -> /pet user:1234567890123456789
  • New: <ChatInputCommandInteraction>.toString() -> </pet:9876543210987654321>

Client preview:

image

This PR also adds a new method to builders, chatInputMention(), which implements the new functionality mentioned above.

Since this replaces the functionality of the same method, this is a breaking change and is a major for discord.js (only a minor for @discordjs/builders).

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

@vercel
Copy link

vercel bot commented Aug 20, 2022

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

1 Ignored Deployment
Name Status Preview Updated
discord-js ⬜️ Ignored (Inspect) Aug 20, 2022 at 10:03PM (UTC)

@Jiralite
Copy link
Member

Isn't this #8280?

@GodderE2D
Copy link
Contributor Author

Isn't this #8280?

Yeah, I just realised that after opening. Didn't realise there was already a PR when I was searching if there already was one.

@GodderE2D GodderE2D closed this Aug 20, 2022
@Jiralite Jiralite added this to the discord.js v14.3 milestone Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants