Commit Graph

3355 Commits

Author SHA1 Message Date
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
fd5dea4e34 Update Permissions.stage_moderator 2022-03-15 23:33:11 -04:00
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
e5461c73b6 [commands] Check if any base in a Cog is a subclass of Group 2022-03-15 09:50:49 -04:00
8ced1143e3 Change missing application ID error to be more descriptive 2022-03-15 07:22:44 -04:00
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
698d1e12a1 Add CommandTree.error decorator to set on_error dynamically 2022-03-15 06:57:25 -04:00
2bf612cd67 Fix Client.close erroring if done before proper async initialisation 2022-03-15 06:51:19 -04:00
20aa6f866d Fix CommandTree removal and getter overloads 2022-03-15 03:34:04 -04:00
f015b59e43 Add CommandTree.walk_commands and Group.walk_commands 2022-03-15 03:24:20 -04:00
5bc085ebab Properly set root parent before copying a command's binding 2022-03-15 03:24:20 -04:00
ca4db68686 Fix grammar issue for Message.add_reaction docs 2022-03-14 22:51:28 -04:00
aa006f345a Add more special methods to Namespace for ease of use.
* __getattr__ would allow it to no longer AttributeError while
  simultaneously letting linters and type checkers understand that
  this is a bag of dynamic attributes.
* __contains__ allows checking for the existence of an attribute
* __getitem__ allows accessing a value even if its name is not a valid
  Python identifier.
2022-03-14 22:49:47 -04:00
f0a47f5a40 Allow single element Literal in app commands
Fix #7690
2022-03-14 21:17:00 -04:00
47cb7d03ec [commands] Type BotBase.help_command as Optional 2022-03-14 21:02:36 -04:00
68dbf0f882 [commands] Fix message converter not inferring channel when missing 2022-03-14 21:01:14 -04:00
3fd8f76c61 Add missing underscore in Modal refresh method 2022-03-14 21:00:39 -04:00
934ab4151a Mark state refresh methods as private with an underscore
People kept wondering what it is or what it does.
2022-03-14 07:50:25 -04:00
6dd8845e4f Fix Guild.audit_logs order being reversed without oldest_first and after 2022-03-14 06:23:40 -04:00
9b77331603 Change loop sentinel to provide a more descriptive error message
This way people don't think it's a bug. I imagine some people won't
read it, but at least when you point it out they might get it.
2022-03-14 05:52:35 -04:00
aa18e573c3 Mark MISSING as hashable to allow it to be used in dataclasses in 3.11 2022-03-14 05:45:58 -04:00
abcec5da9d [tasks] Use the local timezone when comparing for the start time
Fix #7676
2022-03-14 04:54:56 -04:00
3e70a4e798 Fix typo in add_cog doc 2022-03-14 01:33:34 -04:00
c6ab67420e Remove Embed.Empty in favour of None 2022-03-14 00:52:55 -04:00
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
603681940f [tasks] Only correct for clock drift if an explicit time is given 2022-03-13 22:51:10 -04:00
f2586e9fe7 [tasks] Handle imaginary or ambiguous times due to DST transitions 2022-03-13 22:45:18 -04:00
a1c618215e [commads] Change cog/extension load/unload methods to be async 2022-03-13 21:03:45 -04:00
a339e01047 [tasks] Compare using full datetime rather than sole time
Comparisons using just the time object without an attached date
are pretty buggy and incomplete -- comparisons only make sense when
given a particular instant of time.

Ref: #7676
2022-03-13 20:45:05 -04:00
58ad146a4e Remove window re-assignment in gateway rate limiter
This was a hold over from the old cooldown implementation.
2022-03-13 12:09:07 -04:00
c0890bfbc1 Remove unused View._expires_at private function 2022-03-13 11:50:09 -04:00
64c6639f4b [tasks] Handle loop functions running multiple times due to clock drift 2022-03-13 11:36:00 -04:00
9c61e10a55 Move all async object creation to a proper initialisation point
This should make it so no object is created with another loop
2022-03-13 08:33:25 -04:00
8d4f08a5e7 Fix AutoShardedClient to work with the new asyncio loop machinery
Fix #7675
2022-03-13 08:05:44 -04:00
6a43d60acf [tasks] Refactor tasks to not store a time index state
It's better to recompute it every time rather than suffer from
maintaining the extra state.
2022-03-13 06:20:44 -04:00
c02a3c0bb2 Add asynchronous context manager support for Client 2022-03-13 05:04:55 -04:00
93af158b0c Refactor loop code to allow usage of asyncio.run 2022-03-13 04:54:14 -04:00
5e9097179b Add CommandTree.copy_global_to method for quick development 2022-03-12 21:32:35 -05:00
3718192b9c Raise a TypeError if a non-View is passed to Webhook.send 2022-03-12 21:01:07 -05:00
42beec9fa9 Fix bug when app commands would not have a module attribute set on copy 2022-03-12 20:55:08 -05:00
d63fd578c2 Change TextChannel annotation channel_types to include news channels 2022-03-12 20:51:32 -05:00
5f2d9a9ffa Fix state parameter in Interaction.edit_original_message 2022-03-12 20:50:01 -05:00
342652c8ad Document NotFound for Interaction original_message methods 2022-03-12 20:49:06 -05:00
6def5c9131 Allow specifying float default values for app commands 2022-03-12 09:41:28 -05:00
68b7ee6b99 Add Client.setup_hook 2022-03-12 09:39:43 -05:00
1d1bba1f90 Support app_commands.guilds decorator for context menu commands 2022-03-12 09:28:46 -05:00
0ef369c0fa [commands] Automatically unload top level app commands in extensions 2022-03-12 09:24:26 -05:00
a672455ca9 Fix some context menu commands not being registered in guild contexts
This happened when there weren't any application commands due to a typo
stemming from a copy paste error.

Fixes #7650
2022-03-12 08:39:57 -05:00
d68f2db7cb [commands] Always respect guild IDs passed to cog adding and removal
Fixes #7657
2022-03-12 06:58:55 -05:00
d921a03911 Fix bug where Guild.member_count would clear during update events
Fix #7656
2022-03-12 04:19:52 -05:00