Commit Graph
100 Commits
Author SHA1 Message Date
Rapptz 66c6be50d8 Prepare for the discord.com domain rename 2020-05-23 21:44:30 -04:00
Rapptz 13a3f760e6 Fix timeout issues with fetching members via query_members
This uses the nonce field to properly disambiguate queries. There's
also some redesigning going on behind the scenes and minor clean-up.
Originally I planned on working on this more to account for the more
widespread chunking changes planned for gateway v7 but I realized that
this would indiscriminately slow down everyone else who isn't planning
on working with intents for now.

I will work on the larger chunking changes in the future, should time
allow for it.
2020-05-10 19:35:45 -04:00
Rapptz 1f73e18bc6 Make use_cached keyword only 2020-05-03 01:58:52 -04:00
Rapptz e473f3c775 Convert id parameter of Object into int or raise TypeError on failure
This prevents breakage for users who pass in a str as an ID whereas
it previously worked.

Fix #4002
2020-04-19 18:33:03 -04:00
Rapptz 0d5e6e213c Decrement Guild.member_count even if member is not cached
Fix #4021
2020-04-19 18:22:41 -04:00
Rapptz 9f47d7f71c Fix cases where member_count is equal to 0
Fixes #4008, #4005
2020-04-16 23:30:59 -04:00
Rapptz 540a88b762 [tasks] Replace stack-based implementation with a cleaner one. 2020-04-14 04:56:52 -04:00
Rapptz d5211fb327 [tasks] Create different Loop objects for different instances
Fixes #2294
2020-04-14 04:35:49 -04:00
Rapptz 11211d48eb Bump blocking threshold from 5 seconds to 10 seconds 2020-04-14 04:22:05 -04:00
Rapptz d6be6adf8b Add traceback to debug blocking issues 2020-04-14 04:21:20 -04:00
Rapptz 874c2cd3c9 [commands] Raise CheckFailure if all bot "check once" fail
Fix #2643
2020-04-06 21:45:16 -04:00
Rapptz 8874aa3dd2 Move log levels around to make INFO a little less noisy 2020-04-06 05:22:57 -04:00
Rapptz 9a52786aa9 Bump version for development 2020-04-06 05:00:33 -04:00
Rapptz 7433cf3b16 Fix VoiceClient.average_latency erroring when heartbeat is None 2020-04-06 04:58:27 -04:00
Rapptz 8ff285fcbc Documentation fixups for allowed mentions 2020-04-04 13:32:47 -04:00
Rapptz d853a57e86 Rename allowed mention parameters to allowed_mentions 2020-04-04 13:22:51 -04:00
Rapptz 730d79d60a Allow introspection and setting of global allowed mention configuration 2020-04-04 12:49:39 -04:00
Rapptz 481b335f2d Fix various implementation bugs with allowed mentions 2020-04-04 12:45:17 -04:00
Rapptz 041785937e Add support for configuring allowed mentions per message or bot wide. 2020-04-04 07:40:51 -04:00
Rapptz 6c764465c0 Fix regression with Member.activities not clearing 2020-04-04 03:17:31 -04:00
Rapptz baffe564e5 Version bump to v1.3.3 2020-04-04 01:50:13 -04:00
Rapptz 465438fb3c Add changelog for v1.3.3 2020-04-04 01:47:01 -04:00
Rapptz 403651a144 Change default close code to 4000 instead of 1000.
This prevents our sessions from being invalidated by Discord which
caused a lot of failures when resuming. This caused an unnecessary
amount of IDENTIFYs to happen depending on the circumstances.

Closes #2631

See also discord/discord-api-docs#1472
2020-04-04 01:42:08 -04:00
Rapptz 5e63357508 Bump version to v1.3.2 2020-02-22 19:35:42 -05:00
Rapptz 07720fabd4 Add changelog for v1.3.2 2020-02-22 19:33:27 -05:00
Rapptz 00f6562728 Suppress missing Content-Type headers when fetching content
Fixes #2572
2020-02-22 19:07:17 -05:00
Rapptz 4cf5f792d4 Fix Webhook.send returning an empty string when wait=False 2020-02-16 21:52:20 -05:00
Rapptz af6a5efa53 Fix crashes when Message.guild is Object 2020-02-16 21:52:20 -05:00
Rapptz bb1c1e9fa3 [commands] Raise when passing invalid permission keys in their checks 2020-02-02 19:11:50 -05:00
Rapptz cbca33e44f Guard against the member data not being available in VOICE_STATE_UPDATE 2020-02-01 23:48:09 -05:00
Rapptz 25a04ed135 Better detection for Cloudflare related 429s.
At some point Cloudflare started returning some JSON. I don't know how
this JSON looks like.

