slack-remove-formatting

Remove Slack message formatting.

Usage no npm install needed!

<script type="module">
  import slackRemoveFormatting from 'https://cdn.skypack.dev/slack-remove-formatting';
</script>

README

Remove Slack message formatting npm version

Library version of this code.

Usage

const slack = require('@slack/client')
const makeRemoveFormatting = require('slack-remove-formatting')

const rtm = new slack.RtmClient(config.token)

rtm.on(slack.CLIENT_EVENTS.RTM.AUTHENTICATED, state => {
  const removeFormatting = makeRemoveFormatting(state)

  rtm.on(slack.RTM_EVENTS.MESSAGE, message => {
    const text = removeFormatting(message.text)
    console.log(text)
  })
})