Commit Graph

4230 Commits

Author SHA1 Message Date
c22b6dc2cd Add guild property to DMChannel, GroupChannel, and PartialMessageable
This improves generic duck typing programming by allowing narrowing
the types by just checking for a None guild attribute.
2022-05-03 10:55:29 -04:00
8699d2139a Improve generic duck type programming with PartialMessageable
This adds jump_url, permissions_for, and created_at. Luckily, most
cases of this type being constructed already have the guild_id at
creation time.
2022-05-03 10:49:52 -04:00
e9c7c09ebf Add guild avatar to on_member_update docs 2022-05-03 09:44:12 -04:00
eee65ac39b [commands] Pass permissions v2 information to HybridGroup 2022-05-02 19:08:25 -04:00
d0667d08e3 [commands] Fix typing of check/check_any
This changes the type information of check decorators to return a
protocol representing that the decorator leaves the underlying object
unchanged while having a .predicate attribute.

resolves #7949
2022-05-02 18:54:49 -04:00
4a73de946a Change dm_permissons to dm_permission 2022-05-02 18:25:42 -04:00
79d34fbe78 Change Select.type to use a Literal 2022-05-02 08:22:25 -04:00
6771f3dc99 Remove extraneous channel assignment 2022-05-02 06:54:54 -04:00
300fb0411e Replace trigger_typing with awaiting typing context manager 2022-05-02 04:36:18 -04:00
9deac84eac Fix wrong variable being returned in audit logs 2022-05-02 04:34:01 -04:00
66c48c2d0e Add support for checks with autocomplete
Fixes #7969
2022-05-01 20:21:32 -04:00
d774b4ac7a Add back tuple __slots__ for AllChannels 2022-05-01 20:10:56 -04:00
11d4dfd8fa Update app_commands validation regex to match newest documentation 2022-05-01 20:01:46 -04:00
ca33824ba2 Change AllChannels.id into a property rather than a slot 2022-05-01 19:41:45 -04:00
7f210c90f4 Return a named tuple with message from ForumChannel.create_thread 2022-05-01 19:32:11 -04:00
a704666ce3 Add support for app_commands decorators for Group subclasses 2022-05-01 19:10:59 -04:00
e8a2eeea06 [commands] Rename Cog.app_command_group to Cog.app_command
This allows it to be consistent with hybrid commands
2022-05-01 19:04:53 -04:00
619bc50e5d Add application command permissions to audit log 2022-05-01 18:59:57 -04:00
5f0cf58b2e Revert "Run parent command checks before calling autocomplete callback"
This reverts commit 5e98626d41.

Fix #7978
2022-05-01 18:54:22 -04:00
0551214be1 [commands] Properly set default guilds for group to None instead of [] 2022-05-01 15:44:18 -04:00
e873b8294a [commands] Properly set group parent for hybrid commands in cogs 2022-05-01 15:01:30 -04:00
d39f9851a7 Add qualified_name for app_commands 2022-05-01 14:01:21 -04:00
f4c5d37c8f [commands] Rework Cog + Group inheritance to requite GroupCog
This is an attempt to fix the MRO issues present in the current
implementation. The previous implementation of using both Cog and
app_commands.Group in the inheritance chain caused issues with things
such as walk_commands due to it potentially shadowing the app_commands
version of the call.

In this particular case it's better to use composition instead of
inheritance to avoid these bugs entirely. Especially as more things are
added that could conflict with each other.
2022-05-01 14:01:21 -04:00
fedfe5bec2 Add PartialChannel to list of implementing classes for Messageable 2022-05-01 13:05:07 -04:00
0c613148af [commands] fix signature when displayed_default is missing
This makes it so that passing an empty string (or MISSING) to the 
displayed_default of commands.Parameter not show up as [name=] or [name=...]
2022-05-01 02:48:11 -04:00
5dd828cdac Add error decorator to app_commands.Group
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
2022-05-01 02:40:11 -04:00
5e98626d41 Run parent command checks before calling autocomplete callback
Fixes #7969
2022-04-30 19:53:27 -04:00
6ee56fe964 Fix remaining --verifytypes related errors 2022-04-30 19:43:53 -04:00
5536ef1eea Update to pyright 1.1.242 2022-04-30 19:37:01 -04:00
8be103d6bb Install requests in CI 2022-04-30 18:55:45 -04:00
165e14063f [commands] fix BucketType.default bypassing dynamic_cooldown 2022-04-30 18:46:37 -04:00
8e9e25246e Add an example for app_commands.rename()
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
2022-04-30 18:45:17 -04:00
61105ce925 Fix minor convention mistakes in basic examples
Co-authored-by: Narmy <67862800+NarmyOnDiscord@users.noreply.github.com>
2022-04-30 18:40:42 -04:00
14e83dff0e Adds two basic context menus for members and messages
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
2022-04-30 09:37:37 -04:00
58036ceeb8 Fix attribute error for role overwrite auditlog and add threads 2022-04-30 07:54:01 -04:00
0851e03f00 Allow creating a news channel in create_text_channel 2022-04-30 07:12:16 -04:00
20a7961e19 Rename use_slash_commands to use_application_commands
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
2022-04-30 06:53:29 -04:00
141c31e50f Update images used in discord.rst, etc 2022-04-30 06:13:14 -04:00
e7ce8b6b77 Add container operations documentation to TextInput 2022-04-30 03:58:11 -04:00
d437f494db Add basic slash command example
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
2022-04-30 03:55:29 -04:00
06df0d7931 Address latest breaking change in creating forum posts 2022-04-29 12:39:12 -04:00
ef20264b1c Allow creating an Intent through a passed integer value 2022-04-29 10:50:22 -04:00
9e3375f3fc Fix infinite recursion in TextChannel.type 2022-04-29 10:00:33 -04:00
7ee15e1d68 Use typing.Literal for channel and component type annotation 2022-04-29 06:07:22 -04:00
7fca030107 Add Group class arguments for permissions v2 2022-04-28 20:47:54 -04:00
71212872d8 Add build folder to .gitignore 2022-04-28 20:47:10 -04:00
10af1ea255 Document behavior for empty default permissions 2022-04-28 12:54:55 -04:00
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
e53daaba35 Properly namespace MISSING in the documentation 2022-04-28 10:56:31 -04:00
204f941e96 Display permissions v2 decorators in the documentation 2022-04-28 10:50:00 -04:00