See #2544
2020-02-01 23:46:28 -05:00
Rapptz 3b8678da81 Use member data from VOICE_STATE_UPDATE if not found in cache 2020-02-01 23:40:25 -05:00
Rapptz 5c7df3d943 Bump waiting time of GUILD_CREATE stream by number of shards waited.
2 seconds might be too short and cause it to finish waiting while other
shards are still IDENTIFYing.
2020-01-28 23:56:46 -05:00
Rapptz 8767c478ed Version bump to v1.3.1 2020-01-26 17:40:34 -05:00
Rapptz 090110eaf6 Add changelog for v1.3.1 2020-01-26 17:40:08 -05:00
Rapptz b9e6ed28a4 Downgrade unknown event logging to DEBUG rather than WARNING
It's too noisy
2020-01-26 09:22:42 -05:00
Rapptz d5589dcc27 Document the new opus loading behaviour 2020-01-25 22:21:14 -05:00
Rapptz 0033cc83ef Fix fetching invites on guilds the user is not in 2020-01-25 03:29:14 -05:00
Rapptz a2a02ea945 Version bump to v1.3 2020-01-24 19:32:25 -05:00
Rapptz 215fed831c Mention that you can create Permissions via kwargs now 2020-01-23 00:04:45 -05:00
Rapptz 2ba28bbfe2 One last superfluous .0 in versionadded 2020-01-22 21:12:02 -05:00
Rapptz 956b155cc5 Fix up some links and mention IDENTIFY change 2020-01-22 20:58:15 -05:00
Rapptz cecd45d503 Add changelog for v1.3 2020-01-22 20:44:58 -05:00
Rapptz eddbe27f2e Fix out of order files being sent in webhooks when there are 10 files. 2020-01-22 20:05:00 -05:00
Rapptz 17f343b03e Minor documentation fixes 2020-01-21 21:34:58 -05:00
Rapptz 706a333287 Add missing coroutine header for sleep_until 2020-01-21 20:39:15 -05:00
Rapptz e21d49c980 [commands] Only clean semaphore when there are no waiters 2020-01-21 19:50:37 -05:00
Rapptz 733962df12 Drop final 0 in versionadded numbers in api.rst 2020-01-21 19:48:52 -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 4de314d2c3 [commands] Export max_concurrency and MaxConcurrencyReached in docs 2020-01-21 03:35:43 -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
Rapptz 6ed0ae7d96 Fix fetching invites for a GroupChannel.
Closes #2394
Fixes #2383
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
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
Rapptz 5f7a97ff96 Document BaseActivity 2020-01-14 22:09:24 -05: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 82797b0e60 [commands] Add missing CheckAnyFailure documentation 2020-01-14 19:54:10 -05:00
Rapptz cd9135b082 Rewrite on_ready delay to actually make sense and prevent heavy sleep 2020-01-14 19:52:06 -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 92a3c1b583 [commands] Document guild permission checks 2020-01-07 04:50:52 -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
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
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
Rapptz fe1ebb3144 Default the Streaming name to the one passed for user created ones. 2019-12-19 21:26:41 -05:00
Rapptz d9a8ae9c78 [commands] Add predicate attribute to checks to get inner function 2019-12-18 01:20:50 -05:00
Rapptz ec4962a14c Wait 5 seconds before IDENTIFYing with an invalidated session. 2019-12-17 23:34:49 -05:00
Rapptz 1179df7e29 [commands] Make Greedy ignore parsing errors. 2019-12-17 00:27:56 -05:00
Rapptz 7045639adc Fix KeyError for things without a created_at 2019-12-05 04:36:04 -05:00
Rapptz c62b6c3e88 Fix more deprecation warnings for 3.8 2019-11-26 05:19:11 -05:00
Rapptz 4ef0fb0d95 Fix more deprecation warnings 2019-11-20 03:04:04 -05:00
Rapptz 1b040fd4ba Fix one more remaining loop passing for 3.8 in a Lock 2019-11-20 02:37:00 -05:00
Rapptz a6f61dcbde Fix all deprecation warnings for 3.8 2019-11-20 02:30:19 -05:00
Rapptz 924398c1ac Trailing whitespace in documentation. 2019-11-20 01:43:01 -05:00
Rapptz 45f342ff79 Fix regression with references being overwritten from the cache.
A proper fix for this would be to just request presence information
as well since the chunk request would probably be more up to date than
the current cache. However this delta requires a little bit more work
and will be done later.
2019-11-20 01:41:23 -05:00
Rapptz 15f0b000e1 Move PartialEmoji over to a new namespace to avoid circular imports 2019-11-20 00:50:19 -05:00
Rapptz e1a237a0d3 Revert "[tasks] Add Loop.exception for more reliable exception retrieval."
This reverts commit 7a8c9e66d9.
2019-11-19 21:59:39 -05:00