Rapptz
8fb998b599
Refactor utcfromtimestamp to use fromtimestamp(..., tz=utc)
4 years ago
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.
4 years ago
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
4 years ago
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
4 years ago
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.
4 years ago
Rapptz
c1c6457598
Separate member_update and presence_update events
4 years ago
Alex Nørgaard
d1dc41ec2f
Fix Client.fetch_channel not returning Thread
4 years ago
Nadir Chowdhury
2d597e310b
Fix Interaction.channel being None in threads
4 years ago
Lilly Rose Berner
6b1d46a1ea
Set Message.guild from guild_id if unavailable through Message.channel
4 years ago
Rapptz
e96df33ce0
Dispatch thread_join when a thread is updated but not in cache
4 years ago
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
4 years ago
Rapptz
1152f67efc
Allow pins events to work with threads
4 years ago
Rapptz
e13cbf4644
Don't dispatch thread_join on extraneous THREAD_CREATE dispatches
4 years ago
Rapptz
bd369c76ea
Parse remaining thread events.
4 years ago
Rapptz
429c5933d9
Add minor parsing for THREAD_LIST_SYNC and THREAD_MEMBER_UPDATE
There's no dispatch for these yet
4 years ago
Rapptz
ac95b8b85b
Allow Message.channel to be a thread
4 years ago
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.
4 years ago
Nadir Chowdhury
ab6d592f8c
Add support for integration create/update/delete events
4 years ago
Rapptz
78275023cc
Add Client.persistent_views to get all persistent views
4 years ago
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.
4 years ago
Nadir Chowdhury
9f98a9a87f
Implement StageInstance
4 years ago
Rapptz
ef9f61a933
Add support for select components
4 years ago
Rapptz
98570793e4
Add initial support for buttons and components
4 years ago
Nadir Chowdhury
631a0b1e13
Add support for ApplicationFlags
4 years ago
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.
4 years ago
apple502j
9f1a96ea9b
Remove fetch_offline_members param for Client
4 years ago
apple502j
dea92a69dc
Remove support for guild subscriptions
4 years ago
Rapptz
9b94fe1ce0
Remove superfluous unused payload parameter
4 years ago
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.
4 years ago
Nadir Chowdhury
f1fac96e33
Remove `private_channel_(delete/create)` events
4 years ago
Rapptz
7d79b4ba55
Remove Member related handling in PRESENCE_UPDATE
4 years ago
Rapptz
d85805ab6d
First pass at supporting v8 API
4 years ago
Rapptz
7e3c5f3faf
Fix some regressions from create_task change
4 years ago
Rapptz
8cece19b22
Add on_interaction event and Interaction class.
This is the first pass at the functionality. It's currently a bit
incomplete.
4 years ago
Rapptz
1e7f139313
Add support for setting application_id
4 years ago
Nadir Chowdhury
2ff24a27b5
Use `asyncio.create_task` over `asyncio.ensure_future`
4 years ago
Rapptz
ff7094ce96
Convert datetimes to aware datetimes with UTC.
Naive datetimes will now be interpreted as local time throughout
the library.
4 years ago
Rapptz
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.
4 years ago
Rapptz
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`.
4 years ago
Nadir Chowdhury
63ec23bac2
Code optimisations and refactoring via Sourcery
4 years ago
Rapptz
61884dd9ac
Use member provided data in typing_start event if not in cache
Apparently Discord had this all along.
ref: #5965 , #5983
4 years ago
Nihaal Sangha
69bdc3a184
Change copyright year to present
4 years ago
Rapptz
442962596e
Dispatch user updates if the global cache gets stale in update events
4 years ago
Nadir Chowdhury
59c11e71a2
Implement presences for `Guild.query_members`
4 years ago
Sebastian Law
36292a65ea
remove extraneous assignment
4 years ago
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.
4 years ago
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
4 years ago
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
4 years ago
Rapptz
431ee8794b
Fix error with templates not having access to member cache flags.
This also changes the attribute from having an underscore
Fix #5986
4 years ago
Rapptz
707cb47438
Fix error when querying members from the gateway.
I accidentally made this return True instead of the actual member list
5 years ago