Skip to content

Commit

Permalink
Add ephemeral response_type to the Slack connector IneractiveAction r…
Browse files Browse the repository at this point in the history
…espond method

- Added in kwargs to the respond method
- Set response_type variable based on kwarg with same name
- Set response_type based on value passed in for the case where
  response_event is a str
  • Loading branch information
Ajit D'Sa committed Jul 5, 2021
1 parent 0079314 commit 193133a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions opsdroid/connector/slack/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ def __init__(self, payload, *args, **kwargs):
self.payload = payload
self.ssl_context = ssl.create_default_context(cafile=certifi.where())

async def respond(self, response_event):
async def respond(self, response_event, **kwargs):
"""Respond to this message using the response_url field in the payload."""
response_type = kwargs.get("response_type", "in_channel")

if isinstance(response_event, str):
if "response_url" in self.payload:
Expand All @@ -83,7 +84,7 @@ async def respond(self, response_event):
"text": response_event,
"replace_original": False,
"delete_original": False,
"response_type": "in_channel",
"response_type": response_type,
}
),
headers=headers,
Expand Down

0 comments on commit 193133a

Please sign in to comment.