Commit Graph

105 Commits

Author SHA1 Message Date
44a44e938f Reformat entire project with ruff instead of black 2025-08-18 20:16:10 -04:00
50caa3c82c Add support for components V2
Co-authored-by: Michael H <michael@michaelhall.tech>
Co-authored-by: Soheab <33902984+Soheab@users.noreply.github.com>
Co-authored-by: owocado <24418520+owocado@users.noreply.github.com>
Co-authored-by: Jay3332 <40323796+jay3332@users.noreply.github.com>
Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com>
2025-08-13 20:37:23 -04:00
59546a4851 Add support for launch_activity interaction response 2025-07-02 18:54:57 -04:00
2bcbd49bc6 Add __repr__ method to various classes 2025-06-20 14:57:10 -04:00
ef06d7d9db Add Interaction.filesize_limit 2025-06-20 14:30:37 -04:00
0e4f06103e Fix InteractionCallbackResponse.resource having incorrect state
Fix InteractionCallbackResponse.resource being created
with a ConnectionState instead of _InteractionMessageState
2025-02-19 17:15:07 -05:00
43e1c55d11 Remove with_response parameter documentation 2025-02-18 04:24:01 -05:00
8953938a53 Update Pyright to v1.1.394 2025-02-18 03:29:09 -05:00
1cdf710908 Rename InteractionCallback to InteractionCallbackResponse 2025-02-18 03:29:09 -05:00
5b78097cef Add support for Interaction Callback Resource
Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com>
2025-02-18 02:10:59 -05:00
7db391189d Add __repr__ to Interaction 2025-01-15 19:01:42 -05:00
356474ffb9 Add ButtonStyle.premium 2024-06-01 03:48:50 -04:00
9d979d3df1 Some docs fixes for polls 2024-05-15 13:38:19 -04:00
e43bd8692c Add support for Polls
Co-authored-by: owocado <24418520+owocado@users.noreply.github.com>
Co-authored-by: Josh <8677174+bijij@users.noreply.github.com>
Co-authored-by: Trevor Flahardy <75498301+trevorflahardy@users.noreply.github.com>
2024-05-10 06:14:12 -04:00
64e743af50 Use InteractionMetadata for InteractionResponse.edit_message 2024-05-06 23:03:24 -04:00
2e2f51fd5c First pass at supporting user apps
Co-authored-by: red <red@kalab.sk>
Co-authored-by: Vioshim <63890837+Vioshim@users.noreply.github.com>
2024-05-04 23:25:01 -04:00
f6182e5763 Add missing suppress_embeds kwarg to InteractionResponse.edit_message 2023-12-10 17:07:50 -05:00
99618c823a Add support for premium app integrations
Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com>
Co-authored-by: Lucas Hardt <lucas.hardt@fu-berlin.de>
Co-authored-by: Andrin S. <65789180+Puncher1@users.noreply.github.com>
2023-10-19 07:27:29 -04:00
2348d72a72 Use the interaction user's guild as a fallback for Interaction.guild
This ensures that the unavailable guild that is created within __init__
is used instead of constantly recreating it.
2023-08-11 16:22:26 -04:00
2fdbe59376 Fix Message.channel being None for interactions 2023-06-23 00:19:57 -04:00
49e31e9e23 Use cache data if available for Interaction.channel
The data from Discord does not contain all the attributes that the
cached data has. There may be a slight chance that the interaction data
is more up to date than the cached data or vice versa but more
information tends to trump over this slight chance.
2023-06-17 01:24:10 -04:00
f1bade4bda Hoist webhook detection outside of store_user helper 2023-06-11 12:41:04 -04:00
53ce05b0d0 Add Interaction.channel from Discord payload
Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com>
2023-05-19 20:40:52 -04:00
bb7668f8a5 Upgrade Message.guild references if None in Interaction 2023-03-24 04:12:47 -04:00
e6ef43139f Don't store finished views/modals 2023-02-13 23:52:40 -05:00
183675be74 Add support for silent messages 2023-02-08 15:40:33 -05:00
ee07f72906 Add delete_after kwarg to InteractionMessage.edit 2023-01-25 10:13:47 -05:00
7e95f98521 Fix webhooks and interactions not closing files after a request 2023-01-25 04:22:24 -05:00
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
bee7f903e3 Document Interaction.message availability 2023-01-21 00:07:50 -05:00
bbba8c650f Add missing generic parameters on various Interaction parameters 2023-01-19 07:00:16 -05:00
bf860b0b07 Add support for generic ClientT in Interaction 2023-01-16 21:57:54 -05:00
50e66d4072 Add delete_after to Interaction.edit_message
Closes #9415
2022-12-29 06:56:15 -05:00
4c8ba635db Add delete_after into InteractionResponse.send_message 2022-10-26 04:30:57 -04:00
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
bd19ad05e7 Fix app_command_completion triggering on certain errors 2022-08-16 20:03:02 -04:00
49e6fe9a0c Fix autocomplete translations calling unnecessary locales 2022-08-14 17:35:43 -04:00
9ce1541775 Rename Interaction.original_message to original_response 2022-08-08 08:11:19 -04:00
2d586ae805 Add initial support for app command localisation 2022-08-05 22:35:30 -04:00
c4e09acff8 Add InteractionResponse.type property 2022-08-04 08:13:27 -04:00
b3a24846bd Add Interaction.app_permissions
Fix #8193
2022-06-29 22:38:04 -04:00
7ad00750c6 Add note about different client subclasses 2022-06-25 07:51:21 -04:00
573bb32a1e Fallback to an unavailable guild instead of an Object in interactions 2022-05-14 06:50:27 -04:00
4dd5cc2bc9 Pass proxy information to interactions and webhooks
Fix #7918
2022-05-05 12:07:09 -04:00
d56f5150fa Fix oversight of edit parameters not being keyword only 2022-05-04 05:02:42 -04:00
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
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
acd4a0856e Add Interaction.extras for extraneous data 2022-04-28 07:59:43 -04:00
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
c284145f18 Add and remove some versionadded directives 2022-04-10 17:12:56 -04:00