Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically make a send() with a "\n" be converted to a paste #17

Closed
eric opened this issue Jan 5, 2014 · 15 comments
Closed

Automatically make a send() with a "\n" be converted to a paste #17

eric opened this issue Jan 5, 2014 · 15 comments

Comments

@eric
Copy link
Contributor

eric commented Jan 5, 2014

Our campfire hubot plugins often send pastes by including a \n in a send(), but in slack it doesn't show up as a paste (and can often flood the room).

@m9
Copy link
Contributor

m9 commented Feb 14, 2014

As far as I can see - there is no pastes feature at all(or at least it doesn't work on android)

But def. 👍

@atmos
Copy link

atmos commented Jun 14, 2014

Was there every any resolution for this? Is there a way to send richly formatted messages?

@evansolomon
Copy link
Contributor

I don't think I understand the issue. We use hubot commands that send multi line messages. They act the way I'd expect...a message appears with multiple lines. Is that not how it works for others?

Is a "paste" a special kind of thing?

@mattikus
Copy link

A tactic I've been trying has been to copy scripts out of hubot-scripts and
bring them into my scripts tree and then modify them when the out of box
script doesn't quite fit with slack.

Then you're able to do the logic for converting for display at that level,
rather than the adapter.

On Sat, Jun 14, 2014 at 7:25 PM, Evan Solomon notifications@github.com
wrote:

I don't think I understand the issue. We use hubot commands that send
multi line messages. They act the way I'd expect...a message appears with
multiple lines. Is that not how it works for others?

Is a "paste" a special kind of thing?


Reply to this email directly or view it on GitHub
#17 (comment)
.

@atmos
Copy link

atmos commented Jun 15, 2014

@evansolomon in campfire you can paste and it preserves simple text formatting.

I'm gonna try to send tables of info back with #32. Not sure if I can do that or not.

@paulhammond
Copy link
Contributor

The challenge here is that Slack's servers don't work the same way Campfire does... Slack doesn't have the concept of "pastes".

We could fake this support inside hubot-slack (either by creating a Slack snippet, or by using Slack's built in message formatting) but I'm worried doing that would break scripts for people that are happily using our existing multiline message support (like, for example, Evan above).

Is there still demand for this functionality?

@eric
Copy link
Contributor Author

eric commented Dec 10, 2014

It definitely makes interoperating with scripts that were created with campfire in mind less pleasant to use from Slack.

It definitely could help if hubot got a little bit more of an explicit API for "chunks of text that should be formatted with a fixed width font and possibly collapsed".

@paulhammond
Copy link
Contributor

[cc @technicalpickles to see if he has any ideas]

@technicalpickles
Copy link
Contributor

This is a tough one. Hubot has historically been pretty campfire centric, so in most cases that I've written community scripts, it's assumed that if you send a string with newlines, it will come out as a paste. If you need to send multiple messages, you can call send with multiple arguments.

We could fake this support inside hubot-slack (either by creating a Slack snippet, or by using Slack's built in message formatting

I think creating snippets seems most analogous with pastes, which make a lot of sense to me. I don't think the builtin message formatting would work out as well, because most off the shelf scripts probably won't be expecting to be formated in anyway, just pasting.

I'm worried doing that would break scripts for people that are happily using our existing multiline message support (like, for example, Evan above).

That is going to be a problem for sure. I don't think there's a way to know how many people are using off the shelf scripts and it's sending multi-line text as multiple message, versus people creating their own versions that customize it, and I can't think of a good way to determine that. That said, my gut says there's less people doing the latter, so sending multiline text as a snippet would make sense for more people getting started, in addition to being easier for people transitioning from hubots running on Campfire.

It definitely could help if hubot got a little bit more of an explicit API for "chunks of text that should be formatted with a fixed width font and possibly collapsed".

I could see that possibility too. But it's a change to the API, which would take time for people to transition their scripts to, as well as updating their bot to a version with it.

On the plus side, it might be nice for the IRC adapter, as while it doesn't have any native way to paste text, could use a pastebin or gist type thing under the hood.

@pixelrebel
Copy link

Just checking in on this. Are snippets supported at this time?

@technicalpickles
Copy link
Contributor

Another option: when multiple lines are detected, wrap it up in an attachment using customMessage. Attachments only show the first 5 lines by default, so that'd prevent flooding.

@technicalpickles
Copy link
Contributor

I put a fix for this together over at #235 if anyone wants to try it.

Are snippets supported at this time?

Worth noting that snippets are just file uploads under the hood, and as talked about in #62, files.upload isn't supported for bot users.

@kiliankoe
Copy link

#62 has since been updated that files.upload is now supported for bot users. Just FYI 😊

@DEGoodmanWilson
Copy link

I'm of two minds about this. On one hand, a message with line breaks in it is a perfectly valid message—on the other, as has been noted, it is different behavior from what is often expected. What if we included an optional flag to indicate that a message should instead be uploaded as a snippet? I'm not entirely in love with this idea, but I am very reluctant to change the default behavior.

@johnagan
Copy link

I'm closing this because I doesn't seem like something we're going to take on. It seems to be a hot topic (a year ago), so if folks still feel strongly about it, let's discuss in a PR on how it might work. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.