174 Commits

Author SHA1 Message Date
Rapptz
994660faad [commands] Fix unknown generic type in tree_cls 2022-04-02 05:53:33 -04:00
Rapptz
29668c51ae [commands] Revert back to older help command implementation
The newer implementation did not play nicely with spawned tasks and
accessing HelpCommand.context, which was a frequent pain point when
writing paginated help commands.
2022-03-31 02:46:42 -04:00
Bryan Forbes
06c257760b
Update types to use Awaitable where possible 2022-03-30 22:00:24 -04:00
Jonah Lawrence
caac97c0d1
Allow empty iterables as a command_prefix 2022-03-30 20:07:44 -04:00
I. Ahmad
ae1979d17a
[commands] Add note for command tree in Bot's docstring 2022-03-28 09:19:27 -04:00
Josh
2d1cbacc58
[commands] Add tree_cls to Bot constructor 2022-03-24 22:32:31 -04:00
Bryan Forbes
062f4d6f87
Change some methods to use positional-only marker
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
2022-03-22 18:52:25 -04:00
Stocker
eca4727593
[commands] Add missing and fix existing type annotations 2022-03-22 06:04:46 -04:00
jack1142
6dc314628e
Make guild and guilds args in Bot.remove_cog() keyword-only 2022-03-20 19:01:37 -04:00
Stanisław Jelnicki
47cb7d03ec
[commands] Type BotBase.help_command as Optional 2022-03-14 21:02:36 -04:00
HigherOrderLogic
3e70a4e798
Fix typo in add_cog doc 2022-03-14 01:33:34 -04:00
Stocker
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
Josh
a1c618215e
[commads] Change cog/extension load/unload methods to be async 2022-03-13 21:03:45 -04:00
Rapptz
0ef369c0fa [commands] Automatically unload top level app commands in extensions 2022-03-12 09:24:26 -05:00
Rapptz
d68f2db7cb [commands] Always respect guild IDs passed to cog adding and removal
Fixes #7657
2022-03-12 06:58:55 -05:00
Rapptz
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
Alex Nørgaard
bfaee44b1f
[commands] Fix types for Bot.is_owner 2022-03-05 22:06:21 -05:00
Josh
147948af9b
Use typing.Self throughout library 2022-03-01 07:53:24 -05:00
Josh
39c5a4fdc3
Fix type-errors in commands extension 2022-02-23 08:04:49 -05:00
Rapptz
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
Josh
4dbe1af32f
Update sphinx and fix documentation issues 2022-02-19 22:35:32 -05:00
jack1142
dc19c6c7d5
Add positional-only arguments in more places 2022-02-19 20:28:01 -05:00
Willy
fa5a2188bb
Copy docs from Client.close() to Bot.close() 2021-08-20 20:06:51 -04:00
Josh
f3cb197429
[commands][types] Type hint commands-ext 2021-08-19 19:51:26 -04:00
thetimtoy
c4ee9dcafa
[commands] Return removed cog in Bot.remove_cog
The method now returns the removed cog, if it exists.
2021-08-18 00:39:54 -04:00
Rapptz
f56543df15 [commands] Remove function call indirection when checking author 2021-05-25 20:53:44 -04:00
Tari
36cf3c94b4
[commands] Remove Bot.self_bot 2021-05-25 20:46:26 -04:00
Josh
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
Sebastian Law
4134a17a29
[commands] Raise error when a cog name is already registered 2021-04-08 22:04:10 -04:00
Rapptz
99fc950510 Use f-strings in more places that were missed. 2021-04-08 06:02:47 -04:00
pikaninja
1c553f51fb
[commands] Use has_error_handler instead in command_error 2021-04-07 23:42:52 -04:00
Nadir Chowdhury
89456022cf
Add __all__ to remaining modules 2021-04-07 02:30:32 -04:00
Rapptz
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
Rapptz
862d509d2e [commands] Add support for stripping whitespace after the prefix
This is configured with the strip_after_prefix option in `Bot.__init__`
2021-03-28 21:21:09 -04:00
Nadir Chowdhury
63ec23bac2
Code optimisations and refactoring via Sourcery 2021-02-24 21:26:51 -05:00
Kaylynn Morgan
1cbc537734
[commands] Allow relative paths when handling extensions 2021-02-23 03:29:04 -05:00
Nihaal Sangha
69bdc3a184
Change copyright year to present 2021-01-15 05:28:11 -05:00
Nadir Chowdhury
6b803acde4
[chore] Remove redundant imports
This also removes the historical patch for NullHandler implemented in bbf1c54, as it has been available since Python 3.1.
2020-11-28 03:16:49 -05:00
Jaime Garcia Jr
1c3b0c02f8 Add revisions to check_once docs 2020-07-24 09:18:42 -05:00
Sebastian Law
b4b953bfc6
Fix various inconsistencies within the documentation (#5067) 2020-06-28 03:45:58 -04:00
Rapptz
874c2cd3c9 [commands] Raise CheckFailure if all bot "check once" fail
Fix #2643
2020-04-06 21:45:16 -04:00
Karthikeyan Singaravelan
25b8adc404 Import ABC from collections.abc instead of collections
This is for Python 3.9 compatibility.
2020-01-25 21:46:33 -05:00
Harmon
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
Rapptz
6071607176 Bump copyright year to 2020
Closes #2510
2020-01-19 20:03:00 -05:00
Ben Mintz
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
Rapptz
dd12fbf73d [commands] Properly load the original module when reloading fails.
Fix #2291
2019-07-27 22:37:55 -04:00
Benjamin Mintz
042a234eac [commands] update sys.modules in load_extension again
6f71552c508c61d9b6bf024fc259063ad056b7c4 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
ed588
c6133ef881 [commands] Bot.is_owner should be marked as coroutine 2019-07-18 18:06:27 -04:00
Rapptz
6f71552c50 [commands] Don't update sys.modules with a stale reference. 2019-07-07 20:17:44 -04:00
Rapptz
68342db04d [commands] Properly raise the correct exception for owner_ids
Also some minor nits with documentation.
2019-06-29 19:26:45 -04:00