Skip to content

Commit a13d57e

Browse files
committed
Implement get_application_command
1 parent c098ca5 commit a13d57e

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

discord/bot.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ def add_application_command(self, command: ApplicationCommand) -> None:
106106
command: :class:`.ApplicationCommand`
107107
The command to add.
108108
"""
109-
110109
if self.debug_guilds and command.guild_ids is None:
111110
command.guild_ids = self.debug_guilds
112111
self._pending_application_commands.append(command)
@@ -132,6 +131,27 @@ def remove_application_command(
132131
"""
133132
return self.application_commands.pop(command.id)
134133

134+
def get_command(self, id: str, /) -> Optional[ApplicationCommand]:
135+
"""Get a :class:`.ApplicationCommand` from the internal list
136+
of commands.
137+
138+
.. versionadded:: 2.0
139+
140+
Parameters
141+
-----------
142+
id: :class:`str`
143+
The id of the command to get.
144+
145+
Returns
146+
--------
147+
Optional[:class:`ApplicationCommand`]
148+
The command that was requested. If not found, returns ``None``.
149+
"""
150+
151+
return self.application_commands.get(id)
152+
153+
get_application_command = get_command
154+
135155
async def sync_commands(self) -> None:
136156
"""|coro|
137157

0 commit comments

Comments
 (0)