Open Anahkiasen opened 10 years ago
Actually the chat.postMessage method does not have an option to send a code snippet (or i cannot see it).
Also when sending files they are recognized automatically by their extension i think.
Thanks for the awesome plugin, @simion!
Based on my reading of the files.upload
docs at https://api.slack.com/methods/files.upload:
It looks like with files.upload
you can specify the filetype
, which overrides the automatic filetype generated from the file extension.
It also seems that files.upload
would be the right way to send a code snippet—basically sending the currently selected text in Sublime as the "content" of a new file to Slack, and optionally specifiying the filetype
of the snippet (especially since filename
and title
are both optional in the Slack API).
Maybe I’m mistaken? My Python is pretty limited, or else I would try to test this myself.
@mattparcher Honestly, I thought about this method, to upload a file containing the current selection and the name of the file you selected code from. This way, you will have automatic syntax highlighting.
As a workaround, I've added "pre" wrappers, temporarily. http://simionbaws.ro/sublime-slack/sublime-slack-preformatted-text/
Soon, i will implement your suggestion.
Thanks for your feedback.
In Slack now you can specify the type of the snippet (PHP, JSON, etc). Any way to add a way to set that (or recognize it automatically) when sending files and stuff ?