2019-02-22 17:32:06 +01:00
|
|
|
const templates = require('./templates');
|
|
|
|
|
|
|
|
function sendErrorMessage(error, msgBot) {
|
|
|
|
switch (error.message) {
|
|
|
|
case 'DevicesNotFound':
|
|
|
|
msgBot.reply.text(templates.devicesNotFound());
|
|
|
|
break;
|
|
|
|
case 'DeviceNotFound':
|
|
|
|
msgBot.reply.text(templates.devicesNotFound(msgBot.text));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
msgBot.reply.text(templates.error());
|
2019-02-22 10:02:51 +01:00
|
|
|
}
|
2019-02-21 14:54:46 +01:00
|
|
|
}
|
|
|
|
|
2019-02-22 17:32:06 +01:00
|
|
|
function convertTimestamp(timestamp) {
|
|
|
|
return new Date(timestamp * 1000).toISOString().slice(0, 19);
|
2019-02-21 14:54:46 +01:00
|
|
|
}
|
|
|
|
|
2019-02-22 17:32:06 +01:00
|
|
|
module.exports.convertTimestamp = convertTimestamp;
|
|
|
|
module.exports.sendErrorMessage = sendErrorMessage;
|