UQComputingSociety / uqcsbot-slack

:mortar_board: UQCSbot: our friendly little Slack bot
https://slack.uqcs.org.au
MIT License
55 stars 44 forks source link

Add a the ability to add link buttons to a message #311

Open Guthers opened 6 years ago

Guthers commented 6 years ago

Good example of call api required - https://github.com/slackapi/python-link-button-example/blob/master/example.py. Extended to work a bit nicer.

Additionally, will likely be similar to post_message with additional specification for the button(s)

TRManderson commented 6 years ago

Tbh I don't see what needs to actually change here? At most a wrapper class for buttons?

TRManderson commented 6 years ago

Ah I see now - the web server bit

Guthers commented 6 years ago

So this has blown out to implementing attachments in general with only implementing the link button specifically

Guthers commented 6 years ago

@TRManderson There is a bit of functionality and requirements required (which as far as I have seen haven't being made anywhere. I am using this as a guide https://api.slack.com/docs/message-attachments#when_to_use_attachments. The actual api call will be quite simple but I want it to be simple af to add attachements (such as buttons) to a message

mitchmcdee commented 6 years ago

I'm confused. Isn't this just bot.post_message(channel, text, attachments="stuff")?

Guthers commented 6 years ago

How does one currently format those attachments tho? @mitchmcdee

mitchmcdee commented 6 years ago

isn't it in the document you linked? https://api.slack.com/docs/message-attachments#attachment_structure

Guthers commented 6 years ago

I am trying to get a step away of needing to go into the docs, and providing an easy (and quick) way to add attachments like buttons

TRManderson commented 6 years ago

I reckon you'll just end up reading the docs anyway tbh

mitchmcdee commented 6 years ago

Ya this just seems like an abstraction of one facet of attachments and trades off reading their docs for reading yours. Additionally, they have pretty good docs already, and the structure looks pretty straight forward, so I don't think the abstraction is necessary

mitchmcdee commented 6 years ago

what you could do though is whip up an example of using buttons, say for !poll or something, and that'd be a nice demonstration of attachments/buttons :^)

Guthers commented 6 years ago

@mitchmcdee I am currently doing so. The idea originally came from @jdcaperon's work on the umart command for having links to the pages, as the links were quite long we are looking to not clutter screen real estate

TRManderson commented 6 years ago

Check out Max's Hoogle PR (#312) for ezmodo link formatting