From 9c600000d32db044770c002fac10ceaca2627443 Mon Sep 17 00:00:00 2001 From: Francesco Esposito <33671357+frab1t@users.noreply.github.com> Date: Tue, 12 Feb 2019 22:04:58 +0100 Subject: [PATCH] add check - device not found --- utils.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utils.js b/utils.js index a150c30..8a479dc 100644 --- a/utils.js +++ b/utils.js @@ -7,13 +7,13 @@ function isAuthorizedUser(userId) { function templateStart() { const msg = `* Welcome to ${appConfig.app.name} 📱📡*\n A bot to find devices on your network. \n -Made with ❤️ by @f3sposito `; +Made with ❤️ by @frab1t `; return msg; } function templateUnauthorizedUser() { const msg = `Unauthorized user. 🤖 \n -Clone the repository https://github.com/f3sposito/lscanbot +Clone the repository https://github.com/frab1t/lscanbot and run the bot on your local network. 😎`; return msg; } @@ -29,6 +29,10 @@ function templateHelp() { } function templateDevicesList(data) { + if(data.length === 0) { + let devices = '📡 Devices Not Found. \n\n'; + return devices; + } let devices = '📡 Devices available: \n\n'; data.forEach((elem) => { devices += `----- \n 📱 * ${elem.device} * \n 👉 _ ${elem.owner} _ \n \n `;