Commit 8b4f9441 by zCaesar

add on_delivery

parent 3cd9bfde
function on_delivery(req, res, next) {
var topics = beDesireTopic(req.body.topic)
var response = {
'result': 'ok',
'modifiers': {
"topic": topics
}
}
res.send(response)
}
module.exports.on_delivery = on_delivery
function hasGroup(topics) {
if (topics.indexOf('!') > -1) {
return true
}
else return false
}
function beDesireTopic(topics) {
if (hasGroup(topics)) {
return joinTopic(topics)
}
else return topics
}
function joinTopic(topics) {
var topic = topics.split('/!')[1]
return topics.split('/!')[0] + topic.substring(topic.indexOf('/'), topic.length)
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment