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

feat: user-installable apps

Open Syjalo opened this issue 1 year ago • 13 comments
trafficstars

Please describe the changes this PR makes and why it should be merged: This PR adds support for User-Installable Apps

Depends on:

  • https://github.com/discord/discord-api-docs/pull/6723
  • https://github.com/discord/discord-api-docs/pull/6765
  • https://github.com/discord/discord-api-docs/pull/6782
  • https://github.com/discord/discord-api-docs/pull/7070

This PR will be in Draft status during the preview state of User-Installable Apps

Status and versioning classification:

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

Syjalo avatar Apr 24 '24 19:04 Syjalo

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 Sep 1, 2024 8:40pm
discord-js-guide ⬜️ Ignored (Inspect) Visit Preview Sep 1, 2024 8:40pm

vercel[bot] avatar Apr 24 '24 19:04 vercel[bot]

this pr does not close #10215 btw, this updates discord.js but not the builders (the linked issue only requested it for builders)

SuperchupuDev avatar May 04 '24 21:05 SuperchupuDev

This is a draft. It is not finalised yet.

Jiralite avatar May 04 '24 21:05 Jiralite

i know, just pointing it out as the description isnt accurate right now 🤷‍♀️

SuperchupuDev avatar May 04 '24 21:05 SuperchupuDev

@Syjalo Discord said the user-installable apps will come out of beta on June 18th, can I help with something to get this pr done?

GeekCornerGH avatar Jun 12 '24 05:06 GeekCornerGH

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 35.45%. Comparing base (4374374) to head (b2e0d7d). Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10227   +/-   ##
=======================================
  Coverage   35.45%   35.45%           
=======================================
  Files         228      228           
  Lines       14319    14319           
  Branches     1254     1254           
=======================================
  Hits         5077     5077           
  Misses       9198     9198           
  Partials       44       44           
Flag Coverage Δ
builders 91.58% <ø> (ø)

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jul 09 '24 19:07 codecov[bot]

https://github.com/discordjs/discord.js/blob/efa16a6095e012ff4d138b21d128df5f407fc93c/packages/discord.js/src/client/actions/InteractionCreate.js#L50 stops MessageComponentInteractions to happen in PartialGroupDMChannel; they don‘t qualify as isTextBased() because that checks for a .messages Manager to exist which is not the case for group DM channel.

So that check probably needs to be changed for user apps to work

Qjuh avatar Jul 14 '24 09:07 Qjuh

channel will be true there with Partials.Channel. Sad. It looks like that will also affect InteractionType.ApplicationCommand -> ApplicationCommandType.Message.

Since it's already working fine without that partial, a fix could be to exit out if channel is defined and it's the partial group direct message channel.

Would probably need to update this too then to be ?(TextBasedChannels|PartialGroupDMChannel):

https://github.com/discordjs/discord.js/blob/efa16a6095e012ff4d138b21d128df5f407fc93c/packages/discord.js/src/structures/BaseInteraction.js#L130-L137

However, I'm pretty sure widening the scope of a type would be a breaking change...

Welcoming thoughts.

Jiralite avatar Jul 14 '24 12:07 Jiralite

https://github.com/discordjs/discord.js/blob/efa16a6095e012ff4d138b21d128df5f407fc93c/packages/discord.js/src/client/actions/InteractionCreate.js#L50

stops MessageComponentInteractions to happen in PartialGroupDMChannel; they don‘t qualify as isTextBased() because that checks for a .messages Manager to exist which is not the case for group DM channel. So that check probably needs to be changed for user apps to work

We probably should add a .messages property as MessageManager to PartialGroupDMChannel because https://github.com/discordjs/discord.js/blob/bf6761a44adec1fe5017f6bf5d8bc0734916961f/packages/discord.js/src/structures/Webhook.js#L232 for example also needs that to exist (getting called from <Interaction>.followUp(…)) and would even add a Message to it…

Qjuh avatar Jul 25 '24 18:07 Qjuh

This could be implemented in this pull request:

  • https://github.com/discord/discord-api-docs/pull/7070

almeidx avatar Aug 14 '24 22:08 almeidx

I just wanted to confirm if this also fixes the issue with group dm's message context menu interactions not triggering the interaction event in discord.js? Or do I need to open an issue for that?

image image image

23brewert avatar Aug 24 '24 03:08 23brewert

I just wanted to confirm if this also fixes the issue with group dm's message context menu interactions not triggering the interaction event in discord.js?

It will

Qjuh avatar Aug 24 '24 05:08 Qjuh

Well..this explains why my commands don't show up as a user installed bot.

Please get this in and released asap, this is badly needed!

beyondmeat avatar Aug 26 '24 12:08 beyondmeat