Commit Graph

3722 Commits

Author SHA1 Message Date
e69428a841 Add with_counts support for Client.fetch_guild
Co-authored-by: Stocker <44980366+StockerMC@users.noreply.github.com>
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
2022-03-05 22:09:19 -05:00
bfaee44b1f [commands] Fix types for Bot.is_owner 2022-03-05 22:06:21 -05:00
13e102b6b9 Add default parameter to CommandTree.sync
I'm not sure how I feel about this, since explicitly passing
guild=None seems better.
2022-03-05 22:02:33 -05:00
7ac4f3007b Fix missing type imports in context menu verification 2022-03-05 21:43:14 -05:00
4c8b1f9abd Remove unused imports 2022-03-05 21:40:42 -05:00
3d0309ca4a Documenting that guild.chunk() returns list of members 2022-03-05 21:32:27 -05:00
5c9605fc1b Fix Message context menus not working 2022-03-05 21:15:49 -05:00
37d55c8ec4 Add TextInput.__str__ special method
Closes #7504
2022-03-05 21:05:46 -05:00
a317ceb44a Respect the alignment specified by the image directive 2022-03-05 21:05:46 -05:00
1c4dca431d Add migration guide
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
Co-authored-by: Rapptz <rapptz@gmail.com>
2022-03-05 19:17:16 -05:00
00b61e2148 Parameters->Attributes in NSFWChannelRequired's doc for consistency 2022-03-05 19:15:48 -05:00
8acb4531b5 Include inherited members in TeamMember's documentation 2022-03-05 19:15:08 -05:00
5439a67056 [tasks] Fix sleep handling behaviour depending on interval type
Relative time intervals can be thought of as:

  for _ in range(count):
    await body()
    await asyncio.sleep(interval)

While explicit time intervals should be thought of as:

  times = [1pm, 2pm, 3pm, 12am]
  current = 0
  for _ in range(count):
    time = times.wrapping_index(current)  # magic to wrap around
    await utils.sleep_until(time)
    await body()
    current += 1
2022-03-05 05:12:22 -05:00
f7315573aa Remove generic from Interaction and ConnectionState
This results in poor ergonomics due to the lack of default generics
for the common case. For most users this ends up in a degraded
experience since the type will resolve to Unknown rather than at the
very least a Client.
2022-03-05 05:03:23 -05:00
aa74238053 Reorganise documentation for interactions 2022-03-04 21:17:27 -05:00
41f2792ed9 Change Interaction.user to not be Optional
This has potential to be a breaking change and Discord could definitely
royally screw this over in the future. However, as far as I can tell
every interaction has either a User or a Member so this change should
be kosher. I'm unaware of any interaction, even in the future, where
this is not true.

I hope these are not my famous last words.
2022-03-02 02:11:04 -05:00
45dc3d3df9 Rename start_embedded_activities to use_embedded_activities 2022-03-02 01:51:47 -05:00
f80f81c395 Add Member.resolved_permissions attribute for interaction members 2022-03-02 01:39:39 -05:00
f435d160dd Add Interaction.client property 2022-03-01 08:11:22 -05:00
6110fe5b1c Add fallback overloads for CommandTree 2022-03-01 07:54:14 -05:00
147948af9b Use typing.Self throughout library 2022-03-01 07:53:24 -05:00
a90e1824f4 Fix type of roles param in Emoji.edit's docstring 2022-03-01 07:41:33 -05:00
50ef8e8893 Fix NameError when checking for File instances 2022-03-01 07:21:16 -05:00
f63eb5c30d Fix avatar clearing in ClientUser.edit 2022-03-01 06:47:28 -05:00
d44328d3ea Remove region from Guild.__slots__
This also fixes up some docstrings
2022-03-01 05:54:26 -05:00
bb5ed4947d Add regression test for optional normalisation
Also runs black on the tests file
2022-03-01 05:54:26 -05:00
26fc694189 Fix Optional normalisation not working properly 2022-03-01 05:42:44 -05:00
ae1aaac5a7 Add support for autocomplete 2022-03-01 05:42:44 -05:00
4e04dbdec7 Add support for choice option parameters
This implements it in three different ways:

