Commit Graph
100 Commits
Author SHA1 Message Date
Rapptz abe54f5bdc Translation sync with crowdin 2020-10-24 00:10:06 -04:00
Rapptz 763d46cd7a Version bump to v1.5.1 2020-10-19 19:44:10 -04:00
Rapptz 0be2d37e7a Add changelog for v1.5.1 2020-10-19 19:42:54 -04:00
Rapptz 707cb47438 Fix error when querying members from the gateway.
I accidentally made this return True instead of the actual member list
2020-10-19 19:37:16 -04:00
Rapptz 1a6295dffb Allow concurrent calls to guild.chunk()
This allows people who write guild.chunk() calls in highly concurrent
places such as on_message or checks to not spam the gateway with an
actual request and instead waits for the pre-existing request to finish
2020-10-19 02:47:03 -04:00
Rapptz 3daaadafdd [commands] Lazily fetch members in discord.Member converters
This makes commands taking members mostly work transparently without
much effort from the user.
2020-10-17 23:05:22 -04:00
Rapptz 61e25cb090 Ensure our own member is never evicted from the cache in any policy. 2020-10-17 23:02:03 -04:00
Rapptz 2509ca6a82 Add internal method to check if the websocket is currently ratelimited 2020-10-17 22:51:29 -04:00
Rapptz b07d474bd6 Fix attribute errors when timing out during chunking start-up 2020-10-17 22:02:44 -04:00
Rapptz 21ed9f61d2 Fix disconnect when trying to move to another voice channel.
Not overly proud of this implementation but this allows the library
to differentiate between a 4014 that means "move to another channel" or
"move nowhere". Sometimes the VOICE_STATE_UPDATE comes before the
actual websocket disconnect so special care had to be taken in that
case.

