Commit Graph

28 Commits

Author SHA1 Message Date
4a72201617 Make json conversion functions private 2021-08-22 02:35:58 -04:00
ea2d972666 Make global log variable in modules private 2021-08-22 02:33:51 -04:00
658b61d468 Fix SyncWebhook not working across thread barriers
Fix #7310
2021-07-30 22:59:23 -04:00
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
f7d551953b Remove extraneous __slots__ assignments 2021-06-28 23:36:20 -04:00
cbe7a1b3a2 Add "new in version" missing in webhook documentation 2021-06-27 23:41:00 -04:00
fc66c5b92d Fix some webhook related type checker errors 2021-06-10 07:57:41 -04:00
92ee2cd598 Add support for thread parameter in Webhook.send 2021-06-08 07:29:15 -04:00
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
4a3491cc0a Check for view finished state before resuming listening on edit 2021-05-31 00:18:06 -04:00
2ebd5315f9 Add support for sending and editing views in Webhook 2021-05-30 11:25:00 -04:00
db58e628ba Allow Webhook.send to send ephemeral messages
This is only available for application webhooks
2021-05-30 10:29:29 -04:00
85758a75b3 Add interaction related endpoints to async webhook 2021-05-27 00:53:14 -04:00
5acb3a62f8 Fix Webhook example 2021-05-23 03:42:37 -04:00
3864fb37a0 Fix various reference issues in documentation
Co-Authored-By: Riley Shaw <30989490+ShineyDev@users.noreply.github.com>
2021-05-06 07:51:07 -04:00
dc67d2bd85 Replace uses of Ellipsis as sentinels with utils.MISSING 2021-05-03 00:31:07 -04:00
2793fc06d5 Clarify Webhook.send return value documentation 2021-05-02 18:21:11 -04:00
60c1240849 Fix SyncWebhook exception case causing attribute errors 2021-05-01 09:24:40 -04:00
02e21a8905 Fix sending multipart data with SyncWebhook
Fixes #6825
2021-05-01 09:21:39 -04:00
c786a85a9b Add utils.MISSING 2021-04-29 01:58:36 -04:00
20c2664a50 [docs] Remove extraneous icon definition 2021-04-25 19:21:09 -04:00
f4165755a9 Rename lingering _url Asset properties 2021-04-21 23:24:36 -04:00
9eaf1e85e4 Rewrite Asset design
This is a breaking change.

This does the following transformations, assuming `asset` represents
an asset type.

Object.is_asset_animated() => Object.asset.is_animated()
Object.asset => Object.asset.key
Object.asset_url => Object.asset_url
Object.asset_url_as => Object.asset.replace(...)

Since the asset type now requires a key (or hash, if you will),
Emoji had to be flattened similar to how Attachment was done since
these assets are keyed solely ID.

Emoji.url (Asset) => Emoji.url (str)
Emoji.url_as => removed
Emoji.url.read => Emoji.read
Emoji.url.save => Emoji.save

This transformation was also done to PartialEmoji.
2021-04-16 11:27:23 -04:00
57dbb37a52 Add fetch_message for webhooks 2021-04-16 11:27:15 -04:00
90d59bb06c Fix overloads on Webhook.send to not require wait kwarg 2021-04-15 19:36:36 -04:00
0542b129c2 Fix WebhookMessage.edit documentation 2021-04-15 09:03:46 -04:00
1f74b051a8 Fix rate limit handling with retry_after precision change 2021-04-15 08:34:58 -04:00
a6f7213c89 Rewrite webhooks to play better with typings and rate limits
This unfortunately required splitting the types into two. This led to
a lot of unfortunate code duplication that I didn't really enjoy
writing.

The new design allows users to pass an authentication token to make
webhook requests without the webhook token and allows to finally
edit the webhook channel.

The new design also uses a contextvar to store rate limiting
information so multiple instances or recreating instances no longer
clears the ratelimiting state since it's now essentially a "global"
object.

Closes #6525, closes #6662, closes #2509, closes #1761
2021-04-15 08:04:32 -04:00