81 Commits

Author SHA1 Message Date
z03h
e6ef43139f
Don't store finished views/modals 2023-02-13 23:52:40 -05:00
Rapptz
183675be74 Add support for silent messages 2023-02-08 15:40:33 -05:00
Soheab_
ee07f72906
Add delete_after kwarg to InteractionMessage.edit 2023-01-25 10:13:47 -05:00
Rapptz
7e95f98521 Fix webhooks and interactions not closing files after a request 2023-01-25 04:22:24 -05:00
Rapptz
6cb9a84898 Fix views not being removed from message store backing
This uses the original interaction ID if available for cache eviction
2023-01-25 02:37:30 -05:00
Rapptz
bee7f903e3 Document Interaction.message availability 2023-01-21 00:07:50 -05:00
Rapptz
bbba8c650f Add missing generic parameters on various Interaction parameters 2023-01-19 07:00:16 -05:00
Rapptz
bf860b0b07 Add support for generic ClientT in Interaction 2023-01-16 21:57:54 -05:00
Rapptz
50e66d4072 Add delete_after to Interaction.edit_message
Closes #9415
2022-12-29 06:56:15 -05:00
Steve C
4c8ba635db
Add delete_after into InteractionResponse.send_message 2022-10-26 04:30:57 -04:00
Soheab
c83134ab65
Add Interaction.translate method
Co-authored-by: I. Ahmad <54180221+nerdguyahmad@users.noreply.github.com>
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
Co-authored-by: Bluesy <68259537+Bluesy1@users.noreply.github.com>
Co-authored-by: Nadir Chowdhury <chowdhurynadir0@outlook.com>
2022-09-03 11:53:55 -04:00
Rapptz
bd19ad05e7 Fix app_command_completion triggering on certain errors 2022-08-16 20:03:02 -04:00
Rapptz
49e6fe9a0c Fix autocomplete translations calling unnecessary locales 2022-08-14 17:35:43 -04:00
Rapptz
9ce1541775 Rename Interaction.original_message to original_response 2022-08-08 08:11:19 -04:00
Rapptz
2d586ae805 Add initial support for app command localisation 2022-08-05 22:35:30 -04:00
Mikey
c4e09acff8
Add InteractionResponse.type property 2022-08-04 08:13:27 -04:00
Rapptz
b3a24846bd Add Interaction.app_permissions
Fix #8193
2022-06-29 22:38:04 -04:00
Rapptz
7ad00750c6 Add note about different client subclasses 2022-06-25 07:51:21 -04:00
Rapptz
573bb32a1e Fallback to an unavailable guild instead of an Object in interactions 2022-05-14 06:50:27 -04:00
Rapptz
4dd5cc2bc9 Pass proxy information to interactions and webhooks
Fix #7918
2022-05-05 12:07:09 -04:00
Rapptz
d56f5150fa Fix oversight of edit parameters not being keyword only 2022-05-04 05:02:42 -04:00
Rapptz
8699d2139a Improve generic duck type programming with PartialMessageable
This adds jump_url, permissions_for, and created_at. Luckily, most
cases of this type being constructed already have the guild_id at
creation time.
2022-05-03 10:49:52 -04:00
Rapptz
a0dfdb9b1d Fix multiple view instances not dispatching in app commands responses
Due to a quirk in InteractionResponse.send_message not returning a
message, all messages sent with an associated View would end up having
no message_id set. When multiple instances of a View are responded to
in a slash command context, this meant that the newest one would
override the storage of the older one. Ultimately leading to the first
view instance causing interaction failures.

Since fetching the original message is an unacceptable solution to the
problem due to incurred requests, the next best thing is to store an
intermediate interaction_id as a stop gap to differentiate between
the multiple instances. This change however, came with its own set of
complications.

Due to the interaction_id being an intermediate stop gap, the
underlying storage of the view store had to be changed to accommodate
the different way of accessing the data. Mainly, the interaction_id
key had to be quick to swap and remove to another key. This solution
attempts to change the interaction_id interim key with
a full fledged message_id key when it receives one if it's possible.

Note that the only way to obtain the interaction_id back from the
component interaction is to retrieve it from the MessageInteraction
data structure. This is because using the interaction_id of the button
press would be a different interaction ID than the one set as an
interim key. As a consequence, this stop gap only works for application
command based interactions. I am not aware of this bug manifesting in
component based interactions.

This patch also fixes a bug with ViewStore.remove_view not working due
to a bug being suppressed by a type: ignore comment. It also removes
the older __verify_integrity helper method since clean-up is already
done through View.stop() or View timeout.

Hopefully in the near future, the `/callback` endpoint will return
actual message data and this stop gap fix will no longer be necessary.
2022-04-28 12:24:57 -04:00
Rapptz
acd4a0856e Add Interaction.extras for extraneous data 2022-04-28 07:59:43 -04:00
Rapptz
840eb577d4 [commands] Add initial implementation of hybrid commands
Hybrid commands allow a regular command to also double as a slash
command, assuming it meets the subset required to function.
2022-04-12 20:15:10 -04:00
Rapptz
c284145f18 Add and remove some versionadded directives 2022-04-10 17:12:56 -04:00
Rapptz
23f6876492 Add initial support for forum channels
Closes #7652
2022-04-06 23:02:58 -04:00
Kellen
4fd2d5fdfd
Remove redundant imports and variables 2022-03-29 02:50:34 -04:00
Rapptz
def035bf9a Remove StoreChannel and any references to it 2022-03-28 00:09:19 -04:00
jack1142
5ffa3e85de
Update comments after # type: ignore to be compatible with PEP 484 2022-03-27 22:26:34 -04:00
Rapptz
202b993da3 Add Interaction.command and Interaction.namespace attributes 2022-03-17 09:45:21 -04:00
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