Hi all,
I had been trying to add a delay between messages send by the bot using the Slack Channel slack.py
. When I do that, the bot is looping with the Hello
message(this is the first bot utterance in the story).
Here is the content of slack.py
@staticmethod
def _get_text_from_slack_buttons(buttons: List[Dict]) -> Text:
return "".join([b.get("title", "") for b in buttons])
async def send_text_message(
self, recipient_id: Text, text: Text, **kwargs: Any
) -> None:
recipient = self.slack_channel or recipient_id
await asyncio.sleep(2)
for message_part in text.strip().split("\n\n"):
await self.client.chat_postMessage(
channel=recipient, as_user=True, text=message_part, type="mrkdwn",
)
It seems to be related with the async functions. But I would like to know if someone had some experience working with it.
thanks