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

✨ Partially implement MODAL_SUBMIT #485

Merged
merged 6 commits into from Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
This conversation was marked as resolved.
Show resolved Hide resolved
# 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.
This conversation was marked as resolved.
Show resolved Hide resolved
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