2156 Commits

Author SHA1 Message Date
Rapptz
e21d49c980 [commands] Only clean semaphore when there are no waiters 2020-01-21 19:50:37 -05:00
Rapptz
d9cd4a3561 [commands] Implement Command.__call__ 2020-01-21 04:27:20 -05:00
Rapptz
02397306b2 Drop superfluous zero in version related changes in the documentation 2020-01-21 03:47:56 -05:00
Rapptz
08c90668cd [commands] Be more clear in the default error for MaxConcurrencyReached 2020-01-21 03:34:18 -05:00
Rapptz
1a7b838d2a [commands] Refactor BucketType to not repeat in other places in code 2020-01-21 03:30:56 -05:00
Rapptz
bf84c63396 [commands] Add max_concurrency decorator 2020-01-21 03:26:41 -05:00
Rapptz
3149f15165 [tasks] Use new sleep_until util instead of internal function 2020-01-21 03:21:22 -05:00
Josh B
40369a493d Add discord.utils.sleep_until helper function 2020-01-21 03:18:25 -05:00
Josh B
d7e925eb89 [tasks] Fix issue with next_iteration when task overruns time allotted 2020-01-21 03:18:25 -05:00
Josh B
a0b3e61b51 [tasks] Add Loop.next_iteration property 2020-01-20 07:22:21 -05:00
Rapptz
6ed0ae7d96 Fix fetching invites for a GroupChannel.
Closes #2394
Fixes #2383
2020-01-20 07:14:27 -05:00
Hugo Woesthuis
ee6f4e85d6 [commands] Allow @ prefixed usernames in DM contexts for UserConverter
Previously the argument '@user#0000' return None.
To fix this, as this is a common user error, an extra check was added
 to remove the first character from the argument if this is an '@'.
 Discord names may not contain an '@' anyways.
2020-01-20 07:14:27 -05:00
Rapptz
4cf02c9461 Update attachment documentation for width/height applying to videos too 2020-01-20 00:10:37 -05:00
Rapptz
6071607176 Bump copyright year to 2020
Closes #2510
2020-01-19 20:03:00 -05:00
Rapptz
9f2018f439 [commands] Case insensitivity uses casefold instead of lower
There seems to be very little performance regression in doing so (+5ns)
so might as well go for the more correct behaviour.
2020-01-19 19:49:50 -05:00
Willy
43e38654e9
Added docs for overwrites kwarg for CategoryChannel.edit 2020-01-19 15:42:27 -05:00
Rapptz
650beee53d Add instance check to PermissionOvewrite.__eq__ 2020-01-19 02:41:50 -05:00
Rapptz
a1d41f16d8 Document NotFound exception raise in message deletion endpoints 2020-01-18 21:37:06 -05:00
Rapptz
a2b241446e [commands] Document BucketType separately 2020-01-18 20:04:00 -05:00
Rapptz
97d1c970bf [commands] Context.send_help properly sends to on_help_command_error 2020-01-18 19:43:20 -05:00
Rapptz
87f9dcff9c Add support for clearing a specific reaction.
Closes #2440
2020-01-17 19:53:28 -05:00
Rapptz
7b2c01c48a Add support for on_invite_create and on_invite_delete 2020-01-17 19:20:53 -05:00
Rapptz
23f16618fd Make CustomActivity.__str__ not raise errors and match the client 2020-01-15 09:27:32 -05:00
apple502j
7af8b313e5 [commands] Add missing async in documentation 2020-01-14 23:46:46 -05:00
Rapptz
5f7a97ff96 Document BaseActivity 2020-01-14 22:09:24 -05:00
Zomatree
1b4b6f8da2 updated the docs for Guild.vanity_invite 2020-01-14 22:07:38 -05:00
Zomatree
4b826a894c
removed parameter section in Asset.read 2020-01-15 02:06:38 +00:00
Rapptz
42a084028c Expose _ActivityTag as BaseActivity to easily refer to. 2020-01-14 20:56:00 -05:00
Rapptz
a841efa087 Add support for custom activities
It's been long enough.

Fixes #2400
2020-01-14 20:37:48 -05:00
Rapptz
e5870903f5 [commands] Force the predicate attribute in checks to be a coroutine 2020-01-14 20:13:33 -05:00
Rapptz
cd9135b082 Rewrite on_ready delay to actually make sense and prevent heavy sleep 2020-01-14 19:52:06 -05:00
NCPlayz
f95ccf53e0 Fix issue with shard_ready not dispatching when not fetching offline 2020-01-14 19:39:34 -05:00
Michael H
6cdda4a320 Patch clean_prefix for new text editor
The new editor seems to force mentions to have ! even without a nick.
2020-01-14 19:39:34 -05:00
Rapptz
e91675291e Fix bug preventing movement of channels when there are gaps in position
The original code was too aggressive in ensuring that the channel
positions are correct and within bounds. Unfortunately, for Discord
this number is merely a guess and there can be gaps that cause the
position number to be greater than the number of channels currently
in that sorting bucket.

