Skip to content

Commit

Permalink
✨ fix hilariously under-documented trigger issue
Browse files Browse the repository at this point in the history
  • Loading branch information
itsthejoker committed May 15, 2023
1 parent 58eab4c commit 552fbe2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion blossom/api/slack/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ def process_command(data: Dict) -> None:
"watchlist": watchlist_cmd,
"watchstatus": watchstatus_cmd,
"unclaim": unclaim_cmd,
}
modal_options = {
"submissions": submissions_cmd,
}

tokens = message.split()

if len(tokens) > 0:
Expand All @@ -83,5 +84,10 @@ def process_command(data: Dict) -> None:
options[key](channel, message)
return

for key in modal_options.keys():
# modals require different data to work
if cmd_name == key:
modal_options[key](data)

# if we fall through here, we got a message that we don't understand.
client.chat_postMessage(channel=channel, text=i18n["slack"]["errors"]["unknown_request"])
4 changes: 2 additions & 2 deletions blossom/api/slack/commands/list_submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,6 @@ def process_submission_list(data: dict) -> None:
)


def submissions_cmd(channel: str, _message: str) -> None:
def submissions_cmd(slack_data: dict) -> None:
"""Get information from a date range about submissions of a user."""
client.views_open(trigger_id=str(uuid4()), view=_build_message())
client.views_open(trigger_id=slack_data.get("trigger_id"), view=_build_message())

0 comments on commit 552fbe2

Please sign in to comment.