* The first is using typing.Literal for quick and easy ones
* The second is using enum.Enum for slightly more complex ones
* The last is using a Choice type hint with a decorator to pass
  a list of choices.

This should hopefully cover most use cases.
2022-03-01 05:42:44 -05:00
e5e5b61ad0 Add support for range validation in options 2022-03-01 05:42:44 -05:00
3cf3065c02 Add support for annotation transformers
This facilitates the "converter-like" API of the app_commands
submodule. As a consequence of this refactor, more types are supported
like channels and attachment.
2022-03-01 05:42:44 -05:00
c10ed93cef Add support for error handlers 2022-03-01 05:42:44 -05:00
cdb7b3728e Fix potential conflicts in snowflake keys
This can happen on really old channels with the same ID as the guild ID
and having a command with both a role and a channel.
2022-03-01 05:42:44 -05:00
dffd72da58 Add support for context menu commands 2022-03-01 05:42:44 -05:00
0d2db90028 Implement slash commands 2022-03-01 05:35:29 -05:00
3d0c506124 Fix test_resolve_invite due to changed type 2022-03-01 01:07:13 -05:00
28c7cdca99 Baseline tests, basically just parts of utils right now 2022-03-01 01:02:36 -05:00
3c6279b947 Implement Guild Scheduled Events 2022-03-01 01:00:04 -05:00
90cabd1673 Fix various typos 2022-02-27 21:19:19 -05:00
32f131566f Update gateway version docstring in DiscordWebSocket 2022-02-27 21:18:41 -05:00
d5f23dbfc2 Fix docs for Guild.mfa_level 2022-02-27 21:18:01 -05:00
e44dd3dee5 Fix position of versionadded and add new versionchanged 2022-02-27 21:16:45 -05:00
60b69e5d57 Add missing message flags 2022-02-27 05:09:04 -05:00
8269e99a7a [types] Update typings to match API 2022-02-27 05:08:32 -05:00
e3ecfff85e Update PO files, fix some bad fuzzies 2022-02-27 05:07:18 -05:00
b3dae26a3d Add typing-extensions to docs requires 2022-02-27 05:06:34 -05:00
f1ac25809c [tasks] Fix behavior when task overruns interval
In a scenario with `tasks.loop(seconds=5)`:

The task takes 30 seconds to run on the first two iterations, and then
is nearly instant for iterations afterward. The behavior should be
that the task runs at:

t = 0  (on time)
t = 30 (late, should've been at t = 5)
t = 60 (late, should've been at t = 10)
t = 60 (late, should've been at t = 15)
t = 60 (late, should've been at t = 20)
t = 60 (late, should've been at t = 25)
... 6 more iterations
t = 60 (on time)
t = 65 (on time)

In a scenario with a loop with explicit times set at UTC 1pm, 2pm, 
3pm, 4pm, and 5pm:

- The task takes 6 hour to run on the first iteration, and then is
  nearly instant for iterations afterward. Assuming the task is started
  at noon, the behavior should be that the task runs at `t = 0` and
  then at `t = 3600` 4 times ("catching up" on the missed iterations
  at 2pm, 3pm, 4pm, and 5pm).

- The task takes 30 days to run on the first iteration, and then is
  nearly instant for iterations afterward. Assuming the task is started
  at noon, the behavior should be that the task runs at `t = 0` and
  then at `t = 43200` 149 times ("catching up" on the missed
  iterations for the past month).

This behavior should be documented in the ext.tasks docs
2022-02-26 01:48:27 -05:00
2b69b5d545 Remove discord.InvalidArgument
This uses TypeError and ValueError instead.
2022-02-26 01:44:49 -05:00
86797dd9ab Add reason param to purge and delete_messages
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
2022-02-26 01:27:28 -05:00
8226f0df2c [commands] Require number of parameters at instantiation time
This allows it to bypass annotation evaluation for arguments that don't
matter like self and context.
2022-02-25 10:55:45 -05:00