Since Discord does not dispatch this information in the gateway, the library cannot provide this information.
Since Discord does not dispatch this information in the gateway, the library cannot provide this information.
This is currently a Discord limitation.
This is currently a Discord limitation.
@ -361,14 +373,18 @@ to a message. Example::
Why do my arguments require quotes?
Why do my arguments require quotes?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In a simple command defined as: ::
In a simple command defined as:
..code-block:: python3
@bot.command()
@bot.command()
async def echo(ctx, message: str):
async def echo(ctx, message: str):
await ctx.send(message)
await ctx.send(message)
Calling it via ``?echo a b c`` will only fetch the first argument and disregard the rest. To fix this you should either call
Calling it via ``?echo a b c`` will only fetch the first argument and disregard the rest. To fix this you should either call
it via ``?echo "a b c"`` or change the signature to have "consume rest" behaviour. Example: ::
it via ``?echo "a b c"`` or change the signature to have "consume rest" behaviour. Example:
..code-block:: python3
@bot.command()
@bot.command()
async def echo(ctx, *, message: str):
async def echo(ctx, *, message: str):
@ -382,7 +398,9 @@ How do I get the original ``message``\?
The :class:`~ext.commands.Context` contains an attribute, :attr:`~.Context.message` to get the original
The :class:`~ext.commands.Context` contains an attribute, :attr:`~.Context.message` to get the original
message.
message.
Example: ::
Example:
..code-block:: python3
@bot.command()
@bot.command()
async def length(ctx):
async def length(ctx):
@ -394,7 +412,9 @@ How do I make a subcommand?
Use the :func:`~ext.commands.group` decorator. This will transform the callback into a :class:`~ext.commands.Group` which will allow you to add commands into
Use the :func:`~ext.commands.group` decorator. This will transform the callback into a :class:`~ext.commands.Group` which will allow you to add commands into
the group operating as "subcommands". These groups can be arbitrarily nested as well.
the group operating as "subcommands". These groups can be arbitrarily nested as well.