You could accomplish something like this with Zapier, or a similar service. There’s a pre-built Slack/Discourse integration that could be used for this: https://zapier.com/apps/discourse/integrations/slack. My main concern with using it would be that you wouldn’t have control over the number of messages that get processed. Depending on your team’s Slack usage, it could quickly use up your allowed number of tasks on your Zapier plan.
Something similar to the above could be accomplished with any chat provider that has an existing Zapier integration.
The Chatroom Integration Plugin (discourse-chat-integration) allows you to post Slack transcripts to Discourse with a /discourse post
slash command. This seems like a good approach to me, because it doesn’t force all Slack posts to be published to Discourse. Unfortunately, posting transcripts to Discourse is currently only supported when Slack is used as the Chat provider.