Commit Graph

170 Commits

Author SHA1 Message Date
ceaba01776 Add version information from missing PRs. 2019-08-11 19:04:39 -04:00
c7d3ebb400 [commands] Add role cooldown bucket 2019-08-11 18:44:16 -04:00
671a19a24a [commands] Ensure cooldowns are properly copied. 2019-06-12 23:40:43 -04:00
af4e3ad79b Some documentation touch-ups and missing stuff in the changelog. 2019-06-09 01:24:41 -04:00
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
92731bbf5f [commands] Fixed extra "only" in dm_only docs 2019-05-19 20:04:42 -07:00
1fac7a7e71 [commands] Add missing backtick for is_nsfw docs 2019-05-17 15:25:45 -07:00
f74d73327b [commands] Explicitly assign invoked_subcommand to None before invoking
This should fix instances of it not working as expected in nested
groups.
2019-05-11 18:17:57 -04:00
6dcd68b8d7 [commands] Allow passing current to more cooldown mapping methods.
Also adds a CooldownMapping.update_rate_limit helper function.
2019-04-24 23:26:33 -04:00
5a7b5cd14b [commands] Allow passing of a message to NoPrivateMessage again.
Prevents an accidental breaking change.
2019-04-20 17:28:44 -04:00
188bd4e708 [commands] DM channels are NSFW in commands.is_nsfw check. 2019-04-20 17:27:04 -04:00
919dbcafb3 Consistent use of __all__ to prevent merge conflicts. 2019-04-20 17:20:58 -04:00
c6410ea9ab [commands] Clean docstrings in Command.parents and Command.root_parent 2019-04-20 17:01:01 -04:00
bbf9a42f87 [commands] Add Command.parents
Make command.root_parent use new command.parents property
2019-04-20 16:59:53 -04:00
bb3ebc0ebc [commands] Add custom exception classes for built-in checks
Added:
* MissingRole
* BotMissingRole
* MissingAnyRole
* BotMissingAnyRole
2019-04-20 16:45:37 -04:00
dd84773f45 [commands] Allow passing cls to the commands.group decorator 2019-04-19 18:29:11 -04:00
7a1102ccf0 [commands] Use message creation as the reference time in cooldowns 2019-04-14 17:33:56 -04:00
ac1b9f5628 [commands] Fix lambda converters in non-module contexts.
Not sure why anyone would do this but might as well fix it.
2019-04-13 07:15:54 -04:00
015404b01c [commands] Add versionadded to dm_only 2019-04-12 03:21:49 -04:00
ec1b3434a2 [commands] Fix erroneous string in dm_only check 2019-04-11 00:55:32 -04:00
aabbd5a446 [commands] Added dm_only check
Raises PrivateMessageOnly on failure.
2019-04-11 00:02:22 -04:00
aeabd0761e [commands] Raise TypeError instead of ClientException in some places
Certain decorators and functions expect coroutines and raise an
exception when this is not met. Change these to raise the appropriate
TypeError since they can't actually be handled by the user gracefully
anyway.
2019-04-07 22:31:05 -04:00
c96642860c [commands] Add Command.cooldown_after_parsing keyword argument.
This controls the behaviour of cooldown execution order. This does
not change the default behaviour however.
2019-03-22 22:23:07 -04:00
64d749a13f [commands] Ensure handlers are copied even during update.
Fix #2001
2019-03-20 22:38:00 -04:00
c30a366106 Try to consistently use "inherit" vs "derive" in documentation. 2019-03-19 09:23:12 -04:00
fb02191b80 Organise documentation 2019-03-19 08:24:42 -04:00
3326adf63b [commands] Optimise GroupMixin.get_command for the no space case.
Comes at a 30ns slowdown for the space case, however.
2019-03-16 09:27:59 -04:00
b506ee1b8e Change superclass to subclass in some documentation 2019-03-16 05:32:59 -04:00
3527203e07 [commands] Redesign HelpFormatter into HelpCommand
Part of #1938
2019-03-15 05:54:23 -04:00
0513ea1f53 [commands] Properly handle typing.Optional as last positional parameter 2019-03-13 10:05:08 -05:00
8a153bfaad [commands] Refactor quoted_word free function to a StringView method.
Technically a breaking change, however this interface was not
documented or guaranteed to exist.
2019-03-12 05:37:34 -04:00
84a48c9056 Small inconsistency in documentation
:)
2019-03-08 19:59:20 -05:00
63c5892b43 Fix Signature for Greedy/Optional converters
Change Greedy to `[a]...` | `[a=1]...`
2019-03-02 06:16:50 -05:00
9827d6eeaf [commands] Fix issue with decorator order with checks and cooldowns
Now they're just explicitly copied.
2019-02-23 07:41:25 -05:00
04ee10adc4 [commands] Fix bug with local checks and cooldowns not applying. 2019-02-23 05:38:35 -05:00
ac6e55353a [commands] Copy on_error handlers in Command.copy
This fixes the issue of error handlers not applying.
2019-02-23 05:31:05 -05:00
caf3d17d4a Rework entire cog system and partially document it and extensions. 2019-02-23 04:10:10 -05:00
9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -05:00
e1c94a3b1c Do None instead of falsy checks on Command attributes 2019-01-28 22:22:44 -05:00
dc8aa7c35b Change Greedy behaviour slightly during conversion errors.
Make Greedy swallow conversion errors and return the default if there
are no convertible args
2019-01-28 21:57:29 -05:00
Xua
016963500b [commands] Add support for IDs in the role related checks.
This affects:

* commands.has_role
* commands.has_any_role
* commands.bot_has_role
* commands.bot_has_any_role
2018-11-24 23:02:47 -05:00
5a585ebf20 Add channel category cooldown bucket type 2018-11-24 22:51:18 -05:00
efb4ff850e [lint] Fix import order
Reorder imports to be consistenly grouped by standard library, third
party library, and local modules in that order thoughout the library.
2018-11-24 22:17:58 -05:00
51d626eabe [lint] Remove redundant paranthesis
Remove redundant parenthisis around await expressions.  Left over from
f25091ef.
2018-11-24 22:17:58 -05:00
fa46b07db1 [lint] Rename exception variables to exc
Use the more explicit (and common) exc instead of e as the variable
holding the exception in except handlers.
2018-11-24 22:17:57 -05:00
4ae8e81660 [lint] Remove redundant exception variables
Use bare raise statement when reraising the exception that occured, and
remove unused exception variables.  Also remove a pointless exception
handler in discord.opus.
2018-11-24 22:17:57 -05:00
a71b3b5fa0 [lint] Limit unneccessarily broad except clauses
Add exception qualifier(s) to bare except clauses swallowing exceptions.
2018-11-24 22:17:57 -05:00
814b03f5a8 [commands] Add commands.Greedy converter and documentation.
This allows for greedy "consume until you can't" behaviour similar to
typing.Optional but for lists.
2018-09-24 03:56:32 -04:00
00a445310b [commands] Allow for backtracking parsing with typing.Optional
Original code by zephyrkul.

This new parsing mode allows for backtracking in case of failure
when a typing.Union[..., NoneType] or a typing.Optional[...] is used.
This means that if a type would fail to parse, the view is undo'd to
a previous state, passing the default parameter to the callback, and
then continuing on the next parameter as if nothing had happened.
2018-09-23 06:12:26 -04:00
8ef509883a [commands] Properly parse bool when inside a typing.Union 2018-09-20 23:58:34 -04:00