312 Commits

Author SHA1 Message Date
Lint Action
7513c2138f Fix code style issues with Black 2021-09-05 21:34:20 +00:00
Astrea
4055bafaa5
Merge pull request #47
* Added `on_raw_typing` event
2021-09-02 13:34:39 -07:00
Gnome
6e41bd2219 Remove intents.default and make intents a required parameter 2021-08-31 20:53:54 +01:00
Rapptz
d17551f51f Fix typing for private channel by user lookup 2021-08-22 07:36:39 -04:00
Rapptz
ea2d972666 Make global log variable in modules private 2021-08-22 02:33:51 -04:00
Rapptz
311eac97b0 Reformat state.py 2021-08-21 14:48:22 -04:00
Rapptz
d5033b04a2 Don't clear views in READY 2021-08-21 14:47:08 -04:00
Stocker
7592300535
Typehint state.py 2021-08-21 14:39:02 -04:00
Rapptz
fbc4a51c35 Fix on_typing not dispatching for threads 2021-08-20 20:09:18 -04:00
Rapptz
0df3f51a0b Partially type-hint state.py
This is just work to get started. A more complete type hint will come
later.
2021-08-18 01:52:24 -04:00
Rapptz
dc9c224b54 Undo coercion of partial DMChannel to PartialMessageable 2021-08-10 22:10:45 -04:00
Rapptz
1279510194 Add support for PartialMessageable instances
This allows library users to send messages to channels without fetching
it first.
2021-08-10 09:24:49 -04:00
Rapptz
2de0398d66 Cast removed thread member IDs to int 2021-07-31 20:22:51 -04:00
Rapptz
2cb5ce981e FIx on_thread_member_remove passing in None 2021-07-31 19:43:05 -04:00
Rapptz
41f3998a08 Fix on_thread_member_remove not dispatching 2021-07-31 19:40:47 -04:00
Nadir Chowdhury
60d82cf908
implement guild stickers 2021-07-30 21:25:41 -04:00
Rapptz
ecf239d2a2 Fix user cache acting incorrectly with evictions
The first issue involved copied users which would lead to user updates
causing faster evictions of the cache than was expected.

The second issue involved users that weren't bound to an internal
lifetime eviction policy. These users would not get evicted.
For example, a user without mutual guilds or being part of the internal
cache in general (messages, DMs) would never end up being evicted for
some strange reason. To handle this case, store_user would get a
counterpart named create_user which would create a user without
potentially storing them in the cache. That way only users with a
bound lifetime within the library would be stored.
2021-07-29 01:43:23 -04:00
Rapptz
8fb998b599 Refactor utcfromtimestamp to use fromtimestamp(..., tz=utc) 2021-07-09 04:20:45 -04:00
Rapptz
826ce101fd Change WEBHOOK_UPDATE to use guild information from gateway
This changes the lookup from unnecessary O(n) to two amortised O(1)
lookups. This event pretty much always has a guild_id so the original
code was always a performance bottleneck.
2021-07-08 21:53:26 -04:00
Rapptz
b4e39668fb Change CHANNEL_PINS_UPDATE to use guild information from gateway
This changes the channel lookup from O(n) to two amortised O(1) lookups
2021-07-08 21:51:21 -04:00
Rapptz
03cd6ff433 Remove calls to gc.collect in ConnectionState
For some bots this was actually a performance bottleneck, might as
well remove it if it causes bad performance
2021-07-07 20:19:17 -04:00
Rapptz
cb2363f0fd Move global user storage from WeakValueDictionary to dict
Profiling showed that WeakValueDictionary caused rather significant
and noticeable slowdowns during startup. Since the only thing it was
used for was to automatically remove the key from the mapping when
the reference count reaches zero, the same could theoretically be
accomplished by using the __del__ special method. There is a chance
that this could lead to a memory leak since the __del__ method is not
always called, but the only instances of this happening are during
interpreter shutdown to my knowledge and at that point the mapping
is the least of my concern.
2021-07-07 20:19:17 -04:00
Rapptz
c1c6457598 Separate member_update and presence_update events 2021-07-04 21:40:30 -04:00
Alex Nørgaard
d1dc41ec2f
Fix Client.fetch_channel not returning Thread 2021-07-03 21:35:31 -04:00
Nadir Chowdhury
2d597e310b
Fix Interaction.channel being None in threads 2021-07-01 07:49:44 -04:00
Lilly Rose Berner
6b1d46a1ea
Set Message.guild from guild_id if unavailable through Message.channel 2021-06-28 19:03:59 -04:00
Rapptz
e96df33ce0 Dispatch thread_join when a thread is updated but not in cache 2021-06-28 18:56:28 -04:00
Rapptz
7dccbace78 Refactor Guild to support type hints
This patch also does the following:

