Rapptz
0851e03f00
Allow creating a news channel in create_text_channel
2022-04-30 07:12:16 -04:00
Rapptz
06df0d7931
Address latest breaking change in creating forum posts
2022-04-29 12:39:12 -04:00
Rapptz
ef20264b1c
Allow creating an Intent through a passed integer value
2022-04-29 10:50:22 -04:00
Rapptz
9e3375f3fc
Fix infinite recursion in TextChannel.type
2022-04-29 10:00:33 -04:00
Rapptz
a0dfdb9b1d
Fix multiple view instances not dispatching in app commands responses
...
Due to a quirk in InteractionResponse.send_message not returning a
message, all messages sent with an associated View would end up having
no message_id set. When multiple instances of a View are responded to
in a slash command context, this meant that the newest one would
override the storage of the older one. Ultimately leading to the first
view instance causing interaction failures.
Since fetching the original message is an unacceptable solution to the
problem due to incurred requests, the next best thing is to store an
intermediate interaction_id as a stop gap to differentiate between
the multiple instances. This change however, came with its own set of
complications.
Due to the interaction_id being an intermediate stop gap, the
underlying storage of the view store had to be changed to accommodate
the different way of accessing the data. Mainly, the interaction_id
key had to be quick to swap and remove to another key. This solution
attempts to change the interaction_id interim key with
a full fledged message_id key when it receives one if it's possible.
Note that the only way to obtain the interaction_id back from the
component interaction is to retrieve it from the MessageInteraction
data structure. This is because using the interaction_id of the button
press would be a different interaction ID than the one set as an
interim key. As a consequence, this stop gap only works for application
command based interactions. I am not aware of this bug manifesting in
component based interactions.
This patch also fixes a bug with ViewStore.remove_view not working due
to a bug being suppressed by a type: ignore comment. It also removes
the older __verify_integrity helper method since clean-up is already
done through View.stop() or View timeout.
Hopefully in the near future, the `/callback` endpoint will return
actual message data and this stop gap fix will no longer be necessary.
2022-04-28 12:24:57 -04:00
Rapptz
e53daaba35
Properly namespace MISSING in the documentation
2022-04-28 10:56:31 -04:00
Rapptz
204f941e96
Display permissions v2 decorators in the documentation
2022-04-28 10:50:00 -04:00
Rapptz
ab64a2eae9
Fix typing of guilds kwargs to take Sequence instead of List
2022-04-28 10:48:57 -04:00
Rapptz
acd4a0856e
Add Interaction.extras for extraneous data
2022-04-28 07:59:43 -04:00
Rapptz
500bf77103
Document and export MISSING sentinel
2022-04-28 07:52:23 -04:00
Rapptz
a14b43f2fd
Fix documentation links being broken
2022-04-28 00:53:51 -04:00
Rapptz
3b3d4d3880
Add support for setting and receiving permissions v2
...
Closes #7592
This does not include audit log changes or the remaining endpoints.
That will come in a different commit.
2022-04-28 00:23:36 -04:00
Rapptz
e198a0e7e6
Avoid re-creating View children on edit
...
The older code attempted to be clever and sync component additions and
removals with what the message edit is doing. In some cases, this led
to the re-creation of those components causing lost attributes to be
dropped such as `_rendered_row` which would mess up handling of view
weights.
Instead of recreating the children list every time and keeping track
of additions and removals, this change just updates the old state with
the new state while ignoring any new or removed additions. This should
work fine in theory due to additions or removals already being present
before editing the View instance in the first place.
Closes #7231 #7511
2022-04-27 01:24:10 -04:00
Rapptz
69b12b97c0
Sync abc.User protocol with more shared methods
...
This isn't *all* of them but it's a sizeable portion
2022-04-23 03:00:46 -04:00
Rapptz
f045b7d63c
Fix BanEntry not being exported despite being documented
2022-04-23 01:53:21 -04:00
Rapptz
5fcd4e411f
[commands] Add support for typing.Annotated
2022-04-22 06:31:02 -04:00
Rapptz
ab33551553
Fix type hints on GuildChannel.set_permissions
2022-04-22 04:50:10 -04:00
Rapptz
832d2c0542
[commands] Fix certain annotations being allowed in hybrid commands
...
Union types were not properly constrained and callable types were
too eagerly being converted
2022-04-21 04:13:32 -04:00
Rapptz
405c445093
[commands] Unwrap transformers when considering them as converters
2022-04-21 03:19:11 -04:00
Rapptz
5357b9319b
[commands] Ignore delete_after for ephemeral interaction sends
2022-04-21 02:07:37 -04:00
Rapptz
de941ababe
Add Colour.from_str factory method
...
This moves the command extension parsing code over to the main library
since it can be potentially useful for others.
2022-04-20 06:49:28 -04:00
Rapptz
84e6b9283d
[commands] Fix delete_after not working with interaction Context.send
2022-04-19 22:14:11 -04:00
Rapptz
cd0d6749ea
[commands] Fix Context.reply not working with expired interactions
2022-04-19 22:09:53 -04:00
Rapptz
1d97a35385
[commands] Fix hybrid commands not respecting default annotations
2022-04-19 12:08:22 -04:00
Rapptz
987235d564
Only call async setup if the loop sentinel hasn't been changed
2022-04-19 04:27:52 -04:00
Rapptz
6113f856b6
[commands] Dispatch command events for hybrid commands
2022-04-19 01:40:16 -04:00
Rapptz
2e02f618f0
Add support for enum values that aren't int, str, or float
...
This coerces them into string options to allow them to be transformed
in the actual code.
2022-04-18 20:15:45 -04:00
Rapptz
2b3cc8fe10
Add Member.display_icon to get the rendered member icon
2022-04-18 17:26:30 -04:00
Rapptz
80aa45ed31
[commands] Skip ws before processing arguments in Greedy transformer
2022-04-15 03:21:36 -04:00
Rapptz
4fb1309e2a
[commands] Mock interaction context prefix
...
Most user-level code probably expects the prefix to be valid and not
None, so mocking it to ensure it's at least a string is probably for
the best.
2022-04-14 19:12:16 -04:00
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
e541be0427
Fix tests from failing
2022-04-14 06:46:33 -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
Rapptz
242d3f7ab7
[commands] Add Bot.hybrid_group and Bot.hybrid_command decorators
2022-04-12 21:17:00 -04:00
Rapptz
daa32e3463
Use pyright CI action and remove --verbose from black
2022-04-12 20:51:02 -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
Rapptz
c568ed8cdc
Pin Pyright to 1.1.235
2022-04-10 22:49:30 -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
Rapptz
30cc00c9a4
Explicitly specify public threads when creating them in forums
...
The endpoint seems to fail otherwise
2022-04-06 23:27:27 -04:00
Rapptz
a8b26b9257
Allow pinning a thread using Thread.edit
2022-04-06 23:21:17 -04:00
Rapptz
92eb9d7d8e
Fix documentation for ChannelFlags.pinned
2022-04-06 23:06:58 -04:00
Rapptz
67a58d10ae
Change Fetch -> Retrieve for last_message documentation
2022-04-06 23:02:58 -04:00
Rapptz
23f6876492
Add initial support for forum channels
...
Closes #7652
2022-04-06 23:02:58 -04:00
Rapptz
f07885973f
Provide callback name where applicable in validation
...
Fix #7850
2022-04-06 08:57:04 -04:00
Rapptz
abeea73734
Fix remaining things not explicitly passing the intents kwarg
2022-04-05 23:15:40 -04:00
Rapptz
b32b78de45
[commands] Fix missing or inferred type hints in parameters.py
2022-04-05 22:47:21 -04:00
Rapptz
76cc2c2272
Require passing intents to Client and its subclasses
2022-04-05 22:32:14 -04:00
Rapptz
c68ea67213
Properly handle inheritance overriding in View subclasses
2022-04-05 09:41:48 -04:00
Rapptz
629f36e7d7
[commands] Add fallback behaviour to the default parameter instances
...
This allows users to explicitly override the default annotation for
CurrentAuthor and CurrentChannel since they're wider than what most
users would expect
2022-04-05 06:40:31 -04:00
Rapptz
f15f601779
[commands] Check if an application command starts with bot_ or cog_
2022-04-05 06:06:35 -04:00
Rapptz
b823a4bab1
[commands] Only update annotation if an explicit override is given
2022-04-05 06:02:28 -04:00
Rapptz
c582940401
Remove ancient IDENTIFY key that is no longer used
2022-04-05 05:22:00 -04:00
Rapptz
dbcdf69eb1
[commands] Raise appropriate exception for no guild found
2022-04-04 21:49:11 -04:00
Rapptz
8b50ac8a31
[commands] Don't set a converter for the defaults provided
2022-04-04 21:47:03 -04:00
Rapptz
66155faf00
[commands] Fix documentation not being properly formatted
2022-04-04 18:10:43 -04:00
Rapptz
b561024163
Fix WebhookState not handling reaction emoji
...
Fix #7842
2022-04-04 00:49:36 -04:00
Rapptz
907d5e0ee7
Document Forbidden exception in CommandTree.sync
2022-04-03 22:57:54 -04:00
Rapptz
1458251736
Change View.children to be a property
...
This allows users to call remove_item in a loop. Likewise, it prevents
the footgun of doing children.append(...) which does not uphold the
invariants with the weight system.
2022-04-03 20:13:42 -04:00
Rapptz
58db635229
Fix parameter validation in Guild.query_members
2022-04-03 08:07:01 -04:00
Rapptz
3ef8f77e81
Add proper nsfw support for vocal guild channels
2022-04-03 07:50:10 -04:00
Rapptz
298bd7492c
Run pyright as part of the CI process
...
This doesn't do verifytypes yet due to a bug in Pyright
2022-04-02 11:47:34 -04:00
Rapptz
52e16573f5
Remove unused imports and make exports explicit
...
This allows Pyright to actually catch these errors, which would be
useful for CI purposes in the future.
2022-04-02 11:38:39 -04:00
Rapptz
f7a79ff8d7
Avoid calling PartialMessage.__init__ in Message.__init__
...
This prevents Message creation from crashing due to the public
interface's type checks potentially breaking future compatibility.
2022-04-02 11:15:54 -04:00
Rapptz
2aca705b95
Add support for sending messages and managing webhooks in VoiceChannel
2022-04-02 11:14:03 -04:00
Rapptz
b049cf77f2
Add reason to Thread.delete_messages and Thread.purge
2022-04-02 10:36:39 -04:00
Rapptz
994660faad
[commands] Fix unknown generic type in tree_cls
2022-04-02 05:53:33 -04:00
Rapptz
7696342d76
Add missing __slots__ to MessageInteraction
2022-04-02 01:24:56 -04:00
Rapptz
5c14149873
Fix filename spoiler stripping method
...
lstrip does not work as expected
2022-04-01 15:25:03 -04:00