Commit Graph

3755 Commits

Author SHA1 Message Date
Rapptz
9ff90d7863 Copy internal attributes for command decorator state
This allows for copies to not clear the state the decorators had
set prior.
2022-04-14 17:45:27 -04:00
Rapptz
bc07a02f68 [commands] Fix type hints for hybrid command decorators 2022-04-14 05:14:48 -04:00
Rapptz
4951231a7c Remove command parameter from Group.on_error callback
Similar to the CommandTree.on_error removal, this one can be retrieved
using Interaction.command
2022-04-13 22:45:06 -04:00
Rapptz
ce15df4275 [commands] Allow commands.Range inside typing.Union or typing.Optional 2022-04-13 22:43:11 -04:00
Rapptz
cdf442bc32 Fix signature detection in CommandTree.error decorator 2022-04-13 22:30:39 -04:00
Rapptz
3f4fb91328 Change CommandTree.on_error to only take two parameters
The command that failed can be retrieved using Interaction.command
so having it as a parameter doesn't make much sense.
2022-04-13 22:29:27 -04:00
Rapptz
83fae4f0fa Add CommandTree.clear_commands 2022-04-13 22:20:05 -04:00
Rapptz
8a1800bd12 [commands] Add support for setting a fallback slash subcommand
This allows the group callback to be invoked as a slash subcommand
2022-04-13 20:30:11 -04:00
Rapptz
e9ff6b4be8 [commands] Fix broken documentation references 2022-04-13 18:49:39 -04:00
Rapptz
5c61f2af48 [commands] Add ForumChannelConverter to the converter mapping 2022-04-13 17:45:54 -04:00
Rapptz
141d9f4c71 [commands] Add ForumChannelConverter converter 2022-04-13 17:44:03 -04:00
Rapptz
d98ee567d4 Add Guild.forums property
Ran an informal poll in the official server and this name won over the
alternative Guild.forum_channels property name
2022-04-13 17:40:16 -04:00
Rapptz
7a52aa3764 [commands] Force HybridGroup to always have invoke_without_command 2022-04-13 17:14:21 -04:00
Rapptz
49f330b4a3 Fix Thread.jump_url docstring 2022-04-13 17:12:44 -04:00
Rapptz
b476757720 [commands] Fix type hints for checks, hooks, and error handlers 2022-04-13 03:07:58 -04:00
Rapptz
737ff5beaf Update Pyright to 1.1.237 2022-04-13 02:30:00 -04:00
Omkaar
a6ce49833c Add jump_url property to Threads 2022-04-13 02:00:43 -04:00
Rapptz
242d3f7ab7 [commands] Add Bot.hybrid_group and Bot.hybrid_command decorators 2022-04-12 21:17:00 -04:00
Snaptraks
0fa9bfc925 Correct order of arguments in View.on_error 2022-04-12 21:15:16 -04:00
Rapptz
1931b0eb75 [commands] Ensure hybrid app command receives copied wrapper command 2022-04-12 20:15:11 -04:00
Rapptz
393fdde037 [commands] Add support for Greedy for hybrid commands 2022-04-12 20:15:11 -04:00
Rapptz
1004cf2059 [commands] Unconditionally replace default if it's set
Handles degenerate `x: int = commands.param(default=10)` case
2022-04-12 20:15:11 -04:00
Rapptz
70d2522e7e [commands] Unwrap CommandInvokeError if the cause is CommandError 2022-04-12 20:15:11 -04:00
Rapptz
3bb4d3bd6d Allow internal library enums to be used as an annotation 2022-04-12 20:15:11 -04:00
Rapptz
65418414ea [commands] Refactor parameter replacement to be less brittle
If a parameter works as-is as a transformer or a built-in then it
will always be taken rather. This way, the custom behaviour is done
as a fallback in case it doesn't work natively with app commands.

This also allows things that are hybrid transformers and converters
to work transparently.
2022-04-12 20:15:11 -04:00
Rapptz
896932faf1 [commands] Add Range converter
This allows hybrid commands to also have a range annotation
2022-04-12 20:15:11 -04:00
Rapptz
3c4b22b623 [commands] Fix transformers no longer working as annotation 2022-04-12 20:15:10 -04:00
Rapptz
9d05f55ddb [commands] Fix Optional handling when the inner type is a converter 2022-04-12 20:15:10 -04:00
Rapptz
f072edfdfc [commands] Properly support commands.param in hybrid commands 2022-04-12 20:15:10 -04:00
Rapptz
fa3a4c109b [commands] Fix Context.reply not working for hybrid commands 2022-04-12 20:15:10 -04:00
Rapptz
d61561f2e8 [commands] Add support for autocomplete for hybrid commands 2022-04-12 20:15:10 -04:00
Rapptz
52fcaed79b [commands] Reassign app_command attribute on copy
Prior to this change it would re-create the HybridAppCommand on copy
which had the consequence of clearing parameter related changes.
2022-04-12 20:15:10 -04:00
Rapptz
1232a1d2fd [commands] Properly call after_hooks in hybrid commands 2022-04-12 20:15:10 -04:00
Rapptz
c1892131a6 [commands] Fix Context docstring missing Interaction ref 2022-04-12 20:15:10 -04:00
Rapptz
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
Steve C
151806ec94 Add ForumChannel to Thread.parent_id docstring 2022-04-12 20:14:20 -04:00
Jonah Lawrence
7bf1a7483a Parse command descriptions from docstrings
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
2022-04-12 16:31:17 -04:00
Omkaar
1e4908b403 Add ForumChannel to abc.GuildChannel docstring 2022-04-12 04:55:56 -04:00
Omkaar
348764583d Add jump_url property to channels 2022-04-12 00:23:15 -04:00
I. Ahmad
6265723a35 Add support for archive duration in Guild.create_text_channel 2022-04-11 17:21:08 -04:00
NextChai
5892bbd8b4 Allow getting all commands from CommandTree.get_commands
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
2022-04-10 23:00:18 -04:00
Vioshim
79bd18f98c Add reason parameter to Thread.edit 2022-04-10 22:51:24 -04:00
Rapptz
29d4c26466 Upgrade WebhookMessage.channel to Thread if available 2022-04-10 18:15:02 -04:00
Rapptz
538ba0d076 Update Webhook.channel typing to include VoiceChannel as well 2022-04-10 18:11:44 -04:00
Rapptz
c284145f18 Add and remove some versionadded directives 2022-04-10 17:12:56 -04:00
Rapptz
6a49dfcc0f Fix crash with WEBHOOKS_UPDATE channel_id being nullable 2022-04-10 03:47:03 -04:00
z03h
aee657bca5 [commands] Add converter kwarg to flag 2022-04-09 02:10:32 -04:00
Omkaar
1e914e8945 Document Modal parameter limits 2022-04-08 23:58:18 -04:00
Vioshim
4ce60b4cac Documented Embed limits in docstrings 2022-04-08 21:53:08 -04:00
Narmy
723584ca19 Add Permissions.elevated() 2022-04-07 10:42:57 -04:00