Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Commit

Permalink
Update devices.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxelweb committed Apr 30, 2020
1 parent 7da4b5d commit 6ccbfc4
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions commands/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const botDevices = (bot, auth) => {
getDeviceList()
.then(() => {
if (deviceList.length !== 0) {
console.log("Lista dispositivi caricata correttamente");
message.reply(
"Seleziona il dispositivo a cui inviare un comando:",
Markup.keyboard(deviceList).oneTime().resize().extra()
Expand Down Expand Up @@ -83,7 +82,6 @@ const botDevices = (bot, auth) => {
});
};
getButtons(message).then(() => {
console.log("Lista sensori caricata correttamente");
Markup.removeKeyboard();
message.reply(
"Seleziona il sensore:",
Expand Down Expand Up @@ -123,24 +121,27 @@ const botDevices = (bot, auth) => {
data: realCommand,
})
.then((res) => {
console.log(res);
message.reply(
`\u{2705} Hai richiesto ${
action === "Attiva" ? "l'attivazione" : "la disattivazione"
} del sensore #${sensorID} del dispositivo #${deviceID}`,
Markup.removeKeyboard().extra()
);
})
.catch((err) => {
console.log(err);
message.reply(
`[Errore] La richiesta *non* è andata a buon fine. La configurazione potrebbe essere cambiata. Riprova.`,
Markup.removeKeyboard().extra());
});
};
switch (action) {
case "Attiva":
sendCommandToAPI(1);
break;
case "Disattiva":
sendCommandToAPI(0);
break;
}
message.reply(
`\u{2705} Hai richiesto ${
action === "Attiva" ? "l'attivazione" : "la disattivazione"
} del sensore #${sensorID} del dispositivo #${deviceID}`,
Markup.removeKeyboard().extra()
);
}
);

Expand Down

0 comments on commit 6ccbfc4

Please sign in to comment.