scrapinghub / slackbot

A chat bot for Slack (https://slack.com).
MIT License
1.26k stars 396 forks source link

I would like my bot to respond text in attachments. #180

Closed andormeda-san closed 5 years ago

andormeda-san commented 5 years ago

I would like to my bot to respond text in attachments. However, "respond_to" and "listen_to" seem to respond to plain text only.

Anyone have a good idea?

Specifically, I want to respond bot to notification from stackdriver to slack as follows.

image

seerickcode commented 5 years ago

I think you would listen to / reply to everything, check for and open an attachment (if an appropriate type), then parse the contents. I have found the the reply/listen_to will match in multiple cases, so a catch all rule would not prevent other more specific rules from running.

andormeda-san commented 5 years ago

thank you for your advice. I got "message.body" as dct type as below.

@listen_to(r'[\s\S]*') def listen_func(message): dct = message.body