Commit Graph
100 Commits
Author SHA1 Message Date
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
Rapptz f47568ee71 Document Guild.bans breaking change in the migrating guide 2022-04-01 11:47:27 -04:00
Rapptz e79895d824 Add Message.interaction and MessageInteraction type
Fix #7819
2022-04-01 11:15:15 -04:00
Rapptz a5f1c2f592 Take into consideration member timeouts in permission calculations 2022-04-01 09:32:54 -04:00
Rapptz 25ad5b675c Ensure explicitly set parents on nested groups are respected
This had a multiple layer bug that needed to be squashed. The first
issue was that setting `parent=...` inside a `Group` wouldn't actually
add the `Group` into the `parent` children mapping. This meant that
it didn't actually end up copying the children when it came time to
within e.g. a Cog.

The second issue was that even if it was added into the children
listing, it wouldn't properly set the attribute.

This commit fixes both of these issues.

Fix #7818
2022-04-01 09:13:27 -04:00
Rapptz c671308211 Validate app command parameter renames 2022-04-01 07:02:37 -04:00
Rapptz 6986733833 Revert "Validate Option names similar to slash command names"
This reverts commit 6ef2043b10.
2022-04-01 06:58:11 -04:00
Rapptz ca9fd355e8 Fix typo in Guild.bans docstring 2022-04-01 00:26:33 -04:00
Rapptz 9acf1db076 Support ban endpoint pagination 2022-04-01 00:09:02 -04:00
Rapptz 6ef2043b10 Validate Option names similar to slash command names 2022-04-01 00:09:02 -04:00
Rapptz 5096846c4e Allow None to be passed for Member.timeout 2022-04-01 00:09:02 -04:00
Rapptz 24f8f8d4a7 Rename MaxCommandsReached to CommandLimitReached 2022-03-31 23:10:13 -04:00
Rapptz a0618ef791 Clarify documentation certain tree methods 2022-03-31 10:31:48 -04:00
Rapptz 34b2ff40b6 Change ValueError on max commands reached to a more specific exception 2022-03-31 09:34:48 -04:00
Rapptz 705c79df59 Remove second mapping used for parameter rename lookup
Just keying into param.display_name should be enough
2022-03-31 08:58:53 -04:00
Rapptz dfc92c223c Fix application commands not always sending the proper parameter name 2022-03-31 08:55:20 -04:00
Rapptz 170ab7b2bb Improve error when an invalid slash command name is given 2022-03-31 04:12:09 -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
Rapptz b4fbb08818 Allow runtime modification of timeout expiry at runtime
This is done through setting View.timeout while it's running
2022-03-31 01:54:13 -04:00
Rapptz ff24c5229e Add iterator special method for Namespace
Fix #7812
2022-03-30 21:45:30 -04:00
Rapptz b1fb5ed3d7 Fix autocomplete not working with renamed parameters
Fix #7810
2022-03-30 19:46:27 -04:00
Rapptz e515378076 Remove annotation on row property in subclasses 2022-03-29 23:04:34 -04:00
Rapptz 3215cb65e2 Raise if custom_id is not a str 2022-03-29 23:04:34 -04:00
Rapptz b7b992375d Add examples for new cooldown checks 2022-03-29 06:02:41 -04:00
Rapptz 9f83eb6032 Add application command cooldown decorators
Fix #7790
2022-03-29 00:46:42 -04:00
Rapptz 74b5e0ceb1 Implement some built in checks for app_commands
A lot of these implementations are adapted from the equivalent
ext.commands checks. These only implement the common ones that could
not solely be done by Discord in the future.
2022-03-28 16:36:29 -04:00
Rapptz def035bf9a Remove StoreChannel and any references to it 2022-03-28 00:09:19 -04:00
Rapptz 0a7eb6b021 Only verify if context menus pass a length check
According to Discord this is the check that is actually done
2022-03-27 23:32:36 -04:00
Rapptz 985f5732c0 Refactor ContextMenu constructor to allow app command type inferring 2022-03-25 09:11:11 -04:00
Rapptz 816d2176e9 Ignore type error already handled by exception handling 2022-03-24 23:50:47 -04:00
Rapptz 8591cfc5e7 Run black on all examples and require it for CI 2022-03-24 23:40:59 -04:00
Rapptz 968a1f366f Change View callback order to (self, interaction, item)
This is more consistent with the rest of the library which always has
the interaction as the first parameter. This has been done before in
the command extension as well, the first parameter is always either
self or the context.
2022-03-24 23:00:50 -04:00
Rapptz e9ed231a03 Allow Transformer.transform to be synchronous as well. 2022-03-22 22:44:42 -04:00
Rapptz 1f3aa377c3 Wrap non-AppCommandError exceptions with TransformerError 2022-03-22 19:07:22 -04:00
Rapptz b0501e56a0 Fix PermissionOverwrite.update typing not allowing None 2022-03-22 18:55:42 -04:00
Rapptz 7851084b63 Revert "Crowdin translations download"
This reverts commit 414759f372.
2022-03-21 22:53:45 -04:00
Rapptz 84c38f1f22 Ignore errors if it's already handled in app commands 2022-03-21 04:07:05 -04:00
Rapptz f7c664e3e2 Add error handler support for context menus 2022-03-21 03:56:28 -04:00
Rapptz cf2707b2fb Propagate thread_id in webhook message methods
This also adds the remaining thread parameters where they were missing
2022-03-20 19:43:51 -04:00
Rapptz 2876622f84 Fix typo in app command check documentation 2022-03-19 15:48:00 -04:00
Rapptz 195c923bec Fallback to Object if the type is not resolved in namespace 2022-03-19 01:38:16 -04:00
Rapptz bea6b815e2 Add support for app command checks
This does not include any built-in checks due to design considerations.
2022-03-19 01:24:53 -04:00
Rapptz 5f7c5abe0a Change ban type hints to use int instead of Literal 2022-03-18 21:45:15 -04:00
Rapptz 77ec49782a Add http_trace option in Client to trace the library's HTTP requests 2022-03-18 08:02:53 -04:00
Rapptz 4a76464ac9 Fix return value of Guild.chunk 2022-03-18 07:37:28 -04:00
Rapptz 02b79eb219 [commands] Change BotT to be covariant 2022-03-18 01:13:50 -04:00
Rapptz 98a31cf285 Change autocomplete callbacks to only take two parameters
The old namespace parameter can be retrieved using the
Interaction.namespace property instead, which leads to somewhat cleaner
code.
2022-03-17 10:13:09 -04:00
Rapptz d2f6b05c43 Fix missing List -> Sequence typehint in interaction message edit 2022-03-17 10:00:03 -04:00
Rapptz f5341a1cfa Document cases where setup_hook can deadlock rather than raising 2022-03-17 09:56:25 -04:00
Rapptz 202b993da3 Add Interaction.command and Interaction.namespace attributes 2022-03-17 09:45:21 -04:00
Rapptz 3c6daff473 Change default ellipsis descriptions to use U+2026 2022-03-17 07:37:33 -04:00
Rapptz c77bbc4dcf Move with_counts parameter documentation where it belongs 2022-03-16 07:43:31 -04:00
Rapptz 5b8bcaff73 Validate and bind parent in Group.add_command 2022-03-16 07:32:01 -04:00
Rapptz 7c0a9e901d Fully initialise asyncio state in __aenter__ 2022-03-16 05:51:25 -04:00
Rapptz 575eacb1bf Change loop sentinel error to not use a tuple
This was an unintentional error
2022-03-16 05:50:28 -04:00
Rapptz 1fba54ce97 Reword DeletedMessageReference docstring to be clearer 2022-03-16 05:12:26 -04:00
Rapptz 1192d842e1 Fix some type checker errors and remove some type ignores
Caught from an upgraded Pyright
2022-03-16 01:46:58 -04:00
Rapptz 6d75d2e937 Fix unnecessary type ignores in gateway 2022-03-16 01:19:45 -04:00
Rapptz d2b69ce19a Downgrade unnecessary type ignore into a warning instead of error 2022-03-16 01:01:18 -04:00
Rapptz 380e9118d5 Temporarily change Crowdin upload to be a manual workflow dispatch 2022-03-16 00:42:06 -04:00
Rapptz 61577677cd Fix Guild.fetch_members limit parameter typing to be Optional 2022-03-16 00:39:05 -04:00
Rapptz caf1c6eae4 Fix overload in StoreChannel 2022-03-16 00:13:39 -04:00
Rapptz 446c502995 Change lowercase detection to work with CJK languages
str.islower() does not properly work with characters in the Lo category
so CJK languages fail the check.

Fix #7698
2022-03-15 23:37:54 -04:00
Rapptz 26457b6d50 Remove automatic defer behaviour from View and Modal
This doesn't make as much sense anymore now that
InteractionResponse.edit_message exists.
2022-03-15 10:30:19 -04:00
Rapptz 8ced1143e3 Change missing application ID error to be more descriptive 2022-03-15 07:22:44 -04:00
Rapptz 27dd986858 Forbid Choice annotations being used with autocomplete parameters
Since the Choice are synthetic, the library doesn't have a
pre-populated list of choices to know what to use as the resulting
value.
2022-03-15 07:09:41 -04:00
Rapptz 698d1e12a1 Add CommandTree.error decorator to set on_error dynamically 2022-03-15 06:57:25 -04:00
Rapptz 2bf612cd67 Fix Client.close erroring if done before proper async initialisation 2022-03-15 06:51:19 -04:00
Rapptz 20aa6f866d Fix CommandTree removal and getter overloads 2022-03-15 03:34:04 -04:00
Rapptz f015b59e43 Add CommandTree.walk_commands and Group.walk_commands 2022-03-15 03:24:20 -04:00