One such example of this is when a channel is deleted and created. When
this happens, the positions are not updated (presumably because Discord
considers this to be too expensive). Sadly this means that if a user
were to create a channel, delete a channel, and then create another one
then there will be gaps in the position sequence.

More concretely, consider the following example:

Channels with position [0, 1, 2, 3, 4]. A new channel is created so it
inherits the maximum position giving us [0, 1, 2, 3, 4, 5]. We delete
a channel that's smaller than the maximum so our list now looks like
[0, 1, 2, 4, 5]. Next time we create a channel we will further
increment the gap, giving us [0, 1, 2, 4, 5, 6]. If a user would want
to move the channel with position 4 to be after position 6 (so in this
case that value would 7) then the library would erroneously raise an
error because it assumed too much about the data integrity.

Luckily, the library upon actually doing the request fixes the channel
positions so everything goes back to normal like it was intended. That
is to say, [0, 1, 2, 3, 4, 5].
2020-01-12 03:27:48 -05:00
Rapptz
bfaf8ecfdb Allow Guild.fetch_members to take in limit=None
Fixes #2473
2020-01-12 02:44:16 -05:00
Rapptz
2770137bd6 Redesign permissions to allow aliases to be used.
This adds manage_permissions, view_channel, and use_external_emojis
aliases to Permissions. It should be noted that to prevent breaking
changes and for sake of usefulness, aliases are not included in
the `__iter__` for either Permissions or PermissionOverwrite.

Fixes #2496
2020-01-11 19:52:25 -05:00
Rapptz
de5caf59d6 Cache member.roles access to avoid surprising performance traps
Without the cache, repeated access could be accidentally quadratic or
worse.
2020-01-06 22:13:35 -05:00
Rapptz
ae3dac0d59 [commands] Add check_any check to OR together various checks 2020-01-06 22:03:56 -05:00
Rapptz
51546dbdb6 [commands] Document the changed Command.can_run behaviour 2020-01-06 04:02:56 -05:00
Rapptz
f1118273f5 Fix Member.mentioned_in returning True if in separate guilds 2020-01-06 00:30:04 -05:00
Rapptz
527b3485dc [commands] Make Command.can_run process disabled commands 2020-01-06 00:30:04 -05:00
NCPlayz
787d424dce Add VoiceRegion.dubai 2020-01-06 00:30:04 -05:00
Rapptz
195b5188e8 Add Attachment.to_file to easily send an attachment.
The first thing someone will ask when someone sees this method is
"Why doesn't `send` just accept `Attachment`?". This question is fair
but it has an issue: exception propagation becomes confusing.

When we save a file and write it to memory an HTTP request is sent
similar to other API calls. Like all HTTP requests, these can fail.
Since these requests denote failure using HTTPException, if it were to
originate within `send` then it becomes confusing to know whether the
attachment saving itself failed or whether the sending failed.

For that reason, and to keep in-line with only 1 type of HTTP call per
method, it doesn't make sense for `send` to support `Attachment`.
2020-01-03 20:42:45 -05:00
Rapptz
6847f13198 Document that widget members may be incomplete.
See https://github.com/discordapp/discord-api-docs/issues/1287
2019-12-29 04:19:08 -05:00
Rapptz
fdab6e464f Remove unnecessary pass using regex in Message.clean_content
The utils.escape_mentions should deal with it
2019-12-25 04:19:27 -05:00
Michael H
6794bdaac5 Use discord.utils.escape_mentions as last step of
discord.Message.clean_content
2019-12-25 04:13:10 -05:00
Christian Clauss
f9b8b234e3
Typo: AuditLogActionCategory 2019-12-23 00:49:17 +01:00
Rapptz
c92ca4ee07 Add Profile.system and Profile.team_user to query newer flags 2019-12-21 07:46:15 -05:00
Rapptz
2de90fbecf Add User.system and MessageFlags.urgent 2019-12-21 07:39:33 -05:00
Rapptz
f7687e0a68 Clean up flag code significantly.
This also fixes the False setting bug.
2019-12-20 21:18:31 -05:00