Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions discord/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2529,6 +2529,38 @@ def search(
most_relevant=most_relevant,
)

async def user_installed_commands(self) -> List[Union[SlashCommand, UserCommand, MessageCommand]]:
"""|coro|

Returns a list of user-installed commands available.

.. versionadded:: 2.1

Raises
------
~discord.HTTPException
Getting the commands failed.

Returns
-------
List[Union[:class:`~discord.SlashCommand`, :class:`~discord.UserCommand`, :class:`~discord.MessageCommand`]]
A list of user-installed commands.
"""
state = self._state
data = await state.http.user_application_command_index()

cmds = data['application_commands']
apps = {int(app['id']): state.create_integration_application(app) for app in data.get('applications') or []}

result = []

for cmd in cmds:
_, cls = _command_factory(cmd['type'])
application = apps.get(int(cmd['application_id']))
result.append(cls(state=state, data=cmd, application=application))

return result

async def application_commands(self) -> List[Union[SlashCommand, UserCommand, MessageCommand]]:
"""|coro|

Expand Down