Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Commit

Permalink
✨ Partially implement MODAL_SUBMIT (#485)
Browse files Browse the repository at this point in the history
* ✨ Add modal interaction type

* ✨ Add SUPPRESS_EMBEDS message flag

* ✨ Add "not implemented" handler for MODAL

* ✏️ Accidentally pasted something

* ✨

* Update interaction_create.py
  • Loading branch information
Sly-Little-Fox authored Jun 20, 2022
1 parent aed6281 commit 9215702
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
8 changes: 7 additions & 1 deletion pincer/middleware/interaction_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,14 @@ def get_call(
command = ComponentHandler.register.get(interaction.data.custom_id)
return command.call, command.manager
elif interaction.type == InteractionType.AUTOCOMPLETE:
# TODO: Implement autocomplete
raise NotImplementedError(
"Handling for autocomplete is not implemented"
"Handling for autocomplete is not implemented yet."
)
elif interaction.type == InteractionType.MODAL:
# TODO: Implement modals
raise NotImplementedError(
"Handling for modals is not implemented yet."
)


Expand Down
10 changes: 9 additions & 1 deletion pincer/objects/app/interaction_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class CallbackType(IntEnum):
For components, ACK an interaction and edit the original message later
UPDATE_MESSAGE:
For components, edit the message the component was attached to
MODAL:
Reply to that interaction with a modal
"""

# noqa: E501
Expand All @@ -42,6 +44,7 @@ class CallbackType(IntEnum):
DEFERRED_MESSAGE = 5
DEFERRED_UPDATE_MESSAGE = 6
UPDATE_MESSAGE = 7
MODAL = 9


class InteractionType(IntEnum):
Expand All @@ -55,13 +58,18 @@ class InteractionType(IntEnum):
APPLICATION_COMMAND:
A "slash" command.
MESSAGE_COMPONENT:
A ui component like buttons and selects.
A UI component like buttons and selects.
AUTOCOMPLETE:
Autocomplete for interaction options.
MODAL:
Emitter when a modal gets submitted.
"""

PING = 1
APPLICATION_COMMAND = 2
MESSAGE_COMPONENT = 3
AUTOCOMPLETE = 4
MODAL = 5


@dataclass(repr=False)
Expand Down
5 changes: 4 additions & 1 deletion pincer/objects/app/interaction_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ class InteractionFlags(IntFlag):
Attributes
----------
EPHEMERAL:
only the user receiving the message can see it
Only the user receiving the message can see it.
SUPPRESS_EMBEDS:
No link embeds should be shown for this message.
"""

EPHEMERAL = 1 << 6
SUPPRESS_EMBEDS = 1 << 2

0 comments on commit 9215702

Please sign in to comment.