1
0
mirror of https://github.com/Rapptz/discord.py.git synced 2025-09-23 00:13:34 +00:00
Commit Graph

59 Commits

Author SHA1 Message Date
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 
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
eaf94e84bc Fix unbound ParamSpec to use ... over Any 2022-03-06 01:44:48 -05:00
147948af9b Use typing.Self throughout library 2022-03-01 07:53:24 -05:00
cd1dd7d670 [commands] Properly eject listeners with custom names 2022-02-21 21:42:00 -05:00
88b520b5ab Reformat code using black
Segments where readability was hampered were fixed by appropriate
format skipping directives. New code should hopefully be black
compatible. The moment they remove the -S option is probably the moment
I stop using black though.
2022-02-20 08:04:58 -05:00
f3cb197429 [commands][types] Type hint commands-ext 2021-08-19 19:51:26 -04:00
8675a18185 [commands] Remove unused copy import in Cog 2021-07-21 02:48:11 -04:00
3864fb37a0 Fix various reference issues in documentation
Co-Authored-By: Riley Shaw <30989490+ShineyDev@users.noreply.github.com>
2021-05-06 07:51:07 -04:00
6d74514729 [commands] Fix logic in Cog.has_error_handler() 2021-04-05 21:39:22 -04:00
9d39b135f4 Modernize code to use f-strings
This also removes the encoding on the top, since Python 3 does it by
default. It also changes some methods to use `yield from`.
2021-04-04 07:03:53 -04:00
4aee7fed5d [commands] Only remove top level commands on cog load failure 2021-03-28 18:35:59 -04:00
63ec23bac2 Code optimisations and refactoring via Sourcery 2021-02-24 21:26:51 -05:00
b9a99238e8 [commands] Add Command/Cog.has_error_handler
This allows querying the state without relying on internal undocumented
attributes.
2021-01-15 06:00:45 -05:00
69bdc3a184 Change copyright year to present 2021-01-15 05:28:11 -05:00
6ea7fce828 [commands] Cog unload failures are swallowed.
Fix 
2020-12-03 19:17:28 -05:00
4adbe03d7c [commands] Allow setting description of cogs 2020-11-26 01:57:24 -05:00
93fa46713a Fix and add documentation 2020-09-23 03:19:35 -04:00
7acec502a6 [commands] Correct command removing during cog injecting 2020-09-09 19:48:00 -04:00
1c3b0c02f8 Add revisions to check_once docs 2020-07-24 09:18:42 -05:00
5813593d6e Add documentation on bot_check_once 2020-07-23 12:19:10 -05:00
b4b953bfc6 Fix various inconsistencies within the documentation () 2020-06-28 03:45:58 -04:00
Xua
4e6942194f [commands] Document that cog_command_error must be async 2020-05-10 16:48:59 -04:00
6071607176 Bump copyright year to 2020
Closes 
2020-01-19 20:03:00 -05:00
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
919dbcafb3 Consistent use of __all__ to prevent merge conflicts. 2019-04-20 17:20:58 -04:00
743a5a218f [commands] Disallow bot_ or cog_ commands or listeners in cogs. 2019-04-06 19:46:22 -04:00
fb02191b80 Organise documentation 2019-03-19 08:24:42 -04:00
f43690bde8 [commands] Walk through MRO for Cog derived classes.
This should support cog subclasses in a relatively consistent way in
terms of expectations. Hopefully nothing is broken.

Fixes 
2019-03-17 22:04:05 -04:00
27c6d2c923 [commands] Add Cog.description to get the clean docstring. 2019-03-14 11:42:09 -04:00
c4a21cc1d4 [commands] Add Cog.qualified_name to query the specified cog name. 2019-03-13 23:43:29 -04:00
e1d9f8f59f [commands] Support staticmethod listeners and disallow them in commands 2019-03-12 11:54:45 -04:00
076f9bcac7 [commands] Fix name clash overwriting T.__class__.__name__
Fixes 
2019-02-28 19:47:25 -05:00
21a296d538 [commands] Error out when someone passes plain Cog.listener decorator.
Should make this error easier to catch rather than silent failure.
2019-02-27 21:38:55 -05:00