hubot-proxy

0.1.0 • Public • Published

hubot-proxy

A hubot adapter event listener that sits inbetween hubot and the desired hubot adapter.

The proxied events are dispatched to a config object that behaves like an adapter observer. To use this adapter, you need to include this in the base directory for the node application/package as adapter-proxy-config.coffee or adapter-proxy-config.js.

A simple example:

class MyProxyConfig
  adapter: "campfire"
 
  events: {
    shouldSend: (adapter, envelope, strings...) ->
      if somethingIsWrong
        false
      true
    
    willSend: (adapter, envelope, strings...) ->
      #do stuff before the message is sent 
      ...
    ...
    
    stringsForSend: (adapter, envelope, originalStrings...) ->
      #Modify messages that hubot responds with 
      return originalStrings.map((obj) -> obj.toLowerCase())
  }
module.exports = MyProxyConfig

Where adapter provides the underlying hubot adapter to proxy and events defines actions for observed adapter events.

Currently supported events:

  • shouldSend
  • willSend
  • stringsForSend
  • didSend
  • shouldEmote
  • willEmote
  • stringsForEmote
  • didEmote
  • shouldReply
  • willReply
  • stringsForReply
  • didReply
  • shouldTopic
  • willTopic
  • stringsForTopic
  • didTopic
  • shouldPlay
  • willPlay
  • stringsForPlay
  • didPlay
  • shouldReceive
  • willReceive
  • didReceive
  • willLaunch
  • didLaunch
  • willExit
  • didExit

Package Sidebar

Install

npm i hubot-proxy

Weekly Downloads

4

Version

0.1.0

License

none

Last publish

Collaborators

  • hammertime38