diff --git a/lib/command-handler/daysummary.js b/lib/command-handler/daysummary.js index 7e81452..72f1643 100644 --- a/lib/command-handler/daysummary.js +++ b/lib/command-handler/daysummary.js @@ -1,20 +1,17 @@ -"use strict"; - const coreEndpoint = '/stores/summary'; const commandError = require('./error'); const coreapi = require('../coreapi'); function help(keyword) { - return `Untuk melihat laporan harian, ketik perintah dengan format: ${ keyword.toUpperCase() }.<PIN> atau ${ keyword.toUpperCase() }.<TANGGAL>.<PIN>. Format tanggal YYYY-MM-DD, contoh 2018-12-31 untuk tanggal 31 Desember 2018.`; + return `Untuk melihat laporan harian, ketik perintah dengan format: ${keyword.toUpperCase()}.<PIN> atau ${keyword.toUpperCase()}.<TANGGAL>.<PIN>. Format tanggal YYYY-MM-DD, contoh 2018-12-31 untuk tanggal 31 Desember 2018.`; } function execute(tokens, params, cb) { - if (!tokens || tokens.length < 2) { const responseParams = { - body: `${ commandError.ERR_INVALID_FORMAT }. ${ help(tokens[0]) }` - } + body: `${commandError.ERR_INVALID_FORMAT}. ${help(tokens[0])}`, + }; cb(null, null, responseParams); return; @@ -33,4 +30,4 @@ function execute(tokens, params, cb) { coreapi(coreEndpoint, coreParams, 'GET', cb); } -module.exports = execute; \ No newline at end of file +module.exports = execute; diff --git a/lib/command-handler/listtrx.js b/lib/command-handler/listtrx.js index 3d546c8..6431303 100644 --- a/lib/command-handler/listtrx.js +++ b/lib/command-handler/listtrx.js @@ -6,7 +6,11 @@ const commandError = require('./error'); const coreapi = require('../coreapi'); function help(keyword, commandGroup) { - return `Untuk melihat list transaksi${ commandGroup === 'listtrxall' ? ' termasuk downline': ''}, ketik perintah dengan format: ${ keyword.toUpperCase() }.<PIN> atau ${ keyword.toUpperCase() }.<TANGGAL>.<PIN>. Format tanggal YYYY-MM-DD, contoh 2018-12-31 untuk tanggal 31 Desember 2018.`; + return `Untuk melihat list transaksi${ + commandGroup === 'listtrxall' + ? ' termasuk downline' + : '' + }, ketik perintah dengan format: ${keyword.toUpperCase()}.<PIN> atau ${keyword.toUpperCase()}.<TANGGAL>.<PIN>. Format tanggal YYYY-MM-DD, contoh 2018-12-31 untuk tanggal 31 Desember 2018.`; } module.exports = (tokens, params, cb) => { @@ -16,21 +20,17 @@ module.exports = (tokens, params, cb) => { if (blacklisted) { const body = `Perintah "${tokens[0]}" tdk tersedia pd jalur SMS dan sejenis.`; - const responseParams = { - body - } - + const responseParams = { body }; + cb(null, null, responseParams); return; } } - - if (!tokens || tokens.length < 2) { const responseParams = { - body: `${ commandError.ERR_INVALID_FORMAT }. ${ help(tokens[0], params.commandGroup) }` - } + body: `${commandError.ERR_INVALID_FORMAT}. ${help(tokens[0], params.commandGroup)}`, + }; cb(null, null, responseParams); return;