Steve C
4d47436b02
Fix guild.chunk() not working on evicted guilds
...
If you're trying to chunk a guild that the bot is not in,
it'll just hang on the chunk coro forever. It's weird, I know.
2021-05-01 10:24:40 -04:00
Nadir Chowdhury
63ec23bac2
Code optimisations and refactoring via Sourcery
2021-02-24 21:26:51 -05:00
Rapptz
61884dd9ac
Use member provided data in typing_start event if not in cache
...
Apparently Discord had this all along.
ref: #5965 , #5983
2021-01-24 05:21:13 -05:00
Nihaal Sangha
69bdc3a184
Change copyright year to present
2021-01-15 05:28:11 -05:00
Rapptz
442962596e
Dispatch user updates if the global cache gets stale in update events
2021-01-07 23:57:14 -05:00
Nadir Chowdhury
59c11e71a2
Implement presences for Guild.query_members
2020-12-31 13:50:22 -05:00
Sebastian Law
36292a65ea
remove extraneous assignment
2020-12-22 07:18:32 -05:00
Nadir Chowdhury
6b803acde4
[chore] Remove redundant imports
...
This also removes the historical patch for NullHandler implemented in bbf1c54, as it has been available since Python 3.1.
2020-11-28 03:16:49 -05:00
Rapptz
f174365d33
Ensure member key is not overwritten by author key in MESSAGE_UPDATE
...
This also coerces the older message to take the member data from the
newer message so the types are not incompatible.
Fix #5999
2020-11-23 06:02:27 -05:00
Rapptz
7a3a571e0a
Don't store a user cache if there's no member intent or cache is off
...
Without a cache or member intent the user cache can get out of date
with no events to update the underlying user in the member object.
Ref: #6034
2020-11-23 05:24:13 -05:00
Rapptz
431ee8794b
Fix error with templates not having access to member cache flags.
...
This also changes the attribute from having an underscore
Fix #5986
2020-11-21 22:42:59 -05: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
Florian Spieß
ae65d75f96
Load member from guild_member_update dispatch
2020-10-17 23:19:02 -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
b07d474bd6
Fix attribute errors when timing out during chunking start-up
2020-10-17 22:02:44 -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
apple502j
dc6e9e7fd6
Fix typo in ValueError message
2020-09-24 09:00:47 -04:00
Rapptz
005a80303f
Add chunk_guilds_at_startup and deprecate fetch_offline_members
2020-09-24 01:17:04 -04:00
Rapptz
8d5c05ed20
Default MemberCacheFlags based on intents
2020-09-23 03:21:21 -04:00
Rapptz
4d813da9e1
Pass default intents if not explicitly given
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
cb8cb557f5
Add Guild.chunk and deprecated Client.request_offline_members
2020-09-23 03:21:19 -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
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
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
11d8a6fa3c
Change unknown cache log warnings from WARNING -> DEBUG
2020-09-23 03:21:15 -04:00
Rapptz
a6381dcf77
Add support for guild intents
2020-09-23 03:21:15 -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
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
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
394b514cc9
Add before_identify_hook to have finer control over IDENTIFY syncing
2020-07-25 09:59:39 -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
Anurag
421d8bf8ca
Fix TypeError on missing shard_id kwarg
2020-06-07 03:41:21 -04:00
Tarek
a972c95f12
Add user_ids fields for query_members
2020-05-29 23:24:07 -04:00
apple502j
cb43e19bea
Fix TypeError in chunker
2020-05-23 21:56:27 -04:00
iomintz
755ab28311
state: use bytes.hex() instead of binascii.hexlify().decode()
2020-05-10 20:07:22 -05: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
0d5e6e213c
Decrement Guild.member_count even if member is not cached
...
Fix #4021
2020-04-19 18:22:41 -04:00
apple502j
14f80fce45
Fix PartialEmoji.url.read for reactions
2020-04-18 19:34:41 +09:00
Rapptz
8874aa3dd2
Move log levels around to make INFO a little less noisy
2020-04-06 05:22:57 -04:00
NCPlayz
c8f32f3151
animated key is never given to reaction_remove(_emoji)
2020-04-06 04:58:27 -04:00