44 Commits

Author SHA1 Message Date
Rapptz
bd19ad05e7 Fix app_command_completion triggering on certain errors 2022-08-16 20:03:02 -04:00
Rapptz
1a11c9eeee [commands] Properly set module information for hybrid commands 2022-08-16 01:28:27 -04:00
Puncher
44abc469f1
[commands] Remove unused with_command HybridCommand parameter 2022-08-07 17:20:02 -04:00
Rapptz
2d586ae805 Add initial support for app command localisation 2022-08-05 22:35:30 -04:00
Bryan Forbes
d707019348
Bump Pyright to 1.1.265, fix type errors, and remove unnecessary ignores 2022-08-04 22:46:02 -04:00
Rapptz
5527de688a Fix Python 3.10 __or__ not working with transformers
Fixes #8214
2022-07-30 04:48:26 -04:00
Rapptz
11618cd1ba Refactor transformers to use instances instead of classmethods
This should allow them to be easier to use for users without requiring
a lot of metaprogramming hackery if you want to involve state.
2022-07-30 04:40:28 -04:00
Rapptz
c43d302a28 [commands] Only call hybrid after_invoke hooks if the command is called
Fix #8276
2022-07-29 21:39:23 -04:00
apple502j
b95db674c0
Fix some typos 2022-06-27 22:34:45 -04:00
Josh
c9f777c873
Fix type annotations to adhere to latest pyright release 2022-06-12 15:30:45 -04:00
Rapptz
06c43d6772 [commands] Add support for NSFW commands for hybrid commands 2022-05-22 19:31:28 -04:00
Rapptz
6e2fcd4762 [commands] Assign current parameter and argument in hybrid commands 2022-05-12 06:36:19 -04:00
Rapptz
6d55b96fa7 [commands] Fix unsupported discord converters in hybrid commands
These are things that are supported in regular commands but not in
application commands, such as discord.Colour, discord.Game, or
discord.Emoji.
2022-05-11 20:14:39 -04:00
Rapptz
06e8683d01 [commands] Fix flag_converter attribute not being properly copied 2022-05-11 03:30:20 -04:00
Rapptz
15ceca1e63 [commands] Add support for FlagConverter in hybrid commands
This works by unpacking and repacking the flag arguments in a flag.
If an unsupported type annotation is found then it will error at
definition time.
2022-05-11 03:15:57 -04:00
Rapptz
bd3ce597e1 [commands] Fix app command children not being copied in HybridGroup
This degenerate case is only triggered inside cogs when using the
app_command property to define commands, such as this:

    class X(commands.Cog):
        @commands.hybrid_group()
        async def foo(self, ctx):
            ...

        @foo.app_command.command()
        async def bar(self, interaction):
            ...
2022-05-06 09:02:49 -04:00
Rapptz
9793fba338 [commands] Add support for discord.Attachment converters 2022-05-05 01:54:59 -04:00
Rapptz
ccc737eb07 [commands] Add support for with_app_command in hybrid commands
This allows the user to make a text-only command without it registering
as an application command
2022-05-05 01:46:19 -04:00
Rapptz
eee65ac39b [commands] Pass permissions v2 information to HybridGroup 2022-05-02 19:08:25 -04:00
Rapptz
6ee56fe964 Fix remaining --verifytypes related errors 2022-04-30 19:43:53 -04:00
Rapptz
5536ef1eea Update to pyright 1.1.242 2022-04-30 19:37:01 -04:00
Rapptz
832d2c0542 [commands] Fix certain annotations being allowed in hybrid commands
Union types were not properly constrained and callable types were
too eagerly being converted
2022-04-21 04:13:32 -04:00
Rapptz
1d97a35385 [commands] Fix hybrid commands not respecting default annotations 2022-04-19 12:08:22 -04:00
Rapptz
6113f856b6 [commands] Dispatch command events for hybrid commands 2022-04-19 01:40:16 -04:00
jack1142
f9ead92239
[commands] Change Parameters header to Attributes in HybridGroup 2022-04-15 03:23:56 -04:00
Rapptz
80aa45ed31 [commands] Skip ws before processing arguments in Greedy transformer 2022-04-15 03:21:36 -04:00
Rapptz
bc07a02f68 [commands] Fix type hints for hybrid command decorators 2022-04-14 05:14:48 -04:00
Rapptz
8a1800bd12 [commands] Add support for setting a fallback slash subcommand
This allows the group callback to be invoked as a slash subcommand
2022-04-13 20:30:11 -04:00
Rapptz
e9ff6b4be8 [commands] Fix broken documentation references 2022-04-13 18:49:39 -04:00
Rapptz
7a52aa3764 [commands] Force HybridGroup to always have invoke_without_command 2022-04-13 17:14:21 -04:00
Rapptz
242d3f7ab7 [commands] Add Bot.hybrid_group and Bot.hybrid_command decorators 2022-04-12 21:17:00 -04:00
Rapptz
1931b0eb75 [commands] Ensure hybrid app command receives copied wrapper command 2022-04-12 20:15:11 -04:00
Rapptz
393fdde037 [commands] Add support for Greedy for hybrid commands 2022-04-12 20:15:11 -04:00
Rapptz
1004cf2059 [commands] Unconditionally replace default if it's set
Handles degenerate `x: int = commands.param(default=10)` case
2022-04-12 20:15:11 -04:00
Rapptz
70d2522e7e [commands] Unwrap CommandInvokeError if the cause is CommandError 2022-04-12 20:15:11 -04:00
Rapptz
65418414ea [commands] Refactor parameter replacement to be less brittle
If a parameter works as-is as a transformer or a built-in then it
will always be taken rather. This way, the custom behaviour is done
as a fallback in case it doesn't work natively with app commands.

This also allows things that are hybrid transformers and converters
to work transparently.
2022-04-12 20:15:11 -04:00
Rapptz
896932faf1 [commands] Add Range converter
This allows hybrid commands to also have a range annotation
2022-04-12 20:15:11 -04:00
Rapptz
3c4b22b623 [commands] Fix transformers no longer working as annotation 2022-04-12 20:15:10 -04:00
Rapptz
9d05f55ddb [commands] Fix Optional handling when the inner type is a converter 2022-04-12 20:15:10 -04:00
Rapptz
f072edfdfc [commands] Properly support commands.param in hybrid commands 2022-04-12 20:15:10 -04:00
Rapptz
d61561f2e8 [commands] Add support for autocomplete for hybrid commands 2022-04-12 20:15:10 -04:00
Rapptz
52fcaed79b [commands] Reassign app_command attribute on copy
Prior to this change it would re-create the HybridAppCommand on copy
which had the consequence of clearing parameter related changes.
2022-04-12 20:15:10 -04:00
Rapptz
1232a1d2fd [commands] Properly call after_hooks in hybrid commands 2022-04-12 20:15:10 -04:00
Rapptz
840eb577d4 [commands] Add initial implementation of hybrid commands
Hybrid commands allow a regular command to also double as a slash
command, assuming it meets the subset required to function.
2022-04-12 20:15:10 -04:00