Commit Graph

374 Commits

Author SHA1 Message Date
ef9f61a933 Add support for select components 2021-05-28 05:34:21 -04:00
98570793e4 Add initial support for buttons and components 2021-05-27 00:53:13 -04:00
631a0b1e13 Add support for ApplicationFlags 2021-04-18 20:32:52 -04:00
65d48302ad 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-04-14 22:10:47 -04:00
9f1a96ea9b Remove fetch_offline_members param for Client 2021-04-14 20:58:49 -04:00
dea92a69dc Remove support for guild subscriptions 2021-04-14 00:47:46 -04:00
9b94fe1ce0 Remove superfluous unused payload parameter 2021-04-11 22:13:48 -04:00
7bdaa793f6 Create temporary DMChannels from message create events
This allows for DMChannels to work without falling back to the
Object error case since there is enough information to build a pseudo
DMChannel object.

This is a breaking change since it changes the type of
DMChannel.recipient to Optional[User] for when this faux object is
created.
2021-04-11 22:09:10 -04:00
f1fac96e33 Remove private_channel_(delete/create) events 2021-04-11 15:13:23 -04:00
7d79b4ba55 Remove Member related handling in PRESENCE_UPDATE 2021-04-11 00:57:59 -04:00
d85805ab6d First pass at supporting v8 API 2021-04-11 00:39:13 -04:00
7e3c5f3faf Fix some regressions from create_task change 2021-04-06 07:31:31 -04:00
8cece19b22 Add on_interaction event and Interaction class.
This is the first pass at the functionality. It's currently a bit
incomplete.
2021-04-06 01:11:36 -04:00
1e7f139313 Add support for setting application_id 2021-04-06 01:11:36 -04:00
2ff24a27b5 Use asyncio.create_task over asyncio.ensure_future 2021-04-05 20:31:03 -04:00
ff7094ce96 Convert datetimes to aware datetimes with UTC.
Naive datetimes will now be interpreted as local time throughout
the library.
2021-04-04 23:54:08 -04:00
54288879e2 Remove userbot functionality
This has a lot of legacy and cruft so there may be some stuff I've
missed but this first pass is enough to get a clear separation.
2021-04-04 10:15:30 -04:00
9d39b135f4 Modernize code to use f-strings
This also removes the encoding on the top, since Python 3 does it by
default. It also changes some methods to use `yield from`.
2021-04-04 07:03:53 -04:00
63ec23bac2 Code optimisations and refactoring via Sourcery 2021-02-24 21:26:51 -05:00
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
69bdc3a184 Change copyright year to present 2021-01-15 05:28:11 -05:00
442962596e Dispatch user updates if the global cache gets stale in update events 2021-01-07 23:57:14 -05:00
59c11e71a2 Implement presences for Guild.query_members 2020-12-31 13:50:22 -05:00
36292a65ea remove extraneous assignment 2020-12-22 07:18:32 -05:00
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
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
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
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
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
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
ae65d75f96 Load member from guild_member_update dispatch 2020-10-17 23:19:02 -04:00
61e25cb090 Ensure our own member is never evicted from the cache in any policy. 2020-10-17 23:02:03 -04:00
b07d474bd6 Fix attribute errors when timing out during chunking start-up 2020-10-17 22:02:44 -04:00
bf42cf7232 Add warning if guilds intent is disabled. 2020-09-28 05:39:13 -04:00
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
28e5b2a5e1 Add Client.intents to query the current intents
Closes #5854
2020-09-26 06:35:41 -04:00
e4d7f44aa5 Make Intent class creation more intuitive 2020-09-24 09:00:54 -04:00
dc6e9e7fd6 Fix typo in ValueError message 2020-09-24 09:00:47 -04:00
005a80303f Add chunk_guilds_at_startup and deprecate fetch_offline_members 2020-09-24 01:17:04 -04:00
8d5c05ed20 Default MemberCacheFlags based on intents 2020-09-23 03:21:21 -04:00
4d813da9e1 Pass default intents if not explicitly given 2020-09-23 03:21:20 -04:00
23ae084b8c Allow finer grained control over the member cache. 2020-09-23 03:21:20 -04:00
cb8cb557f5 Add Guild.chunk and deprecated Client.request_offline_members 2020-09-23 03:21:19 -04:00
0ea0f483bc Fix timeouts due to hitting the gateway rate limit 2020-09-23 03:21:18 -04:00
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
0ec72660cf Speed up chunking for guilds with presence intent enabled 2020-09-23 03:21:18 -04:00
92e1816114 Maximize concurrency when chunking on AutoSharded clients 2020-09-23 03:21:17 -04:00
3df269daa3 All guilds require chunking if opting into it 2020-09-23 03:21:17 -04:00
c261f7c4a3 Handle user updates within GUILD_MEMBER_UPDATE 2020-09-23 03:21:16 -04:00
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