Rapptz
ab049e3eb0
Allow finer grained control over the member cache.
2020-09-14 03:20:36 -04:00
Rapptz
6f22ba8ad0
Raise if member intent is not enabled
2020-09-14 03:20:17 -04:00
Rapptz
f3514a4d53
Don't cache members during guild start up if cache is disabled.
...
This is mainly a half-implemented commit. There are a few more places
where cache consistency is necessary. In the future there will
probably be a member cache policy enum that will be used and cache
consistency will be tackled in part of that larger refactoring.
2020-09-14 03:20:17 -04:00
Rapptz
141511471e
Add Guild.chunk and deprecated Client.request_offline_members
2020-09-14 03:20:16 -04:00
Rapptz
27558ec71a
Fix Client.request_offline_members no longer working
2020-09-14 03:20:16 -04:00
Rapptz
a6edb66742
Add versionadded for intents enum
2020-09-14 03:20:16 -04:00
Rapptz
b1de57f299
Explicitly disable the members presence by default
2020-09-14 03:20:16 -04:00
Rapptz
0fc8ac6f80
Fix timeouts due to hitting the gateway rate limit
2020-09-14 03:20:16 -04:00
Rapptz
18141c0cf9
Maximize the amount of concurrency while chunking.
...
In order to reduce our amount of backpressure we need to limit the
amount of concurrent chunk requests we can have so the gateway buffer
has some time to breathe.
2020-09-14 03:20:16 -04:00
Rapptz
022ec9af1d
Check for zombie connections through last received payload
...
The previous code would check zombie connections depending on whether
HEARTBEAT_ACK was received. Unfortunately when there's exceeding
backpressure the connection can terminate since the HEARTBEAT_ACK is
buffered very far away despite it being there, just not received yet.
2020-09-14 03:20:16 -04:00
Rapptz
9492cb1242
Speed up chunking for guilds with presence intent enabled
2020-09-14 03:20:16 -04:00
Rapptz
a76f9ce8ef
Maximize concurrency when chunking on AutoSharded clients
2020-09-14 03:20:16 -04:00
Rapptz
faf1db1583
Use a lock for the gateway rate limiter.
...
This will allow for higher concurrency in AutoSharded situations where
I can mostly "fire and forget" the chunk requests.
2020-09-14 03:20:15 -04:00
Rapptz
d6defbc6b2
Heartbeats bypass the rate limits for gateway
2020-09-14 03:20:15 -04:00
Rapptz
5db9a3551f
All guilds require chunking if opting into it
2020-09-14 03:20:15 -04:00
Rapptz
e8e4886fd8
Handle user updates within GUILD_MEMBER_UPDATE
2020-09-14 03:20:15 -04:00
Rapptz
95bec0dcee
Rewrite chunking to work with intents.
...
This slows down chunking significantly for bots in a large number of
guilds since it goes down from 75 guilds/request to 1 guild/request.
However the logic was rewritten to fire the chunking request
immediately after receiving the GUILD_CREATE rather than waiting for
all the guilds in the ready stream before doing it.
2020-09-14 03:20:15 -04:00
Rapptz
f46257faa6
Add more close codes that can't be handled for reconnecting.
2020-09-14 03:20:15 -04:00
Rapptz
c0a3aaa98c
Change unknown cache log warnings from WARNING -> DEBUG
2020-09-14 03:20:15 -04:00
Rapptz
75c24bde16
Handle gateway rate limits by using a rate limiter.
...
With the new chunking changes this will become necessary and we don't
want to disconnect from having too many outwards requests.
2020-09-14 03:20:15 -04:00
Rapptz
a9cb851a3c
Add support for guild intents
2020-09-14 03:20:15 -04:00
Rapptz
986adae108
Revert "Add fetch_message_fast using history endpoint"
...
This reverts commit a309088ae4 .
A rate limited was added to this method after 5 years defeating the
purpose of it.
2020-09-14 01:18:09 -04:00
Rapptz
4ccd9c1591
Remove caching from AutoShardedClient.shards
2020-09-10 05:17:25 -04:00
Rapptz
ccdf4c4ad6
[tasks] Lazily fetch event loop if one isn't provided
...
Fixes #5808
2020-09-10 00:00:58 -04:00
Rapptz
450e71f086
Add a more concrete exception for 500 status codes.
...
Fixes #5797
2020-09-09 21:24:14 -04:00
Rapptz
f8808dba9b
Guard uses of the keep alive thread in case they're None
...
Fixes #5800
2020-09-09 21:18:41 -04:00
Rapptz
e6017a2170
Handle cloudflare bans on webhook requests
...
Fixes #5221
2020-09-09 21:17:28 -04:00
Rapptz
425bb809ed
Add logging to webhooks
...
Fixes #5798
2020-09-09 20:46:16 -04:00
Rapptz
0a7e2f7c2f
[commands] BadBooleanArgument -> BadBoolArgument
2020-09-04 08:47:07 -04:00
Rapptz
4203e7a5a8
[commands] Use edited timestamp if provided for cooldown timing
2020-08-25 23:15:26 -04:00
Rapptz
38ebef8c16
Version bump for development purposes
2020-08-22 17:19:47 -04:00
Rapptz
11f29890dc
Fix bug with Guild.by_category not showing some channels
...
If categories come after a child channel in the dictionary mapping for
whatever reason, then the previous code would remove it from the
mapping and set it to []. This commit aims to fix this.
2020-08-22 17:18:48 -04:00
Rapptz
45752ab354
Document merging behaviour of AllowedMentions in Messageable.send
2020-08-22 17:14:02 -04:00
Rapptz
00d39704da
Version bump to 1.4.1
2020-08-09 01:12:45 -04:00
Rapptz
6388bc7b29
Add changelog for 1.4.1
2020-08-09 01:12:32 -04:00
Rapptz
5dd8e372e4
Terminate connection if a close code couldn't be handled
2020-08-06 09:25:01 -04:00
Rapptz
9048914756
Version bump to 1.4
2020-08-05 22:05:21 -04:00
Rapptz
8d16a61e02
Add changelog for 1.4
2020-08-05 22:04:20 -04:00
Rapptz
09f432016c
[commands] Restart subcommand_passed chain on invoke
...
Fix #5198
2020-08-05 08:36:45 -04:00
Rapptz
250f29989b
Be defensive in case Discord breaks something with WS URLs again
2020-08-05 08:35:43 -04:00
Rapptz
78851bf1d8
Require people to use templates when making an issue
2020-08-05 04:40:31 -04:00
Rapptz
3a1a215f8b
Propagate manual close codes to socket subclass
...
aiohttp seems to not set it during its state machine flow
2020-08-05 04:27:11 -04:00
Rapptz
a9824ffabf
Fix endpoint strings with :443 instead of :80
...
Fix #5191
Close #5188
2020-08-05 04:21:27 -04:00
Rapptz
14fd3dbaa7
Optimize Channel.permissions_for by not creating temporary objects
...
This seemed to have shaved a few microseconds:
10.8 µs ± 79.6 ns per loop → 8.53 µs ± 48.1 ns per loop
12 µs ± 613 ns per loop → 8.72 µs ± 30.2 ns per loop
With 100K loops each
2020-08-01 19:48:15 -04:00
Rapptz
50f4c31d31
Terminate shard processing queue when a clean close is encountered.
...
Fix #5180
2020-08-01 19:26:49 -04:00
Rapptz
b77af19939
Fix AttributeError from internal queue being double underscore.
2020-07-25 10:32:32 -04:00
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