* Sets some parameters to be positional only
* Changes Guild.edit to use the MISSING sentinel
* Changes the various create_channel methods to be type safe
* Changes many parameters from Optional[T] to use MISSING
* Changes Guild.create_role to use MISSING sentinel

This refactor is mostly partial but lays a decent foundation
2021-06-08 10:56:26 -04:00
Rapptz
1152f67efc Allow pins events to work with threads 2021-06-08 07:29:17 -04:00
Rapptz
e13cbf4644 Don't dispatch thread_join on extraneous THREAD_CREATE dispatches 2021-06-08 07:29:17 -04:00
Rapptz
bd369c76ea Parse remaining thread events. 2021-06-08 07:29:17 -04:00
Rapptz
429c5933d9 Add minor parsing for THREAD_LIST_SYNC and THREAD_MEMBER_UPDATE
There's no dispatch for these yet
2021-06-08 07:26:22 -04:00
Rapptz
ac95b8b85b Allow Message.channel to be a thread 2021-06-08 07:25:40 -04:00
Rapptz
68c7c538f5 First pass at preliminary thread support
This is missing a lot of functionality right now, such as two gateway
events and all the HTTP CRUD endpoints.
2021-06-08 07:23:40 -04:00
Nadir Chowdhury
ab6d592f8c
Add support for integration create/update/delete events 2021-06-07 03:28:26 -04:00
Rapptz
78275023cc Add Client.persistent_views to get all persistent views 2021-05-31 23:15:12 -04:00
Rapptz
d0097c4281 Remove view syncing before editing in views
This prevents a potential race condition when a MESSAGE_UPDATE is
received syncing and refreshing the view components causing a desync.
2021-05-31 05:50:40 -04:00
Nadir Chowdhury
9f98a9a87f
Implement StageInstance 2021-05-30 13:51:52 -04:00
Rapptz
ef9f61a933 Add support for select components 2021-05-28 05:34:21 -04:00
Rapptz
98570793e4 Add initial support for buttons and components 2021-05-27 00:53:13 -04:00
Nadir Chowdhury
631a0b1e13
Add support for ApplicationFlags 2021-04-18 20:32:52 -04:00
Steve C
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
apple502j
9f1a96ea9b
Remove fetch_offline_members param for Client 2021-04-14 20:58:49 -04:00
apple502j
dea92a69dc
Remove support for guild subscriptions 2021-04-14 00:47:46 -04:00
Rapptz
9b94fe1ce0 Remove superfluous unused payload parameter 2021-04-11 22:13:48 -04:00
Rapptz
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
Nadir Chowdhury
f1fac96e33
Remove private_channel_(delete/create) events 2021-04-11 15:13:23 -04:00
Rapptz
7d79b4ba55 Remove Member related handling in PRESENCE_UPDATE 2021-04-11 00:57:59 -04:00
Rapptz
d85805ab6d First pass at supporting v8 API 2021-04-11 00:39:13 -04:00
Rapptz
7e3c5f3faf Fix some regressions from create_task change 2021-04-06 07:31:31 -04:00