100 Commits

Author SHA1 Message Date
Josh
e01d4a31eb
Replace invariant container types with wider types where applicable 2022-03-17 07:26:01 -04:00
Stocker
5aa696ccfa
Fix typing issues and improve typing completeness across the library
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
Co-authored-by: Josh <josh.ja.butt@gmail.com>
2022-03-13 23:52:10 -04:00
Dawid K
5f2d9a9ffa
Fix state parameter in Interaction.edit_original_message 2022-03-12 20:50:01 -05:00
metro
342652c8ad
Document NotFound for Interaction original_message methods 2022-03-12 20:49:06 -05:00
Stocker
acbd8ca5f6
Fix typo causing a TypeError in Interaction.guild_locale 2022-03-07 19:54:13 -05:00
Leo
02310e4abd
Add Interaction.locale and Interaction.guild_locale
Co-authored-by: Stocker <44980366+StockerMC@users.noreply.github.com>
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
2022-03-07 19:34:38 -05:00
Rapptz
1f8687505f Fix InteractionResponse.edit_message not working with modal submits 2022-03-07 17:53:01 -05:00
Josh
c907bec753
Add Interaction creation/expiry attributes and helper method
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
2022-03-06 03:43:50 -05:00
Stocker
554d2d7c99
Add the suppress_embeds parameter to send methods
Modified the following methods:

- abc.Messageable.send
- Webhook.send
- SyncWebhook.send
- InteractionResponse.send_message
2022-03-05 22:19:33 -05:00
Rapptz
4c8b1f9abd Remove unused imports 2022-03-05 21:40:42 -05:00
Rapptz
f7315573aa Remove generic from Interaction and ConnectionState
This results in poor ergonomics due to the lack of default generics
for the common case. For most users this ends up in a degraded
experience since the type will resolve to Unknown rather than at the
very least a Client.
2022-03-05 05:03:23 -05:00
Rapptz
41f2792ed9 Change Interaction.user to not be Optional
This has potential to be a breaking change and Discord could definitely
royally screw this over in the future. However, as far as I can tell
every interaction has either a User or a Member so this change should
be kosher. I'm unaware of any interaction, even in the future, where
this is not true.

I hope these are not my famous last words.
2022-03-02 02:11:04 -05:00
Rapptz
f80f81c395 Add Member.resolved_permissions attribute for interaction members 2022-03-02 01:39:39 -05:00
Rapptz
f435d160dd Add Interaction.client property 2022-03-01 08:11:22 -05:00
Rapptz
ae1aaac5a7 Add support for autocomplete 2022-03-01 05:42:44 -05:00
Rapptz
30e7a2e937 Fix a few more type errors 2022-02-21 23:31:18 -05:00
Predä
d24a339dbf
Fix missing view parameter in edit message response 2022-02-21 20:44:29 -05:00
Maya
38e6dc4f27
Fix passing ephemeral and thinking together 2022-02-21 06:37:59 -05:00
Rapptz
af8e74d327 Allow deferring modal_submit interactions
This also adds a thinking boolean to toggle which type of deferring
is done when there can be ambiguity.
2022-02-20 05:23:09 -05:00
Josh
19c6687b55
Add support for Modal Interactions 2022-02-20 04:57:44 -05:00
Josh
dede5539ee
Add support for editing message attachments 2022-02-19 22:02:53 -05:00
Rapptz
92d1b4cd2b Refactor interaction response handling to support files
This adds support for file sending and allowed_mentions
2022-02-18 08:10:38 -05:00
Rapptz
9c066a8cf6 Refactor internal message sending and editing parameter passing
This reduces some repetition in many functions and is ripped out of
the webhook code. This also removes the unused HTTP functions for
interaction responses since those belong in the webhook code rather
than the HTTPClient.
2022-02-18 07:47:59 -05:00
Rapptz
490bbffc93 Remove in-place edits and return fresh instances instead
Fixes #4098
2021-08-23 23:46:50 -04:00
Miolus
36b9bc8ee3
Add interaction.data to docs 2021-08-18 00:25:30 -04:00
Rapptz
66871f329e Interaction.channel can be a PartialMessageable rather than Object
This allows it to work just fine in DMs
2021-08-10 09:28:14 -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
c748e4bce5 Mention ephemeral messages can only be edited with raw method 2021-07-03 21:45:15 -04:00
Alex Nørgaard
6a553b2347
Fix building docs due to missing InteractionMessage in __all__ 2021-07-03 13:24:57 -04:00
Rapptz
0b577fa209 Add support for fetching the original interaction response message 2021-07-03 11:00:48 -04:00
Rapptz
bba4d6c4e4 Fix typo with exception name in InteractionResponse 2021-07-03 08:49:07 -04:00
Rapptz
8760b01e76 Add Interaction.permissions to get resolved permissions 2021-07-03 07:07:54 -04:00
Rapptz
12e90f9c6d Type hint instance variables in interactions 2021-07-03 06:56:30 -04:00
Rapptz
7ca90874b9 Raise an exception if an interaction has been responded before
Fix #7153
2021-07-03 00:30:32 -04:00
jack1142
1059c02df7
Update examples of interactions to mention components 2021-07-02 21:58:06 -04:00
Nadir Chowdhury
2d597e310b
Fix Interaction.channel being None in threads 2021-07-01 07:49:44 -04:00
Devon R
ee26b58c6c
None check in InteractionResponse.edit_message 2021-06-10 07:28:26 -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
Rapptz
4a3491cc0a Check for view finished state before resuming listening on edit 2021-05-31 00:18:06 -04:00
Rapptz
61a189c217 Sync views in InteractionResponse.edit_message 2021-05-31 00:09:15 -04:00
Rapptz
7b1c57ed60 Add support for interaction followups 2021-05-30 11:25:15 -04:00
Rapptz
c6f3ed1af4 Allow sending View with Interaction.response.send_message
This also allows for ephemeral views and listening to said views
2021-05-30 06:10:58 -04:00
Rapptz
fc64ffdabd Allow passing multiple embeds in InteractionResponse.edit_message 2021-05-27 21:07:28 -04:00
Rapptz
3b83f60b35 Add support for setting interaction responses 2021-05-27 00:53:14 -04:00
Rapptz
d42c63e186 Fix some type hints in interactions 2021-05-27 00:53:14 -04:00
AXVin
2ad2cab50c [Interactions] Create User only when in DMs 2021-05-27 00:53:14 -04:00
Rapptz
cc800796a2 Properly guard for DMs in interaction creation
Fix #6794
2021-05-27 00:53:14 -04:00
Rapptz
98570793e4 Add initial support for buttons and components 2021-05-27 00:53:13 -04:00
Rapptz
a31c19563f Add interaction related typings 2021-04-08 02:12:55 -04:00
Rapptz
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