Skip to content

Commit 0b61301

Browse files
committed
Update client.py
1 parent a270337 commit 0b61301

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

discord_slash/client.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,23 @@ def __init__(self,
3535
self.auto_register = auto_register
3636
self._discord.add_listener(self.on_socket_response)
3737

38-
def slash(self, name: str = None, description: str = None, auto_convert: dict = None, guild_id: int = None):
38+
def slash(self,
39+
*,
40+
name: str = None,
41+
description: str = None,
42+
auto_convert: dict = None,
43+
guild_id: int = None,
44+
options: list = None):
3945
"""
4046
Decorator that registers coroutine as a slash command.\n
41-
1 arg is required for ctx(:class:`.model.SlashContext`), and if your slash command has some args, then those args are also required.\n
47+
All decorator args must be passed as keyword-only args.\n
48+
1 arg for command coroutine is required for ctx(:class:`.model.SlashContext`),
49+
and if your slash command has some args, then those args are also required.\n
4250
All args are passed in order.
4351
4452
.. note::
45-
Role, User, and Channel types are passed as id if you don't set ``auto_convert``, since API doesn't give type of the option for now.
53+
Role, User, and Channel types are passed as id if you don't set ``auto_convert``, since API doesn't give type of the option for now.\n
54+
Also, if ``options`` is passed, then ``auto_convert`` will be automatically created.
4655
4756
.. warning::
4857
Unlike discord.py's command, ``*args``, keyword-only args, converters, etc. are NOT supported.
@@ -72,6 +81,7 @@ async def _pick(ctx, choice1, choice2): # Command with 1 or more args.
7281
:param description: Description of the slash command. Default `None`.
7382
:param auto_convert: Dictionary of how to convert option values. Default `None`.
7483
:param guild_id: Guild ID of where the command will be used. Default `None`, which will be global command.
84+
:param options: Options of
7585
"""
7686
def wrapper(cmd):
7787
self.commands[cmd.__name__ if not name else name] = [cmd, auto_convert]

0 commit comments

Comments
 (0)