Commit Graph

134 Commits

Author SHA1 Message Date
874c2cd3c9 [commands] Raise CheckFailure if all bot "check once" fail
Fix #2643
2020-04-06 21:45:16 -04:00
25b8adc404 Import ABC from collections.abc instead of collections
This is for Python 3.9 compatibility.
2020-01-25 21:46:33 -05:00
6f9793fe5e Fixes and improvements for v1.3 documentation
* Add missing versionadded strings for v1.3
* Add missing versionchanged string for Message.edit
* Consistently use versionadded for attributes
* Consistently use versionchanged for parameters
* Use versionchanged for Bot.is_owner
* Fix references in v1.3 changelog
* Improve grammar in v1.3 changelog
2020-01-22 23:55:05 -05:00
6071607176 Bump copyright year to 2020
Closes #2510
2020-01-19 20:03:00 -05:00
1dddb66a1e [commands] default Bot.owner_ids to a set
This appears to be a typo, as everywhere else, owner_ids is set to a set.
2019-09-10 21:10:59 -04:00
dd12fbf73d [commands] Properly load the original module when reloading fails.
Fix #2291
2019-07-27 22:37:55 -04:00
042a234eac [commands] update sys.modules in load_extension again
6f71552c50 introduced a regression: loading a module that is not in a package
does not add it to sys.modules. Updating sys.modules is required after all.
2019-07-18 18:06:43 -04:00
c6133ef881 [commands] Bot.is_owner should be marked as coroutine 2019-07-18 18:06:27 -04:00
6f71552c50 [commands] Don't update sys.modules with a stale reference. 2019-07-07 20:17:44 -04:00
68342db04d [commands] Properly raise the correct exception for owner_ids
Also some minor nits with documentation.
2019-06-29 19:26:45 -04:00
0a21591d0c [commands] Don't raise ExtensionNotFound for ImportErrors in modules
Now loading an extension that _contains_ a failed import will fail
with ExtensionFailed, rather than ExtensionNotFound.
2019-06-29 19:15:05 -04:00
3961e7ef6d Support team members data in application info 2019-06-29 19:14:24 -04:00
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
82b54933e2 Add asyncio.Task subclass for better __repr__ for events. 2019-05-19 19:17:29 -04:00
dbe946a767 [commands] Update default on_command_error 2019-04-18 07:58:28 -04:00
50dcdac5ca [commands] Fix references in Bot to actually link.
Exceptions can't seem to link due to a bug in Sphinx.
2019-04-10 05:13:30 -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
e567b59fea [commands] Double underscore some attributes. 2019-03-24 14:33:51 -04:00
c30a366106 Try to consistently use "inherit" vs "derive" in documentation. 2019-03-19 09:23:12 -04:00
d9e54d7dd3 [commands] Redesign extension exception flow.
Instead of raising a whole variety of exceptions, they are now wrapped
into ExtensionError derived classes.

* ExtensionAlreadyLoaded
	* Raised when an extension is already loaded in Bot.load_extension
* ExtensionNotLoaded
	* Raised when an extension is not loaded, e.g. Bot.unload_extension
* NoEntryPointError
	* Raised when an extension does not have a `setup` function.
* ExtensionFailed
	* Raised when an extension's `setup` function fails.
* ExtensionNotFound
	* Raised when an extension's module import fails.
2019-03-19 09:23:11 -04:00
26e9b5bfac [commands] Add Bot.reload_extension for atomic loading.
Also do atomic loading in Bot.load_extension
2019-03-19 09:23:10 -04:00
fb02191b80 Organise documentation 2019-03-19 08:24:42 -04:00
f26a27dc98 [commands] Make Bot.cogs and Bot.extensions read-only mappings.
This also has the side effect of effectively documenting them for
public use.
2019-03-17 14:53:56 -04:00
3527203e07 [commands] Redesign HelpFormatter into HelpCommand
Part of #1938
2019-03-15 05:54:23 -04:00
3a8214a115 [commands] Remove Bot.get_cog_commands 2019-02-23 11:02:19 -05:00
caf3d17d4a Rework entire cog system and partially document it and extensions. 2019-02-23 04:10:10 -05:00
e53c85110f Clarified add_listener documentation 2019-02-06 01:52:57 -05:00
9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -05:00
24c0946a93 bot.unload_extension: also allow events with no module
It turns out that events created in an eval command also cause
the issue described in #1506.

Ensure that events we remove are part of a module as well.

Also performs minor comment maintenance
("x", "first y", "then z") -> ("x", "y", "z")
2018-11-24 22:51:16 -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
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
e12db3a25d [commands] Add call_once keyword-only parameter for Bot.remove_check
Technically a breaking change. This is to be a parallel with the
Bot.add_check interface.
2018-10-11 02:52:26 -04:00
9af0e54cd3 Correct ClientException message raised in invocation hooks.
For when the hooks are not coroutines.
2018-09-20 23:43:07 -04:00
a4d1599ce9 Change docstrings to raw-strings 2018-09-14 22:55:27 -04:00
b9ef80b0d0 [commands] Prepend mention prefixes in commands.when_mentioned_or 2018-08-28 23:50:57 -04:00
be7ea2678b Bot.unload_extension: don't remove commands from no module
Fixes unload_extension in the case of a command added via eval
2018-08-22 21:56:41 -04:00
3679819c53 [lint] Remove unnecessary lambdas
Lambdas of the form `lambda x: func(x)` are redundant.
2018-08-22 21:43:52 -04:00
d58fc0ccee [lint] Remove unused imports
Left over from various refactoring and rewrites.
2018-08-22 21:43:50 -04:00
aa7c5c3ec1 [commands] Ignore bots from Bot.process_commands by default. 2018-08-22 21:06:09 -04:00
a93c3d931c [commands] Change command_prefix behaviour
Change the behaviour of handling iterable command_prefix types to not
silently ignore falsy prefixes and unify behaviour for all iterable
types.  Add special handling of a possible TypeError in both get_prefix
and get_context for when the prefix is a different type from what is
expected.
2018-06-29 21:48:30 -04:00
607771c4f4 Fix Bot.get_prefix second parameter breaking. 2018-06-10 18:41:36 -04:00
f25091efe1 Drop support for Python 3.4 and make minimum version 3.5.2. 2018-06-10 18:10:00 -04:00
871a262ee3 [commands] Add ability to have case insensitive commands.
This is powered by a dict-like class for the people who want to opt-in
to the performance downgrade for usability for majority English
speaking users.

Since it is slower than the regular dict due to the excessive calls to
str.lower along with the possibilities of gotchas for other languages
outside of English, this is kept as False for the default case.
2018-03-06 00:37:12 -05:00
3112e1c17e Add intersphinx 2018-01-06 17:23:59 -05:00
89f9009a28 [commands] Fix minor spelling mistake 2017-11-20 09:00:32 -06:00
e24914be0b [commands] Fix NameError when given an invalid prefix.
Closes #775
2017-09-12 04:22:13 -04:00
fce2ef5534 [commands] Raise when an invalid prefix is given.
Fixes #712
2017-08-15 06:12:09 -04:00
bcaee518a1 [commands] Remove support for pass_context=False in Command. 2017-07-18 17:58:38 -04:00