Open bsmoo opened 7 years ago
Yes! To send the message you will need to use the slack API instead of just returning a string; the github plugin does this, for example.
So you could do something like:
def on_message(msg, server):
# here we'll assume that `handle_message` returns the dict above ^^^
fancy_response = handle_message(msg)
server.slack.post_message(
msg['channel'],
'',
as_user=server.slack.username,
**fancy_response)
I haven't actually dealt with handling the responses; I'd have to look at what happens when the user clicks on the buttons. I hope I'll get some free time to look at that soon, but if you dig in first please let me know!
Thanks @llimllib - likewise let me know if you come up with anything first. I'm just going to be deploying this to a new environment so need to get everything setup again.
Is there anyway to send message attachments with buttons such as the below:
And clicking the buttons can send data back to the bot which can be logged in a database or something?