Commit Graph

21 Commits

Author SHA1 Message Date
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 #2510
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 #1950
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 #1944
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
757584e651 [commands] Add support for stacking Cog.listener decorator.
Fix #1926
2019-02-27 04:29:54 -05:00
d5d9164810 [commands] Fix special method detection for regular function objects.
Fixes #1920
2019-02-24 00:24:31 -05:00
ab8e7b7732 [commands] Fix bug in behaviour in the cog inspection methods. 2019-02-23 10:51:23 -05:00
7ad4425c57 Update copyright years. 2019-02-23 09:26:39 -05:00
d3bc35a573 [commands] Update stale parent references in subcommands.
This bug was kind of a long one to figure out, as per #1918 documents
the issue had to do with subcommands but the actual adventure in
finding this one was a long one.

The first problem was that Command.cog was for some reason None, which
indicated that a copy was happening somewhere along the way. After some
fiddling I discovered that due to the copies of `Cog.__cog_commands__`
the groups pointed to out-dated versions that got overriden by the new
copies.

The first attempt at fixing this was straightforward -- just remove the
subcommand from the parent and replace it with the newer reference that
we just received. However, this ended up not working due to a strange
mystery where the subcommand being invoked was neither the original
copy nor the new copy residing in `Cog.__cog_commands__`.

Some more investigation later pointed out to me that a copy occurs
during the `Group.copy` stage which calls `Command.copy` for all its
subcommands. After spotting this out I had realised where the
discrepancy comes from. As it turns out, the subcommand copy that was
being invoked was actually a stale one created from `Group.copy`.

The question remained, how come that one was being called? The problem
stemmed from the fact that when the subcommand was copied, the parent
reference pointed to the old parent. Since the old parent was the one
that was getting the new reference, it went practically untouched. This
is because the calling code fetches the child from the parent and the
old parent is nowhere in the call chain.

To fix this issue we needed to update the parent reference, and in
order to do that a temporary lookup table is required pointing to the
latest copies that we have made.

Thus ends a 3.5 hour bug hunting adventure.
2019-02-23 09:26:01 -05:00
10ed41d8a0 [commands] Fix bug with cog bot check once not being unloaded properly. 2019-02-23 07:40:00 -05:00
1a0b1dfd29 [commands] Fix attribute access in cogs to commands.
Previously they were outdated copies, this updates the copies to the
ones that are actually injected.
2019-02-23 07:38:04 -05:00
f15cf7c845 [commands] Pass over kwargs to type.__new__ 2019-02-23 05:18:24 -05:00
caf3d17d4a Rework entire cog system and partially document it and extensions. 2019-02-23 04:10:10 -05:00