Commit 4b2ec8eed6856f253cf2b46cf76c8840056e5666
1 parent
c85566e3af
Exists in
master
blacklist help
Showing 4 changed files with 12 additions and 4 deletions Side-by-side Diff
config.sample.json
lib/command-handler/help.js
1 | +const config = require('komodo-sdk/config'); | |
1 | 2 | const logger = require('komodo-sdk/logger'); |
2 | 3 | const commands = require('../command-group'); |
3 | 4 | |
... | ... | @@ -27,10 +28,14 @@ const msg = 'Perintah tersedia:\n\n' + cmds2.join(',\n\n'); |
27 | 28 | |
28 | 29 | logger.verbose('Help return message constructed', { count: cmds.length, chars: msg.length, lines: msg.split(/\r\n|\r|\n/).length }); |
29 | 30 | |
30 | -module.exports = function(cb) { | |
31 | +module.exports = function(tokens, params, cb) { | |
32 | + const blacklisted = ((config.blacklist_help_for_origins || []).indexOf(params.origin || '') >= 0) | |
33 | + || ((config.blacklist_help_for_origin_transports || []).indexOf(params.origin_transport || '') >= 0) | |
34 | + ; | |
31 | 35 | |
36 | + const body = blacklisted ? `Perintah "${tokens[0]}" tdk tersedia pd jalur SMS dan sejenis.` : msg; | |
32 | 37 | const responseParams = { |
33 | - body: msg | |
38 | + body | |
34 | 39 | } |
35 | 40 | |
36 | 41 | cb(null, null, responseParams); |
lib/command-handler/index.js
lib/http-listener.js
... | ... | @@ -97,6 +97,7 @@ function mainHandler(req, res) { |
97 | 97 | |
98 | 98 | const params = { |
99 | 99 | origin: req.body.origin || req.query.origin || 'MESSAGING', |
100 | + origin_transport: req.body.origin_transport || req.query.origin_transport, | |
100 | 101 | report_ip: req.body.report_ip || req.query.report_ip || req.ip, |
101 | 102 | report_port: req.body.report_port || req.query.report_port, |
102 | 103 | from: req.body.partner || req.query.partner || req.body.from || req.query.from, |