Commit Graph

91 Commits

Author SHA1 Message Date
44a44e938f Reformat entire project with ruff instead of black 2025-08-18 20:16:10 -04:00
983a9b8f94 Use Unpack where it's possible 2025-08-15 05:36:36 -04:00
2e2f51fd5c First pass at supporting user apps
Co-authored-by: red <red@kalab.sk>
Co-authored-by: Vioshim <63890837+Vioshim@users.noreply.github.com>
2024-05-04 23:25:01 -04:00
4e03b170ef Update pyright version 2024-02-20 13:36:02 -05:00
5c5ccc4e82 [commands] Fix hybrid command wrapped instances being out of sync 2023-09-30 14:28:18 -04:00
3f92f35bb1 [commands] Log exceptions that happen during cog_unload 2023-09-20 17:20:50 -04:00
42a1a68662 [commands] Fix obscuring name error 2023-08-25 11:36:25 -04:00
69e9bc9454 [commands] Fix nested hybrid groups inserting manual app commands 2023-08-24 14:34:01 -04:00
630b2a1e55 Update pyright version 2023-07-01 18:26:27 -04:00
2ab6541715 [commands] Document exceptions being ignored in teardown and cog_unload
Co-authored-by: Josh <josh.ja.butt@gmail.com>
2023-05-23 20:31:49 -04:00
a5a93a85bc [commands] Document GroupCog.interaction_check 2023-02-28 02:20:00 -05:00
d26dbf3a7a Fix a few typos in the docs
Co-authored-by: o-wo <24418520+o-wo@users.noreply.github.com>
2023-02-23 00:47:08 -05:00
742630f144 [commands] Fix error involving hybrid groups in Cog 2023-02-10 19:33:27 -05:00
93ed1646d2 Cleanup some private utilities in app_commands.commands 2023-02-02 00:33:18 -05:00
20c7e261be [commands] Fix small "commands" typo in hybrid documentation 2023-01-25 19:41:40 -05:00
3ff88db768 Update pyright to 1.1.289 2023-01-16 21:57:54 -05:00
f4c0a051ab [commands] Hint hybrid commands in GroupCog's description 2023-01-14 18:55:32 -05:00
50078087e5 [commands] Fix variance issues in Bot.add_cog with List[Snowflake] 2022-11-21 01:15:18 -05:00
d0625154ed [commands] Add Cog.has_app_command_error_handler 2022-10-10 16:37:48 -04:00
95b6bd8782 Add coro tag to docstrings that were missing it 2022-10-02 17:52:18 -04:00
6981eb69c4 Normalize type formatting in TypeError
Normalize most mixed usages of `__class__`, `__class__!r`, 
`__class__.__name__!r` to the standard form of 
`__class__.__name__`
2022-09-12 15:25:55 -04:00
bdda31307b [commands] Add GroupCog.group_extras to set Group.extras
Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com>
2022-08-31 01:28:39 -04:00
610edaeead [commands] Add option to disable auto_locale_strings in GroupCog 2022-08-14 00:59:33 -04:00
2d586ae805 Add initial support for app command localisation 2022-08-05 22:35:30 -04:00
f5b0717661 [commands] Add get_app_commands and walk_app_commands to Cog 2022-08-01 06:22:02 -04:00
1fbcfbd1fb Fix cog_app_command_error for group edge case 2022-07-27 22:27:37 -04:00
6d1069e789 Fix cog_app_command_error for groups 2022-07-27 00:29:53 -04:00
9c109ae59b [commands] Unload cog when command registration fails in _inject 2022-07-20 22:31:14 -04:00
0546343bcb [commands] Add cog-level app command error special method 2022-07-17 23:45:19 -04:00
06c43d6772 [commands] Add support for NSFW commands for hybrid commands 2022-05-22 19:31:28 -04:00
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
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
e8a2eeea06 [commands] Rename Cog.app_command_group to Cog.app_command
This allows it to be consistent with hybrid commands
2022-05-01 19:04:53 -04:00
0551214be1 [commands] Properly set default guilds for group to None instead of [] 2022-05-01 15:44:18 -04:00
e873b8294a [commands] Properly set group parent for hybrid commands in cogs 2022-05-01 15:01:30 -04:00
f4c5d37c8f [commands] Rework Cog + Group inheritance to requite GroupCog
This is an attempt to fix the MRO issues present in the current
implementation. The previous implementation of using both Cog and
app_commands.Group in the inheritance chain caused issues with things
such as walk_commands due to it potentially shadowing the app_commands
version of the call.

In this particular case it's better to use composition instead of
inheritance to avoid these bugs entirely. Especially as more things are
added that could conflict with each other.
2022-05-01 14:01:21 -04:00
5536ef1eea Update to pyright 1.1.242 2022-04-30 19:37:01 -04:00
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
f15f601779 [commands] Check if an application command starts with bot_ or cog_ 2022-04-05 06:06:35 -04:00
0a8065606a Update parent reference of Group children 2022-03-30 19:12:39 -04:00
1192d842e1 Fix some type checker errors and remove some type ignores
Caught from an upgraded Pyright
2022-03-16 01:46:58 -04:00
e5461c73b6 [commands] Check if any base in a Cog is a subclass of Group 2022-03-15 09:50:49 -04:00
5bc085ebab Properly set root parent before copying a command's binding 2022-03-15 03:24:20 -04:00
5aa696ccfa Fix typing issues and improve typing completeness across the library
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
Co-authored-by: Josh <josh.ja.butt@gmail.com>
2022-03-13 23:52:10 -04:00
a1c618215e [commads] Change cog/extension load/unload methods to be async 2022-03-13 21:03:45 -04:00
0ef369c0fa [commands] Automatically unload top level app commands in extensions 2022-03-12 09:24:26 -05:00
d68f2db7cb [commands] Always respect guild IDs passed to cog adding and removal
Fixes #7657
2022-03-12 06:58:55 -05:00
9dea6caf20 Ensure cog app commands is a list rather than a dict
There was a remnant of it being a dict in the metaclass.
2022-03-11 21:30:49 -05:00
d210f799ee [commands] Fix cog eject behaviour with application commands
This was using the old attribute I forgot to change.
2022-03-10 05:33:54 -05:00
446bfa78b0 [commands] Allow Cog and app_commands interopability
This changeset allows app commands defined inside Cog to work as
expected. Likewise, by deriving app_commands.Group and Cog you can
make the cog function as a top level command on Discord.
2022-03-09 20:26:54 -05:00