cabal-bot-pipeline

1.0.3 • Public • Published

cabal-bot-pipeline

npm install cabal-bot-pipeline

var CabalBot = require('cabal-bot-core')
var pipeline = require('cabal-bot-pipeline')

const cb = new CabalBot('example-bot', { channels: ['default','weather'] })

// react to !log ping
pipeline(cb).onCommand('log').onCommand('ping').do(
  (messageText, cabal, envelope) => {
    console.log('ping!')
  }
)

// react to !log pong
pipeline(cb).onCommand('log').onCommand('pong').do(
  (messageText, cabal, envelope) => {
    console.log('pong!')
  }
)

// return whatever the user enters after !return
pipeline(cb).onCommand('return').do(
  (messageText, cabal, envelope) => {
    cabal.publishMessage({
      type: 'chat/text',
      content: {
        text: messageText,
        channel: envelope.channel
      }
    })
  }
)

//r eact to !weatherreport in a channel named weather
pipeline(cb).onCommand('weatherreport').inChannel('weather').do(
  (messageText, cabal, envelope) => {
    cabal.publishMessage({
      type: 'chat/text',
      content: {
        text: 'the weather is nice and clear',
        channel: envelope.channel
      }
    })
  }
)
cb.joinCabal('{key}')

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    0
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i cabal-bot-pipeline

Weekly Downloads

0

Version

1.0.3

License

AGPL-3.0

Unpacked Size

40.2 kB

Total Files

6

Last publish

Collaborators

  • timgoeller