Commit Graph
100 Commits
Author SHA1 Message Date
Rapptz 7ed26db3b3 Add an exposed way to extract shard-specific information.
Closes #2654
2020-07-25 09:59:41 -04:00
Rapptz a42bebe581 Propagate exceptions when an unhandled error happens 2020-07-25 09:59:40 -04:00
Rapptz ec3c3eb4c6 Update message references in AutoShardedConnectionState
Fixes #5133
2020-07-25 09:59:40 -04:00
Rapptz d37b91dfc6 Add guild_ready_timeout to control the timeout of GUILD_CREATE stream
This also fixes a timing issue where READY would take far too long to
load for big bot authors.

Closes #4112
2020-07-25 09:59:40 -04:00
Rapptz e0660ef8a6 Add a timeout for receiving websocket messages. 2020-07-25 09:59:40 -04:00
Rapptz 137ff34f3a If we're out of retries just raise the OSError 2020-07-25 09:59:40 -04:00
Rapptz e2f42597a5 Handle Connection Reset by Peer connection errors.
This should work both on Windows and on Linux.

Apparently these types of blips are considered normal for Discord. So
rather than letting the reconnect logic handler expect these to be
catastrophic, it should handle it specially so it doesn't waste an
IDENTIFY for what ultimately should just be a small networking blip.

This also makes it less noisy for the end-user as these complaints
happen from time to time.
2020-07-25 09:59:40 -04:00
Rapptz 8070d39a23 Add shard related connection and resume events.
These include:
* on_shard_resumed
* on_shard_connect
* on_shard_disconnect
2020-07-25 09:59:39 -04:00
Rapptz 80cc5b5edb Handle connection errors during reidentify flow. 2020-07-25 09:59:39 -04:00
Rapptz f658fcf164 Make every shard maintain its own reconnect loop
Previously if a disconnect happened the client would get in a bad state
and certain shards would be double sending due to unhandled exceptions
raising back to Client.connect and causing all shards to be reconnected
again.

This new code overrides Client.connect to have more finer control and
allow each individual shard to maintain its own reconnect loop and then
serially request reconnection to ensure that IDENTIFYs are not
overlapping.
2020-07-25 09:59:39 -04:00
Rapptz 394b514cc9 Add before_identify_hook to have finer control over IDENTIFY syncing 2020-07-25 09:59:39 -04:00
Rapptz 9c7ae6b9dc Fix READY not firing for multi-processed AutoShardedClient clusters 2020-07-25 09:59:38 -04:00
Rapptz 058a1e608b Fix voice websocket connections 2020-07-25 09:59:38 -04:00
Rapptz 988505a97f Use a proper type for the event queue 2020-07-25 09:59:38 -04:00
Rapptz b8154e365f Rewrite gateway to use aiohttp instead of websockets 2020-07-25 09:59:38 -04:00
Rapptz 45cb231161 Fix AttributeError on reconnection 2020-07-25 09:59:38 -04:00
Rapptz 3afbbf5e47 Can't use %d in here 2020-07-25 09:59:37 -04:00
Rapptz ba35c2b9bf Add shard ID to keep alive logger messages 2020-07-25 09:59:37 -04:00
Rapptz 09ecb16680 Rewrite of AutoShardedClient to prevent overlapping identify
This is experimental and I'm unsure if it actually works
2020-07-25 09:59:37 -04:00
Rapptz 2628949cda Add a changelog entry for v1.3.4 2020-07-22 23:37:33 -04:00
Rapptz 4de01212a4 Fix detection of some JPEG images without JFIF or Exif info
Closes #5143
2020-07-21 22:56:51 -04:00
Rapptz 0bc15fa130 Don't use a namedtuple for _Overwrites
Fix #5109
2020-07-08 23:18:13 -04:00
Rapptz f94b00cb48 Fix a KeyError for channels with no category in Guild.by_category 2020-06-27 05:27:47 -04:00
Rapptz c01bf7cd56 Fix Guild.by_category not showing empty categories. 2020-06-27 04:06:49 -04:00
Rapptz de7c96333c Update Message.system_content join strings to be up to date.
Fixes #4211
2020-06-27 03:45:27 -04:00
Rapptz cbdf660ddc Document that sleep_until considers naive datetimes as UTC. 2020-05-29 02:59:31 -04:00
Rapptz 1ee1b7feea Consistent usage of RST inline code within Guild.features references 2020-05-23 22:05:59 -04:00
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