feat: user-installable apps
Installation & Testing
If you're looking to try this out, use the following:
pip install git+https://github.com/Pycord-Development/pycord@feat/ua
Note that this is still a preview from Discord, and things may be subject to change.
Summary
https://discord.com/developers/docs/change-log#userinstallable-apps-preview
Information
- [ ] This PR fixes an issue.
- [x] This PR adds something new (e.g. new method or parameters).
- [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed).
- [ ] This PR is not a code change (e.g. documentation, README, typehinting, examples, ...).
Checklist
- [x] I have searched the open pull requests for duplicates.
- [x] If code changes were made then they have been tested.
- [x] I have updated the documentation to reflect the changes.
- [ ] If
type: ignorecomments were used, a comment is also left explaining why. - [x] I have updated the changelog to include these changes.
tested on production nothing broke greatest feeling ever
Was just thinking about this, but some bots have a lot of commands and it might be hard to change all of them to support this This could be solved by wrapping the command decorators, however, that's rather inconvenient
My idea is I add 2 parameters to Bot that act as defaults for contexts and integration_types, similar to debug_guilds, possibly named default_command_contexts and default_command_integration_types respectively
Lmk your thoughts and if nobody opposes I'll implement it later tomorrow
that wasn't supposed to happen
We should also make a guide for it maybe
We should also make a guide for it maybe
not my problem :)
I've been testing this PR out today, and all's good except for this weird issue. I use custom emojis for almost all of my commands and everything's fine when using them normally in a guild the bot is in. However, if I'm using the user-installed app part of it, some commands don't show the emoji at all. I've got 0 idea why this is happening or how to exactly replicate it.
I've been testing this PR out today, and all's good except for this weird issue. I use custom emojis for almost all of my commands and everything's fine when using them normally in a guild the bot is in. However, if I'm using the user-installed app part of it, some commands don't show the emoji at all. I've got 0 idea why this is happening or how to exactly replicate it.
@Lulalaby ?
I've been testing this PR out today, and all's good except for this weird issue. I use custom emojis for almost all of my commands and everything's fine when using them normally in a guild the bot is in. However, if I'm using the user-installed app part of it, some commands don't show the emoji at all. I've got 0 idea why this is happening or how to exactly replicate it.
I'd expect that to be a Discord issue, this pr shouldn't mess with emojis at all
@Vondyy @plun1331 @JustaSqu1d This is a purpose-discord-limitation "Use External Emojis" is not allowed discord-wide for user app commands. Mainly because of the nitro gate for users. I can't give you more details about it tho, since it's not public
Makes sense other than the fact that 99 percent of my user app commands are using custom emojis fine. When no one is in the custom emoji server. So it's not like all of them isn't working, which is confusing.
Marking this as a draft until Discord takes this out of preview (soon™️)
This will still take a while, since the PO is currently ill
This will still take a while, since the PO is currently ill
hope they get well soon™️
~~ref. https://discord.com/channels/881207955029110855/881735314987708456/1231382350324301906~~ fixed with 4f56ea5
I have been working with this PR and when working with message commands the channel is not being set properly. I also tested on master and did not get this issue so I believe it is in the PR.
No matter if the message command is used in a guild or a DM the channel is always set to the DM channel between the bot and my user. This also leads to the guild being set to None. I confirmed via debug logging that Discord is sending the correct information.
I am willing to test any changes.
I have been working with this PR and when working with message commands the channel is not being set properly. I also tested on master and did not get this issue so I believe it is in the PR.
No matter if the message command is used in a guild or a DM the channel is always set to the DM channel between the bot and my user. This also leads to the guild being set to None. I confirmed via debug logging that Discord is sending the correct information.
I am willing to test any changes.
If you'd like to contribute you can make a PR, just target the feat/ua branch
The problem is I looked at the code for about an hour and could not figure out what is causing the bug 😅
classic
No matter if the message command is used in a guild or a DM the channel is always set to the DM channel between the bot and my user. This also leads to the guild being set to None.
This is a pretty weird bug, as this PR makes no changes to how channel/guild is being set when interactions are received Can you double check that this isn't occurring on master as well?
I have checked again and it appears to work on master but not on this PR. I checked the difference between the interaction payload that I received The only differences were
- The addition of
d.context(value0) - The addition of
d.authorizing_integration_owners(value{1: my_user_id}) - A change in app permissions as I used 2 different bots, but this should have no effect
@Icebluewolf does it only affect context menu commands of the type message?
I am not entirely sure what you mean as User Apps cannot fetch messages as far as I am aware. When running
m = await ctx.respond(embed=await view.create_embed(), view=view)
m = await m.original_response()
The correct channel and guild are set. I am not sure of any other ways to obtain a message within the context of a user app.
I'm asking where the problem occurs. In which type of interaction.
"No matter if the message command is used in a guild or a DM the channel is always set to the DM channel between the bot and my user. This also leads to the guild being set to None."
The wrong channel is set on the message returned from only message commands from my testing. It is wrong when the message command is used in a guild or a DM with another user.
However discord.ApplicationContext.channel is correctly set within a message command.
It looks like the problem is here: https://github.com/Pycord-Development/pycord/blob/830c7a0e8285c6d0849c5288ef19dc1dafb059d2/discord/commands/core.py#L1853-L1866 if the channel is not cached, the library creates a DM channel and adds it to cache (not ideal) I will probably change this to be a PartialMessageable, as defaulting to a DM channel doesn't make sense (at least not anymore)
Uh.. Y'all are aware that discord sends the whole channel object in the interaction..?
Unless im mistaken.
They do. d.channel has a complete channel object. At least for message command interactions.
Then let's just construct from that instead of relaying on cache
That's very odd, because I already implemented Interaction.channel last year in #2025... if I had to guess, I neglected to update invoke to support this