# Description: # meta-asjon # # Dependencies: # None # # Configuration: # None # # Author: # Michele Guerini Rocco (rnhmjoj) { CatchAllMessage } = require 'hubot' module.exports = (robot) -> #direct talk in user chat receive = (message) -> listeners = -> res = [] for listener in robot.listeners try res.push listener.call message break if message.done catch error robot.emit 'error', error, new (robot.Response robot, message, []) false res results = listeners() unless message.done or (results.reduce (x, y) -> x or y) if message.room == message.user.id message.text = robot.name + ' ' + message.text results.push listeners()... if message not instanceof CatchAllMessage and (results.indexOf true) is -1 robot.receive new CatchAllMessage message robot.receive = receive