Open voycey opened 8 years ago
Hi, that's a really cool idea! Aren't snippets ignored at the moment though? Since snippet messages have a subtype
of file_share
they should be ignored by this: https://github.com/ekmartin/slack-irc/blob/master/lib/bot.js#L99
Would love a PR implementing what you're suggesting though. A few quick pointers:
You can either modify the existing message listener to check for messages with the correct subtype (file_share
) and the correct file mode (snippet
, see https://api.slack.com/types/file), or you could add another listener that listens only for file_shared-events. The latter is probably cleaner, to avoid too much logic in the message listener.
When you've hooked up the listener and verified that the file mode is correct, you'll need to create an anonymous Gist. Doesn't really matter if you do it directly with an API call (with e.g. node-fetch) or if you use something like https://github.com/michael/github - both use promises so it's up to you. After you've received a valid gist url you probably want to notify the IRC channel with the url. The easiest way to do this is just using sendToIRC with the original message object but with a modified text property containing a message and a link to the Gist.
Would be nice with some tests as well. Feel free to ask in the Gitter channel if you have any questions 😀
Currently ours get pushed through (but I am not 100% sure that it hasnt been modified to do that - I haven't tried out the original as of yet), I just know this is something we need :)
Ill have a look at implementing this in the coming weeks and will fire over PR for it!
Somewhat related: it’d be nice if long messages would get truncated on IRC and a message to that effect sent back to the slack user.
Has any progress been made on this? :)
One of Slack's outstanding features is the ability to include formatted code snippets, in cases where we have an extended community across IRC and Slack using this plugin when Slack users post code snippets (which we dont want to discourage) - it makes IRC unreadable.
I am happy to contribute to fixing this using the Github public GIST api, but a discussion & some pointers of where to do it would be great :)