-
Notifications
You must be signed in to change notification settings - Fork 185
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: add support for user-installable apps #1647
Conversation
New error I'm getting as of today when responding to application commands Traceback (most recent call last):
File "D:\Scratch\Documents\Git\June\Lib\site-packages\interactions\client\client.py", line 1917, in __dispatch_interaction
response = await callback
^^^^^^^^^^^^^^
File "D:\Scratch\Documents\Git\June\Lib\site-packages\interactions\client\client.py", line 1785, in _run_slash_command
return await command(ctx, **ctx.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Scratch\Documents\Git\June\Lib\site-packages\interactions\models\internal\command.py", line 132, in __call__
await self.call_callback(self.callback, context)
File "D:\Scratch\Documents\Git\June\Lib\site-packages\interactions\models\internal\application_commands.py", line 841, in call_callback
return await self.call_with_binding(callback, ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Scratch\Documents\Git\June\Lib\site-packages\interactions\models\internal\callback.py", line 44, in call_with_binding
return await callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Scratch\Documents\Git\June\bot-test.py", line 21, in idacUpdateRoles
await ctx.send("update command issued", ephemeral=True)
File "D:\Scratch\Documents\Git\June\Lib\site-packages\interactions\models\internal\context.py", line 565, in send
return await super().send(
^^^^^^^^^^^^^^^^^^^
File "D:\Scratch\Documents\Git\June\Lib\site-packages\interactions\client\mixins\send.py", line 123, in send
message = self.client.cache.place_message_data(message_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Scratch\Documents\Git\June\Lib\site-packages\interactions\client\smart_cache.py", line 436, in place_message_data
message = Message.from_dict(data, self._client)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Scratch\Documents\Git\June\Lib\site-packages\interactions\models\discord\base.py", line 36, in from_dict
data = cls._process_dict(data, client)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Scratch\Documents\Git\June\Lib\site-packages\interactions\models\discord\message.py", line 559, in _process_dict
data["interaction_metadata"] = MessageInteractionMetadata.from_dict(data["interaction_metadata"], client)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Scratch\Documents\Git\June\Lib\site-packages\interactions\models\discord\base.py", line 37, in from_dict
return cls(client=client, **cls._filter_kwargs(data, cls._get_init_keys()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: MessageInteractionMetadata.__init__() missing 1 required keyword-only argument: 'user_id' |
They changed the payload recently, yes. I'll fix it soon. |
This PR, as well as the branch, has been rebased. The bug mentioned above should also be fixed. |
Not sure how I feel about the names.
Another rebase has been done to match the branch closely with 5.12.0. It's unlikely that I'll do any more rebases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ship it
Pull Request Type
Description
This PR adds support for user-installable applications, allowing developers to let users install the bot to themselves to use as they wish. This also adds many fields related to user-installable applications and fixes a few bugs out of necessity.
Changes
The scope of this PR is quite large, even with ta set scope in mind. That being said, here's a summary:
contexts
andintegration_types
toInteractionCommand
and its related decorators.dm_permission
has been depreciated and is no longer serialized - instead, it is converted to itscontexts
equivalent.contexts
.@contexts
and@integration_types
decorators to make specifying them easy.dm_permission
section) to explain these two.authorizing_integration_owners
andcontext
toBaseInteractionContext
.interaction_metadata
toMessage
and note deprecation ofinteraction
field.integration_types_config
toApplication
, although this is extremely basic.Possible things to consider:
@contexts
be renamed to something else for clarity?disable_dm_commands
be added toClient
for the newcontexts
andintegration_types
?Related Issues
#1634
Test Scenarios
Python Compatibility
3.10.x
3.11.x
Checklist
pre-commit
code linter over all edited files