Fix #5904
2020-10-17 22:01:57 -04:00
Rapptz b91ddc6f4e Mark intent alias flags as actual aliases to skip them in __iter__
Fix #5945
2020-10-17 18:50:56 -04:00
Rapptz 1c03a4aac9 Evict keys when they're set to None in PermissionOverwrite
Fixes #5929
2020-10-17 01:59:00 -04:00
Rapptz b9e1bdf87e Properly insert at the end if position is not found when moving.
Fixes #5923
2020-10-17 01:52:35 -04:00
Rapptz d9acc2f491 Escape multi-line quotes properly
Fix #5897
2020-10-17 01:36:31 -04:00
Rapptz 9d183ecc30 Add intents to the issue template 2020-10-03 21:48:34 -04:00
Rapptz 022b5f7902 Update intent documentation to use defaults 2020-10-03 01:42:50 -04:00
Rapptz 1518790c87 Some minor documentation fixes.
Make examples all mention where to put it for the unaware.
2020-09-28 21:42:32 -04:00
Rapptz 6d1bcf89da Version bump to v1.5.0 2020-09-28 20:57:10 -04:00
Rapptz 1919267e5c Add changelog for v1.4.2 2020-09-28 20:56:00 -04:00
Rapptz 821d833c11 Add changelog for v1.5.0 2020-09-28 20:33:15 -04:00
Rapptz bf42cf7232 Add warning if guilds intent is disabled. 2020-09-28 05:39:13 -04:00
Rapptz 1ebb52b139 Guard GUILD_MEMBER_ADD/GUILD_MEMBER_REMOVE from errors
If the guilds intent is disabled all guilds are unavailable. This means
we don't receive a member_count attribute and cannot update it.
2020-09-28 05:12:05 -04:00
Rapptz 28e5b2a5e1 Add Client.intents to query the current intents
Closes #5854
2020-09-26 06:35:41 -04:00
Rapptz e4d7f44aa5 Make Intent class creation more intuitive 2020-09-24 09:00:54 -04:00
Rapptz de6c5ef675 More intent documentation.
Mention that you can downgrade the library to revert. Also mention
that intents need to be updated in the code as well as the developer
portal.
2020-09-24 02:00:47 -04:00
Rapptz 59d514fcdf More intent related documentation 2020-09-24 01:39:45 -04:00
Rapptz 005a80303f Add chunk_guilds_at_startup and deprecate fetch_offline_members 2020-09-24 01:17:04 -04:00
Rapptz 7126f5a78c Use delete_message_days instead of delete-message-days 2020-09-23 08:03:06 -04:00
Rapptz e8eb19b2b4 Use /invites/ instead of /invite/ 2020-09-23 07:58:57 -04:00
Rapptz 2e06239d3c Add documentation for gateway intents 2020-09-23 03:21:22 -04:00
Rapptz 9dd4dc78c3 Mention potential Guild.member_count accuracy issues 2020-09-23 03:21:22 -04:00
Rapptz 213f55ffc7 Disable voice cache in weird intent configurations. 2020-09-23 03:21:21 -04:00
Rapptz e644a5a060 Fix up wording in MemberCacheFlags exception 2020-09-23 03:21:21 -04:00
Rapptz 625a5c2a0b Some documentation fixes for MemberCacheFlags and Intents 2020-09-23 03:21:21 -04:00
Rapptz 8d5c05ed20 Default MemberCacheFlags based on intents 2020-09-23 03:21:21 -04:00
Rapptz bf8ca58996 Add a special exception for required privileged intents 2020-09-23 03:21:20 -04:00
Rapptz 4d813da9e1 Pass default intents if not explicitly given 2020-09-23 03:21:20 -04:00
Rapptz f2de794bde Intern status and overwrite strings 2020-09-23 03:21:20 -04:00
Rapptz 23ae084b8c Allow finer grained control over the member cache. 2020-09-23 03:21:20 -04:00
Rapptz e6edc44f3d Raise if member intent is not enabled 2020-09-23 03:21:19 -04:00
Rapptz ad917ca02d 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-23 03:21:19 -04:00
Rapptz cb8cb557f5 Add Guild.chunk and deprecated Client.request_offline_members 2020-09-23 03:21:19 -04:00
Rapptz 055fe76241 Fix Client.request_offline_members no longer working 2020-09-23 03:21:19 -04:00
Rapptz e10942a9ee Add versionadded for intents enum 2020-09-23 03:21:19 -04:00
Rapptz bec34c1110 Explicitly disable the members presence by default 2020-09-23 03:21:18 -04:00
Rapptz 0ea0f483bc Fix timeouts due to hitting the gateway rate limit 2020-09-23 03:21:18 -04:00
Rapptz 7db0008190 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-23 03:21:18 -04:00
Rapptz 6bae52f4bb 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-23 03:21:18 -04:00
Rapptz 0ec72660cf Speed up chunking for guilds with presence intent enabled 2020-09-23 03:21:18 -04:00
Rapptz 92e1816114 Maximize concurrency when chunking on AutoSharded clients 2020-09-23 03:21:17 -04:00
Rapptz af8fc32329 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-23 03:21:17 -04:00
Rapptz 5fe998ac19 Heartbeats bypass the rate limits for gateway 2020-09-23 03:21:17 -04:00
Rapptz 3df269daa3 All guilds require chunking if opting into it 2020-09-23 03:21:17 -04:00
Rapptz c261f7c4a3 Handle user updates within GUILD_MEMBER_UPDATE 2020-09-23 03:21:16 -04:00
Rapptz 930761e058 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-23 03:21:16 -04:00
Rapptz ec7b8edcc2 Add more close codes that can't be handled for reconnecting. 2020-09-23 03:21:16 -04:00
Rapptz 11d8a6fa3c Change unknown cache log warnings from WARNING -> DEBUG 2020-09-23 03:21:15 -04:00
Rapptz e7db9cfdf7 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-23 03:21:15 -04:00
Rapptz a6381dcf77 Add support for guild intents 2020-09-23 03:21:15 -04:00
Rapptz 9036b9651b Properly handle disconnects in voice when force disconnected 2020-09-23 03:20:35 -04:00
Rapptz e3922e24d9 Correct some protocol errors in v4 of voice gateway 2020-09-23 03:20:35 -04:00
Rapptz 0b93fa3a82 Implement VoiceProtocol lower level hooks.
This allows changing the connect flow and taking control of it without
relying on internal events or tricks.
2020-09-23 03:20:35 -04:00
Rapptz ab5e175b25 Use quotes when installing in the README
Other shells have a hard time with square brackets.

Closes #5821
2020-09-21 03:39:19 -04:00
Rapptz 9978288346 Update issue template to redirect to discussions 2020-09-18 04:21:32 -04:00
Rapptz aa258073dc Add labels to the issue templates 2020-09-17 22:16:20 -04:00
Rapptz a183c4f752 Completely update member references from message inner members.
Fixes #5819
2020-09-17 02:45:53 -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